OpenASIP  2.0
ICDecoderEstimatorPlugin.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 ICDecoderEstimatorPlugin.cc
26  *
27  * Implementation of ICDecoderEstimatorPlugin class.
28  *
29  * @author Pekka Jääskeläinen 2005 (pjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
34 #include "ControlUnit.hh"
35 #include "FUPort.hh"
36 #include "SpecialRegisterPort.hh"
37 #include "HWOperation.hh"
38 #include "ExecutionPipeline.hh"
39 
40 namespace CostEstimator {
41 /**
42  * Constructor.
43  *
44  * @param name The name of the cost estimation plugin in the HDB.
45  * @param dataSource The HDB that stores the cost estimation data of
46  * the plugin. This reference can also be used to add new
47  * data, in case required by the algorithm.
48  */
50  const std::string& name) :
51  CostEstimationPlugin(name) {
52 }
53 
54 /**
55  * Destructor.
56  */
58 }
59 
60 /**
61  * Estimates the delay of the given path in the interconnection network.
62  *
63  * The estimated path starts from source socket and traverses through a bus
64  * to a target socket. The delay caused by reading and writing from ports are
65  * not included in this value. The default implementation returns false to
66  * signal that the estimation functionality is not implemented by the plugin.
67  *
68  * @param hdbRegistry The registry for accessing HDBs.
69  * @param path The path.
70  * @param machineImplementation The implementation of the machine.
71  * @param sourceSocketImplementation The implementation identification of
72  * the source socket.
73  * @param busImplementation The implementation identification of the bus.
74  * @param destinationSocketImplementation The implementation identification
75  * of the destination socket.
76  * @param delay The calculated delay should be stored in this argument.
77  * @return True in case the delay can be estimated, false if it cannot.
78  */
79 bool
82  const TransportPath&,
88 
89  return false;
90 }
91 
92 /**
93  * Estimates the area of the IC of the given machine.
94  *
95  * @param hdbRegistry The registry for accessing HDBs.
96  * @param machine Architecture of the machine.
97  * @param machineImplementation The implementation of the machine.
98  * @param area The calculated area should be stored in this argument.
99  * @return True in case the area can be estimated, false if it cannot.
100  */
101 bool
104  const TTAMachine::Machine&,
106  AreaInGates&) {
107 
108  return false;
109 }
110 
111 /**
112  * Estimates the energy consumed by the IC of the given machine by running
113  * the given program.
114  *
115  * @param hdbRegistry The registry for accessing HDBs.
116  * @param machine Architecture of the processor.
117  * @param machineImplementation Implementation defintions of the processor.
118  * @param traceDB The simulation trace database obtained from running the
119  * program.
120  * @param energy The calculated energy should be stored in this argument.
121  * @return True in case energy can be estimated, false if it cannot.
122  */
123 bool
126  const TTAMachine::Machine&,
128  const TTAProgram::Program&,
129  const ExecutionTrace&,
131 
132  return false;
133 }
134 
135 /**
136  * Generates a control unit.
137  *
138  * @return The control unit.
139  */
142 
143  const std::string RA_PORT_NAME = "ra";
144  const std::string OP_PORT_NAME = "pc";
145  const std::string OPNAME_JUMP = "jump";
146  const std::string OPNAME_CALL = "call";
147  const std::string COMP_DEFAULT_NAME_GCU = "gcu";
148 
149  // Add default ports.
151  COMP_DEFAULT_NAME_GCU, 3, 1);
152 
153  TTAMachine::FUPort* opPort =
154  new TTAMachine::FUPort(OP_PORT_NAME, 32, *gcu, true, true);
156  new TTAMachine::SpecialRegisterPort(RA_PORT_NAME, 32, *gcu);
157 
158  gcu->setReturnAddressPort(*raPort);
159 
160  // Add default operations.
161  TTAMachine::HWOperation* jump =
162  new TTAMachine::HWOperation(OPNAME_JUMP, *gcu);
163  jump->bindPort(1, *opPort);
164  jump->pipeline()->addPortRead(1, 0, 1);
165 
166  TTAMachine::HWOperation* call =
167  new TTAMachine::HWOperation(OPNAME_CALL, *gcu);
168  call->bindPort(1, *opPort);
169  call->pipeline()->addPortRead(1, 0, 1);
170 
171  return gcu;
172 }
173 
174 }
175 
IDF::UnitImplementationLocation
Definition: UnitImplementationLocation.hh:48
TTAProgram::Program
Definition: Program.hh:63
TTAMachine::HWOperation
Definition: HWOperation.hh:52
ExecutionPipeline.hh
TTAMachine::HWOperation::bindPort
virtual void bindPort(int operand, const FUPort &port)
Definition: HWOperation.cc:269
ICDecoderEstimatorPlugin.hh
CostEstimator::AreaInGates
double AreaInGates
type for area values in equivalent gates
Definition: CostEstimatorTypes.hh:35
CostEstimator::ICDecoderEstimatorPlugin::generateControlUnit
virtual TTAMachine::ControlUnit * generateControlUnit()
Definition: ICDecoderEstimatorPlugin.cc:141
CostEstimator::ICDecoderEstimatorPlugin::ICDecoderEstimatorPlugin
ICDecoderEstimatorPlugin(const std::string &name)
Definition: ICDecoderEstimatorPlugin.cc:49
CostEstimator::ICDecoderEstimatorPlugin::estimateICEnergy
virtual bool estimateICEnergy(HDB::HDBRegistry &hdbRegistry, const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation, const TTAProgram::Program &program, const ExecutionTrace &traceDB, EnergyInMilliJoules &energy)
Definition: ICDecoderEstimatorPlugin.cc:124
CostEstimator::EnergyInMilliJoules
double EnergyInMilliJoules
type for consumed energy in milli joules
Definition: CostEstimatorTypes.hh:37
TTAMachine::FUPort
Definition: FUPort.hh:46
HDB::HDBRegistry
Definition: HDBRegistry.hh:46
HWOperation.hh
TTAMachine::SpecialRegisterPort
Definition: SpecialRegisterPort.hh:48
TTAMachine::ControlUnit
Definition: ControlUnit.hh:50
ExecutionTrace
Definition: ExecutionTrace.hh:56
TTAMachine::ExecutionPipeline::addPortRead
void addPortRead(int operand, int start, int duration)
Definition: ExecutionPipeline.cc:141
CostEstimator::ICDecoderEstimatorPlugin::~ICDecoderEstimatorPlugin
virtual ~ICDecoderEstimatorPlugin()
Definition: ICDecoderEstimatorPlugin.cc:57
CostEstimator::CostEstimationPlugin
Definition: CostEstimationPlugin.hh:45
CostEstimator::DelayInNanoSeconds
double DelayInNanoSeconds
type for propagation delays in nano seconds
Definition: CostEstimatorTypes.hh:39
FUPort.hh
ControlUnit.hh
SpecialRegisterPort.hh
TTAMachine::ControlUnit::setReturnAddressPort
void setReturnAddressPort(const SpecialRegisterPort &port)
Definition: ControlUnit.cc:271
TTAMachine::HWOperation::pipeline
ExecutionPipeline * pipeline() const
Definition: HWOperation.cc:201
CostEstimator::TransportPath
Definition: TransportPath.hh:52
CostEstimator
Definition: CostEstimationPlugin.cc:36
CostEstimator::ICDecoderEstimatorPlugin::estimateICArea
virtual bool estimateICArea(HDB::HDBRegistry &hdbRegistry, const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation, AreaInGates &area)
Definition: ICDecoderEstimatorPlugin.cc:102
CostEstimator::ICDecoderEstimatorPlugin::estimateICDelayOfPath
virtual bool estimateICDelayOfPath(HDB::HDBRegistry &hdbRegistry, const TransportPath &path, const IDF::MachineImplementation &machineImplementation, const IDF::SocketImplementationLocation &sourceSocketImplementation, const IDF::BusImplementationLocation &busImplementation, const IDF::SocketImplementationLocation &destinationSocketImplementation, DelayInNanoSeconds &delay)
Definition: ICDecoderEstimatorPlugin.cc:80
IDF::MachineImplementation
Definition: MachineImplementation.hh:54
TTAMachine::Machine
Definition: Machine.hh:73