OpenASIP  2.0
UniversalMachine.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2011 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 UniversalMachine.hh
26  *
27  * Declaration of UniversalMachine class.
28  *
29  * @author Lasse Laasonen 2004 (lasse.laasonen-no.spam-tut.fi)
30  * @author Pekka Jääskeläinen 2006,2011 (pekka.jaaskelainen-no.spam-tut.fi)
31  * @note rating: yellow
32  */
33 
34 #ifndef TTA_UNIVERSAL_MACHINE_HH
35 #define TTA_UNIVERSAL_MACHINE_HH
36 
37 #include "Machine.hh"
38 #include "OperationPool.hh"
39 
42 
43 // the size of the data address space in bytes (MAUs) is 4GB.
44 #define DATA_MEMORY_SIZE (static_cast<unsigned int>(4096)*1024*1024)
45 
46 /**
47  * UniversalMachine is used to mark unassigned/unscheduled resources.
48  *
49  * In the old versions of TCE, UniversalMachine represented a TTA processor
50  * which used to model an imaginary target for the old "sequential code",
51  * an intermediate format from the old gcc frontend. Previously, one UM
52  * instance per Program was created but from now one, the singleton object
53  * should be used everywhere because UM resources are just used to mark
54  * unscheduled parts of the program.
55  */
57 public:
58  virtual ~UniversalMachine();
59 
60  virtual bool isUniversalMachine() const;
69 
70  virtual void addBus(TTAMachine::Bus& bus);
71  virtual void addSocket(TTAMachine::Socket& socket);
72  virtual void addFunctionUnit(TTAMachine::FunctionUnit& unit);
73  virtual void addImmediateUnit(TTAMachine::ImmediateUnit& unit);
74  virtual void addRegisterFile(TTAMachine::RegisterFile& unit);
75  virtual void addAddressSpace(TTAMachine::AddressSpace& as);
76  virtual void addBridge(TTAMachine::Bridge& bridge);
78  virtual void setGlobalControl(TTAMachine::ControlUnit& unit);
79 
80  virtual void removeBus(TTAMachine::Bus& bus);
81  virtual void removeSocket(TTAMachine::Socket& socket);
82  virtual void removeFunctionUnit(TTAMachine::FunctionUnit& unit);
83  virtual void removeRegisterFile(TTAMachine::RegisterFile& unit);
85  virtual void unsetGlobalControl();
86 
87  virtual void loadState(const ObjectState* state);
88 
89  static UniversalMachine& instance();
90 
91 private:
93 
94  void construct();
95 
96  /// Indicates whether the UniversalMachine is built completely.
97  bool isBuilt_;
98  /// The operation pool instance to use for finding operations.
100  /// The singleton instance. Use this instance everywhere. Creating
101  /// multiple instances of UM is deprecated.
103 };
104 
105 /// Machine component names reserved for the universal machine.
106 #define UM_BUS_NAME "universal_bus"
107 #define UM_SEGMENT_NAME "universal_segment"
108 #define UM_INPUT_SOCKET_NAME "universal_input_socket"
109 #define UM_OUTPUT_SOCKET_NAME "universal_output_socket"
110 #define UM_BOOLEAN_RF_NAME "universal_boolean_rf"
111 #define UM_BOOLEAN_RF_WRITE_PORT "universal_boolean_write_port"
112 #define UM_BOOLEAN_RF_READ_PORT "universal_boolean_read_port"
113 #define UM_INTEGER_URF_NAME "universal_integer_rf"
114 #define UM_INTEGER_URF_WRITE_PORT "universal_rf_write_port"
115 #define UM_INTEGER_URF_READ_PORT "universal_rf_read_port"
116 #define UM_DOUBLE_URF_NAME "universal_double_rf"
117 #define UM_DOUBLE_URF_WRITE_PORT "universal_drf_write"
118 #define UM_DOUBLE_URF_READ_PORT "universal_drf_read"
119 #define UM_SPECIAL_RF_NAME "universal_special_rf_return_value"
120 #define UM_SPECIAL_RF_WRITE_PORT "universal_special_rf_write"
121 #define UM_SPECIAL_RF_READ_PORT "universal_special_rf_read"
122 #define UM_UNIVERSAL_FU_NAME "universal_fu"
123 #define UM_IMEM_NAME "universal_instructions"
124 #define UM_DMEM_NAME "universal_data"
125 #define UM_GCU_NAME "universal_gcu"
126 
127 #endif
UniversalMachine::removeFunctionUnit
virtual void removeFunctionUnit(TTAMachine::FunctionUnit &unit)
Definition: UniversalMachine.cc:529
UniversalMachine::integerRegisterFile
UnboundedRegisterFile & integerRegisterFile() const
Definition: UniversalMachine.cc:234
UniversalMachine::addBridge
virtual void addBridge(TTAMachine::Bridge &bridge)
Definition: UniversalMachine.cc:447
UniversalMachine::dataAddressSpace
TTAMachine::AddressSpace & dataAddressSpace() const
Definition: UniversalMachine.cc:293
UniversalMachine::booleanRegisterFile
TTAMachine::RegisterFile & booleanRegisterFile() const
Definition: UniversalMachine.cc:221
UniversalMachine::addAddressSpace
virtual void addAddressSpace(TTAMachine::AddressSpace &as)
Definition: UniversalMachine.cc:427
UnboundedRegisterFile
Definition: UnboundedRegisterFile.hh:43
TTAMachine::AddressSpace
Definition: AddressSpace.hh:51
TTAMachine::Bridge
Definition: Bridge.hh:51
UniversalMachine::universalBus
TTAMachine::Bus & universalBus() const
Definition: UniversalMachine.cc:306
UniversalMachine::opPool
OperationPool opPool
The operation pool instance to use for finding operations.
Definition: UniversalMachine.hh:99
TTAMachine::Bus
Definition: Bus.hh:53
UniversalMachine::instance
static UniversalMachine & instance()
Definition: UniversalMachine.cc:73
UniversalMachine::doubleRegisterFile
UnboundedRegisterFile & doubleRegisterFile() const
Definition: UniversalMachine.cc:251
UniversalMachine::removeRegisterFile
virtual void removeRegisterFile(TTAMachine::RegisterFile &unit)
Definition: UniversalMachine.cc:545
ObjectState
Definition: ObjectState.hh:59
UniversalFunctionUnit
Definition: UniversalFunctionUnit.hh:50
UniversalMachine::isBuilt_
bool isBuilt_
Indicates whether the UniversalMachine is built completely.
Definition: UniversalMachine.hh:97
UniversalMachine::loadState
virtual void loadState(const ObjectState *state)
Definition: UniversalMachine.cc:593
TTAMachine::InstructionTemplate
Definition: InstructionTemplate.hh:49
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
UniversalMachine::deleteAddressSpace
virtual void deleteAddressSpace(TTAMachine::AddressSpace &as)
Definition: UniversalMachine.cc:561
UniversalMachine::addInstructionTemplate
virtual void addInstructionTemplate(TTAMachine::InstructionTemplate &iTemp)
Definition: UniversalMachine.cc:462
UniversalMachine::UniversalMachine
UniversalMachine()
Definition: UniversalMachine.cc:61
TTAMachine::ControlUnit
Definition: ControlUnit.hh:50
UniversalMachine
Definition: UniversalMachine.hh:56
UniversalMachine::addFunctionUnit
virtual void addFunctionUnit(TTAMachine::FunctionUnit &unit)
Definition: UniversalMachine.cc:367
TTAMachine::Socket
Definition: Socket.hh:53
UniversalMachine::addRegisterFile
virtual void addRegisterFile(TTAMachine::RegisterFile &unit)
Definition: UniversalMachine.cc:405
Machine.hh
UniversalMachine::removeBus
virtual void removeBus(TTAMachine::Bus &bus)
Definition: UniversalMachine.cc:499
UniversalMachine::instance_
static UniversalMachine * instance_
The singleton instance. Use this instance everywhere. Creating multiple instances of UM is deprecated...
Definition: UniversalMachine.hh:102
UniversalMachine::instructionAddressSpace
TTAMachine::AddressSpace & instructionAddressSpace() const
Definition: UniversalMachine.cc:280
UniversalMachine::universalFunctionUnit
UniversalFunctionUnit & universalFunctionUnit() const
Definition: UniversalMachine.cc:205
UniversalMachine::setGlobalControl
virtual void setGlobalControl(TTAMachine::ControlUnit &unit)
Definition: UniversalMachine.cc:479
UniversalMachine::addImmediateUnit
virtual void addImmediateUnit(TTAMachine::ImmediateUnit &unit)
Definition: UniversalMachine.cc:387
UniversalMachine::addBus
virtual void addBus(TTAMachine::Bus &bus)
Definition: UniversalMachine.cc:324
UniversalMachine::unsetGlobalControl
virtual void unsetGlobalControl()
Definition: UniversalMachine.cc:574
TTAMachine::RegisterFile
Definition: RegisterFile.hh:47
OperationPool
Definition: OperationPool.hh:52
UniversalMachine::construct
void construct()
Definition: UniversalMachine.cc:83
UniversalMachine::specialRegisterFile
TTAMachine::RegisterFile & specialRegisterFile() const
Definition: UniversalMachine.cc:267
OperationPool.hh
TTAMachine::Machine
Definition: Machine.hh:73
UniversalMachine::addSocket
virtual void addSocket(TTAMachine::Socket &socket)
Definition: UniversalMachine.cc:346
UniversalMachine::removeSocket
virtual void removeSocket(TTAMachine::Socket &socket)
Definition: UniversalMachine.cc:514
UniversalMachine::isUniversalMachine
virtual bool isUniversalMachine() const
Definition: UniversalMachine.cc:195
UniversalMachine::~UniversalMachine
virtual ~UniversalMachine()
Definition: UniversalMachine.cc:191
TTAMachine::ImmediateUnit
Definition: ImmediateUnit.hh:50