OpenASIP  2.0
DataInstructionAddressDef.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file DataInstructionAddressDef.cc
26  *
27  * Implementation of DataInstructionAddressDef class.
28  *
29  * @author Mikael Lepistö 2006 (mikael.lepisto-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
34 #include "InstructionReference.hh"
35 #include "Instruction.hh"
36 #include "Address.hh"
37 
38 namespace TTAProgram {
39 
40 /**
41  * Creates data area definition containing reference to an instruction.
42  *
43  * @param start Starting address of definition.
44  * @param size Number of MAUs that area represents.
45  * @param dest Instruction which is referred by the data definition.
46  */
48  Address start, int size, InstructionReference& dest, bool littleEndian) :
49  DataDefinition(start, size, littleEndian), dest_(dest) {
50 }
51 
52 /**
53  * Nothing to free.
54  */
56 }
57 
58 /**
59  * Returns true, class defines always initialized data area.
60  *
61  * @return Always true.
62  */
63 bool
65  return true;
66 }
67 
68 /**
69  * Returns true, class contains always address reference.
70  *
71  * @return Always true.
72  */
73 bool
75  return true;
76 }
77 
78 /**
79  * Returns true if init data of definition contains an instruction address.
80  *
81  * @return True if init data of definition contains an instruction address.
82  */
83 bool
85  return true;
86 }
87 
88 /**
89  * Returns destination address, where to intialization value refers.
90  *
91  * @return Destination address of initialized data area.
92  */
93 Address
95  return dest_.instruction().address();
96 }
97 
98 /**
99  * Copying of this class is *not* allowed.
100 
101  * This class can't be copied, because InstructionReferece cannot
102  * be copied correctly.
103  *
104  * @return Throws always an exception.
105  */
108  throw WrongSubclass(
109  __FILE__, __LINE__, __func__,
110  "DataInstructionAddress definition cannot be copied.");
111 }
112 
113 }
TTAProgram
Definition: Estimator.hh:65
TTAProgram::InstructionReference::instruction
Instruction & instruction() const
Definition: InstructionReference.cc:138
TTAProgram::DataDefinition
Definition: DataDefinition.hh:52
TTAProgram::Address
Definition: Address.hh:51
TTAProgram::DataInstructionAddressDef::DataInstructionAddressDef
DataInstructionAddressDef(Address start, int size, InstructionReference &dest, bool littleEndian)
Definition: DataInstructionAddressDef.cc:47
TTAProgram::DataInstructionAddressDef::~DataInstructionAddressDef
virtual ~DataInstructionAddressDef()
Definition: DataInstructionAddressDef.cc:55
TTAProgram::DataInstructionAddressDef::dest_
InstructionReference dest_
Destination instruction of data area.
Definition: DataInstructionAddressDef.hh:66
DataInstructionAddressDef.hh
TTAProgram::DataInstructionAddressDef::isInstructionAddress
virtual bool isInstructionAddress() const
Definition: DataInstructionAddressDef.cc:84
TTAProgram::DataInstructionAddressDef::copy
DataDefinition * copy() const
Definition: DataInstructionAddressDef.cc:107
TTAProgram::DataInstructionAddressDef::destinationAddress
virtual Address destinationAddress() const
Definition: DataInstructionAddressDef.cc:94
Instruction.hh
WrongSubclass
Definition: Exception.hh:336
TTAProgram::DataInstructionAddressDef::isInitialized
virtual bool isInitialized() const
Definition: DataInstructionAddressDef.cc:64
__func__
#define __func__
Definition: Application.hh:67
TTAProgram::DataInstructionAddressDef::isAddress
virtual bool isAddress() const
Definition: DataInstructionAddressDef.cc:74
Address.hh
InstructionReference.hh
TTAProgram::InstructionReference
Definition: InstructionReference.hh:49
TTAProgram::Instruction::address
Address address() const
Definition: Instruction.cc:327