OpenASIP 2.2
Loading...
Searching...
No Matches
MachineImplementation.hh
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 MachineImplementation.hh
26 *
27 * Declaration of MachineImplementation class.
28 *
29 * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#ifndef TTA_MACHINE_IMPLEMENTATION_HH
34#define TTA_MACHINE_IMPLEMENTATION_HH
35
36#include <string>
37#include <vector>
38#include "Serializable.hh"
43#include "FUGenerated.hh"
44
45
46
47namespace IDF {
48
49class UnitImplementationLocation;
50
51/**
52 * Represents the implementation of a machine defined in an IDF.
53 */
55public:
57
59
60 virtual ~MachineImplementation();
61
62 std::string sourceIDF() const;
63
64 std::string icDecoderPluginName() const;
65 bool hasICDecoderPluginName() const;
66 std::string icDecoderPluginFile() const;
67
68 bool hasICDecoderPluginFile() const;
69 std::string icDecoderHDB() const;
70 bool hasICDecoderHDB() const;
71 std::string decompressorFile() const;
72 bool hasDecompressorFile() const;
73
74 void setICDecoderPluginName(const std::string& name);
75 void setICDecoderPluginFile(const std::string& file);
76 void setICDecoderHDB(const std::string& file);
77 void setDecompressorFile(const std::string& file);
78
79 unsigned icDecoderParameterCount() const;
80 std::string icDecoderParameterName(unsigned param) const;
81 std::string icDecoderParameterValue(const std::string& name) const;
82 std::string icDecoderParameterValue(unsigned param) const;
85 const std::string& name, const std::string& value);
86
87 bool hasFUImplementation(const std::string& unitName) const;
88 bool hasRFImplementation(const std::string& unitName) const;
89 bool hasIUImplementation(const std::string& unitName) const;
90 bool hasBusImplementation(const std::string& busName) const;
91 bool hasSocketImplementation(const std::string& socketName) const;
92
93 int fuImplementationCount() const;
94 int rfImplementationCount() const;
95 int iuImplementationCount() const;
96 int busImplementationCount() const;
97 int socketImplementationCount() const;
98
99 FUImplementationLocation& fuImplementation(const std::string& fu) const;
100 RFImplementationLocation& rfImplementation(const std::string& rf) const;
101 RFImplementationLocation& iuImplementation(const std::string& iu) const;
102 BusImplementationLocation& busImplementation(const std::string& bus) const;
104 const std::string& socket) const;
105
111
117
118 void removeFUImplementation(const std::string& unitName);
119 void removeRFImplementation(const std::string& unitName);
120 void removeIUImplementation(const std::string& unitName);
121 void removeBusImplementation(const std::string& unitName);
122 void removeSocketImplementation(const std::string& unitName);
123
124 // methods from Serializable interface
125 virtual void loadState(const ObjectState* state);
126 virtual ObjectState* saveState() const;
127
128 static MachineImplementation* loadFromIDF(const std::string& idfFileName);
129
130 void makeImplFilesRelative(const std::vector<std::string>& sPaths);
131 bool checkImplFiles(
132 size_t& missingFiles,
133 size_t& alternativeFiles);
135 const std::string& path,
136 std::string& resolvedPath);
137
138 /// ObjectState name for machine implementation.
139 static const std::string OSNAME_MACHINE_IMPLEMENTATION;
140 /// ObjectState attribute name for the source IDF.
141 static const std::string OSKEY_SOURCE_IDF;
142 /// ObjectState name for the name of the IC/decoder plugin file.
143 static const std::string OSNAME_IC_DECODER_PLUGIN;
144 /// ObjectState attribute name for ic&decoder name.
145 static const std::string OSKEY_IC_DECODER_NAME;
146 /// ObjectState attribute name for ic&decoder file.
147 static const std::string OSKEY_IC_DECODER_FILE;
148 /// ObjectState attribute name for ic&decoder parameter.
149 static const std::string OSNAME_IC_DECODER_PARAMETER;
150 /// ObjectState attribute name for ic&decoder parameter name.
151 static const std::string OSKEY_IC_DECODER_PARAMETER_NAME;
152 /// ObjectState attribute name for ic&decoder parameter value.
153 static const std::string OSKEY_IC_DECODER_PARAMETER_VALUE;
154 /// ObjectState attribute name for ic&decoder HDB.
155 static const std::string OSKEY_IC_DECODER_HDB;
156 /// ObjectState attribute key for the name of the decompressor file.
157 static const std::string OSKEY_DECOMPRESSOR_FILE;
158 /// ObjectState name for FU generations container.
159 static const std::string OSNAME_FU_GENERATED;
160 /// ObjectState name for FU implementation container.
161 static const std::string OSNAME_FU_IMPLEMENTATIONS;
162 /// ObjectState name for RF implementation container.
163 static const std::string OSNAME_RF_IMPLEMENTATIONS;
164 /// ObjectState name for IU implementation container.
165 static const std::string OSNAME_IU_IMPLEMENTATIONS;
166 /// ObjectState name for bus implementation container.
167 static const std::string OSNAME_BUS_IMPLEMENTATIONS;
168 /// ObjectState name for socket implementation container.
169 static const std::string OSNAME_SOCKET_IMPLEMENTATIONS;
170
171 const std::vector<FUGenerated>& FUGenerations() const;
172 std::vector<FUGenerated>& FUGenerations();
173 bool hasFUGeneration(const std::string& name) const;
174 void removeFuGeneration(const std::string& name);
175 void addFuGeneration(const FUGenerated& fug);
176
177private:
178 /// Vector type for UnitImplementationLocation.
179 typedef std::vector<UnitImplementationLocation*> ImplementationTable;
180
181 /// IC/Decoder parameter struct.
182 struct Parameter {
183 std::string name;
184 std::string value;
185 };
186
187 bool checkImplFile(
188 const std::vector<std::string>& primarySearchPaths,
189 const std::vector<std::string>& secondarySearchPaths,
190 std::string& file);
193 const std::vector<std::string>& searchPaths,
194 UnitImplementationLocation& implem) const;
196 const ImplementationTable& table,
197 const std::string& unitName) const;
198 void ensureIndexValidity(int index, const ImplementationTable& table) const;
199 void clearState();
200
201 /// Generated FUs.
202 std::vector<FUGenerated> fuGenerated_;
203
204 /// FU implementations.
206 /// RF implementations.
208 /// IU implementations.
210 /// BUS implementations.
212 /// SOCKET implementations.
214
215 /// Name of the IC/decoder plugin.
217 /// Name of the IC/decoder plugin file.
219 /// Name of the HDB of the IC/decoder plugin.
220 std::string icDecoderHDB_;
221 /// Name of the decompressor block file.
222 std::string decompressorFile_;
223 /// Absolute path to the source IDF file.
224 std::string sourceIDF_;
225 /// IC/decoder plugin parameters.
226 std::vector<Parameter> icDecoderParameters_;
227
228 /// Implementation files defined in IDF which cannot be located.
229 std::vector<std::string> missingFiles_;
230 /// Possible alternative file paths for missing implementation files.
231 std::vector<std::string> alternativeFiles_;
232
233};
234}
235
236#endif
237
238
IDF::MachineImplementation * implementation
the implementation definition of the estimated processor
BusImplementationLocation & busImplementation(const std::string &bus) const
std::vector< std::string > missingFiles_
Implementation files defined in IDF which cannot be located.
ImplementationTable iuImplementations_
IU implementations.
void removeFuGeneration(const std::string &name)
void addSocketImplementation(SocketImplementationLocation *implementation)
std::string icDecoderPluginName() const
void setICDecoderParameter(const std::string &name, const std::string &value)
void removeFUImplementation(const std::string &unitName)
static const std::string OSKEY_DECOMPRESSOR_FILE
ObjectState attribute key for the name of the decompressor file.
void addBusImplementation(BusImplementationLocation *implementation)
void setICDecoderHDB(const std::string &file)
void setICDecoderPluginFile(const std::string &file)
static const std::string OSNAME_IC_DECODER_PLUGIN
ObjectState name for the name of the IC/decoder plugin file.
void addIUImplementation(RFImplementationLocation *implementation)
static const std::string OSKEY_IC_DECODER_HDB
ObjectState attribute name for ic&decoder HDB.
void addRFImplementation(RFImplementationLocation *implementation)
SocketImplementationLocation & socketImplementation(const std::string &socket) const
std::vector< Parameter > icDecoderParameters_
IC/decoder plugin parameters.
RFImplementationLocation & iuImplementation(const std::string &iu) const
static const std::string OSKEY_SOURCE_IDF
ObjectState attribute name for the source IDF.
ImplementationTable socketImplementations_
SOCKET implementations.
RFImplementationLocation & rfImplementation(const std::string &rf) const
UnitImplementationLocation * findImplementation(const ImplementationTable &table, const std::string &unitName) const
ImplementationTable busImplementations_
BUS implementations.
static const std::string OSNAME_IU_IMPLEMENTATIONS
ObjectState name for IU implementation container.
std::string decompressorFile_
Name of the decompressor block file.
bool checkImplFiles(size_t &missingFiles, size_t &alternativeFiles)
std::string icDecoderPluginName_
Name of the IC/decoder plugin.
std::string icDecoderPluginFile_
Name of the IC/decoder plugin file.
bool hasIUImplementation(const std::string &unitName) const
void makeImplFilesRelative(const std::vector< std::string > &sPaths)
FUImplementationLocation & fuImplementation(const std::string &fu) const
std::string sourceIDF_
Absolute path to the source IDF file.
static const std::string OSKEY_IC_DECODER_NAME
ObjectState attribute name for ic&decoder name.
virtual void loadState(const ObjectState *state)
void removeIUImplementation(const std::string &unitName)
void setDecompressorFile(const std::string &file)
bool hasFUGeneration(const std::string &name) const
static const std::string OSNAME_MACHINE_IMPLEMENTATION
ObjectState name for machine implementation.
ImplementationTable fuImplementations_
FU implementations.
ImplementationTable rfImplementations_
RF implementations.
void makeHDBPathRelative(const std::vector< std::string > &searchPaths, UnitImplementationLocation &implem) const
std::string icDecoderPluginFile() const
static const std::string OSNAME_BUS_IMPLEMENTATIONS
ObjectState name for bus implementation container.
bool hasRFImplementation(const std::string &unitName) const
std::string icDecoderHDB_
Name of the HDB of the IC/decoder plugin.
std::vector< UnitImplementationLocation * > ImplementationTable
Vector type for UnitImplementationLocation.
std::string icDecoderParameterValue(const std::string &name) const
static MachineImplementation * loadFromIDF(const std::string &idfFileName)
std::vector< FUGenerated > fuGenerated_
Generated FUs.
std::string icDecoderParameterName(unsigned param) const
bool checkImplFile(const std::vector< std::string > &primarySearchPaths, const std::vector< std::string > &secondarySearchPaths, std::string &file)
static const std::string OSNAME_FU_GENERATED
ObjectState name for FU generations container.
void ensureIndexValidity(int index, const ImplementationTable &table) const
const std::vector< FUGenerated > & FUGenerations() const
void removeRFImplementation(const std::string &unitName)
static const std::string OSKEY_IC_DECODER_FILE
ObjectState attribute name for ic&decoder file.
void addFUImplementation(FUImplementationLocation *implementation)
virtual ObjectState * saveState() const
void removeSocketImplementation(const std::string &unitName)
static const std::string OSNAME_IC_DECODER_PARAMETER
ObjectState attribute name for ic&decoder parameter.
bool hasBusImplementation(const std::string &busName) const
void removeBusImplementation(const std::string &unitName)
static const std::string OSNAME_SOCKET_IMPLEMENTATIONS
ObjectState name for socket implementation container.
static const std::string OSKEY_IC_DECODER_PARAMETER_NAME
ObjectState attribute name for ic&decoder parameter name.
bool hasSocketImplementation(const std::string &socketName) const
static const std::string OSNAME_RF_IMPLEMENTATIONS
ObjectState name for RF implementation container.
std::vector< std::string > alternativeFiles_
Possible alternative file paths for missing implementation files.
void setICDecoderPluginName(const std::string &name)
static const std::string OSNAME_FU_IMPLEMENTATIONS
ObjectState name for FU implementation container.
static const std::string OSKEY_IC_DECODER_PARAMETER_VALUE
ObjectState attribute name for ic&decoder parameter value.
bool hasFUImplementation(const std::string &unitName) const
void addFuGeneration(const FUGenerated &fug)