OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
IDF::UnitImplementationLocation Class Reference

#include <UnitImplementationLocation.hh>

Inheritance diagram for IDF::UnitImplementationLocation:
Inheritance graph
Collaboration diagram for IDF::UnitImplementationLocation:
Collaboration graph

Public Member Functions

 UnitImplementationLocation (const std::string &hdbFile, int id, const std::string &unitName)
 
 UnitImplementationLocation (const ObjectState *state)
 
virtual ~UnitImplementationLocation ()
 
virtual std::string hdbFile () const
 
std::string hdbFileOriginal () const
 
virtual int id () const
 
virtual std::string unitName () const
 
virtual void setParent (MachineImplementation &parent)
 
virtual void setID (int id)
 
virtual void setHDBFile (std::string file)
 
void loadState (const ObjectState *state)
 
ObjectStatesaveState () const
 
- Public Member Functions inherited from Serializable
virtual ~Serializable ()
 

Static Public Attributes

static const std::string OSNAME_UNIT_IMPLEMENTATION
 ObjectState name for unit implementation.
 
static const std::string OSKEY_HDB_FILE = "hdb_file"
 ObjectState attribute key for the name of the HDB file.
 
static const std::string OSKEY_ID = "id"
 ObjectState attribute key for the entry ID.
 
static const std::string OSKEY_UNIT_NAME = "unit_name"
 Objectstate attribute key for the name of the unit.
 

Private Attributes

std::string hdbFile_
 Name of the HDB file.
 
int id_
 Entry ID in the HDB.
 
std::string unitName_
 Name of the unit in ADF.
 
MachineImplementationparent_
 The parent MachineImplementation instance.
 

Detailed Description

Indicates what implementation of a unit is used.

Refers to an entry in an HDB.

Definition at line 48 of file UnitImplementationLocation.hh.

Constructor & Destructor Documentation

◆ UnitImplementationLocation() [1/2]

IDF::UnitImplementationLocation::UnitImplementationLocation ( const std::string &  hdbFile,
int  id,
const std::string &  unitName 
)

The constructor.

Parameters
hdbFileThe database that contains the implementation.
idID of the RF or FU entry in the database.
unitNameName of the corresponding unit in ADF.

Definition at line 60 of file UnitImplementationLocation.cc.

63 :
65}
std::string hdbFile_
Name of the HDB file.
MachineImplementation * parent_
The parent MachineImplementation instance.
std::string unitName_
Name of the unit in ADF.

◆ UnitImplementationLocation() [2/2]

IDF::UnitImplementationLocation::UnitImplementationLocation ( const ObjectState state)

The constructor.

Loads the state of the object from the given ObjectState instance.

Parameters
stateThe ObjectState instance.
Exceptions
ObjectStateLoadingExceptionIf the given ObjectState instance is invalid.

this is used by NullFUImplementationLocation

Definition at line 77 of file UnitImplementationLocation.cc.

78 : hdbFile_(""), id_(0), unitName_(""), parent_(NULL) {
79 /// this is used by NullFUImplementationLocation
80 if (state == NULL)
81 return;
82 loadState(state);
83}
void loadState(const ObjectState *state)

References loadState().

Here is the call graph for this function:

◆ ~UnitImplementationLocation()

IDF::UnitImplementationLocation::~UnitImplementationLocation ( )
virtual

The destructor.

Definition at line 88 of file UnitImplementationLocation.cc.

88 {
89}

Member Function Documentation

◆ hdbFile()

std::string IDF::UnitImplementationLocation::hdbFile ( ) const
virtual

Returns the absolute path to the HDB file.

Returns
Absolute path to the HDB file.
Exceptions
FileNotFoundIf the HDB file is not found in the search paths.

Reimplemented in IDF::NullUnitImplementationLocation.

Definition at line 99 of file UnitImplementationLocation.cc.

99 {
100 vector<string> paths = Environment::hdbPaths();
101 if (parent_) {
102 paths.insert(
104 }
105 TCEString expandedPath(hdbFile_);
106 expandedPath.replaceString("tce:", "");
107 expandedPath = FileSystem::expandTilde(expandedPath);
108 return FileSystem::findFileInSearchPaths(paths, expandedPath);
109}
static std::vector< std::string > hdbPaths(bool libraryPathsOnly=false)
static std::string directoryOfPath(const std::string fileName)
Definition FileSystem.cc:79
static std::string findFileInSearchPaths(const std::vector< std::string > &searchPaths, const std::string &file)
static std::string expandTilde(const std::string &stringWithTilde)

References FileSystem::directoryOfPath(), FileSystem::expandTilde(), FileSystem::findFileInSearchPaths(), hdbFile_, Environment::hdbPaths(), parent_, TCEString::replaceString(), and IDF::MachineImplementation::sourceIDF().

Referenced by ProGe::NetlistGenerator::addBaseRFToNetlist(), ProGe::NetlistGenerator::addFUToNetlist(), ProGe::ProcessorGenerator::checkIULatencies(), ProGe::BlockSourceCopier::copyShared(), CostEstimator::Estimator::fuCostFunctionPluginOfImplementation(), CostEstimator::Estimator::functionUnitArea(), CostEstimator::Estimator::functionUnitEnergy(), CostEstimator::Estimator::functionUnitMaximumComputationDelay(), CostEstimator::Estimator::functionUnitPortReadDelay(), CostEstimator::Estimator::functionUnitPortWriteDelay(), ProGeTestBenchGenerator::generate(), ProGe::ProGeUI::generateIDF(), ProGeScriptGenerator::getBlockOrder(), PlatformIntegrator::loadFUExternalPorts(), IDF::MachineImplementation::makeHDBPathRelative(), CostEstimator::Estimator::registerFileArea(), CostEstimator::Estimator::registerFileEnergy(), CostEstimator::Estimator::registerFileMaximumComputationDelay(), CostEstimator::Estimator::registerFilePortReadDelay(), CostEstimator::Estimator::registerFilePortWriteDelay(), CostEstimator::Estimator::rfCostFunctionPluginOfImplementation(), testUnits(), ProcessorImplementationWindow::updateFUList(), ProcessorImplementationWindow::updateImplementationLists(), and ProcessorImplementationWindow::updateRFList().

Here is the call graph for this function:

◆ hdbFileOriginal()

std::string IDF::UnitImplementationLocation::hdbFileOriginal ( ) const

Returns the path to the file, which was defined in IDF.

Returns
Path to the HDB in IDF file.

Definition at line 117 of file UnitImplementationLocation.cc.

117 {
118 return hdbFile_;
119}

References hdbFile_.

Referenced by IDF::MachineImplementation::checkImplFiles().

◆ id()

int IDF::UnitImplementationLocation::id ( ) const
virtual

◆ loadState()

void IDF::UnitImplementationLocation::loadState ( const ObjectState state)
virtual

Loads the state of the object from the given ObjectState instance.

Exceptions
ObjectStateLoadingExceptionIf the given ObjectState instance.

Implements Serializable.

Definition at line 164 of file UnitImplementationLocation.cc.

164 {
165 const string procName = "UnitImplementationLocation::loadState";
166
167 if (state->name() != OSNAME_UNIT_IMPLEMENTATION) {
168 throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
169 }
170
171 try {
173 id_ = state->intAttribute(OSKEY_ID);
175 } catch (const Exception& exception) {
177 __FILE__, __LINE__, procName, exception.errorMessage());
178 }
179}
std::string errorMessage() const
Definition Exception.cc:123
static const std::string OSNAME_UNIT_IMPLEMENTATION
ObjectState name for unit implementation.
static const std::string OSKEY_ID
ObjectState attribute key for the entry ID.
static const std::string OSKEY_UNIT_NAME
Objectstate attribute key for the name of the unit.
static const std::string OSKEY_HDB_FILE
ObjectState attribute key for the name of the HDB file.
std::string stringAttribute(const std::string &name) const
int intAttribute(const std::string &name) const
std::string name() const

References Exception::errorMessage(), hdbFile_, id_, ObjectState::intAttribute(), ObjectState::name(), OSKEY_HDB_FILE, OSKEY_ID, OSKEY_UNIT_NAME, OSNAME_UNIT_IMPLEMENTATION, ObjectState::stringAttribute(), and unitName_.

Referenced by UnitImplementationLocation().

Here is the call graph for this function:

◆ saveState()

ObjectState * IDF::UnitImplementationLocation::saveState ( ) const
virtual

Saves the state of the object to an ObjectState instance.

Returns
The newly created ObjectState instance.

Implements Serializable.

Definition at line 187 of file UnitImplementationLocation.cc.

187 {
190 state->setAttribute(OSKEY_ID, id());
192 return state;
193}
void setAttribute(const std::string &name, const std::string &value)

References hdbFile_, OSKEY_HDB_FILE, OSKEY_ID, OSKEY_UNIT_NAME, OSNAME_UNIT_IMPLEMENTATION, ObjectState::setAttribute(), and unitName().

Referenced by IDF::MachineImplementation::saveState(), ComponentImplementationSelector::selectFUs(), ComponentImplementationSelector::selectIUs(), and ComponentImplementationSelector::selectRFs().

Here is the call graph for this function:

◆ setHDBFile()

void IDF::UnitImplementationLocation::setHDBFile ( std::string  file)
virtual

◆ setID()

void IDF::UnitImplementationLocation::setID ( int  id)
virtual

◆ setParent()

void IDF::UnitImplementationLocation::setParent ( MachineImplementation parent)
virtual

Sets the parent of the object.

Parameters
parentThe parent MachineImplementation instance.
Exceptions
InvalidDataIf the parent is already set.

Reimplemented in IDF::NullUnitImplementationLocation.

Definition at line 150 of file UnitImplementationLocation.cc.

150 {
151 if (parent_ != NULL) {
152 throw InvalidData(__FILE__, __LINE__, __func__);
153 }
154
155 parent_ = &parent;
156}
#define __func__

References __func__, and parent_.

◆ unitName()

std::string IDF::UnitImplementationLocation::unitName ( ) const
virtual

Member Data Documentation

◆ hdbFile_

std::string IDF::UnitImplementationLocation::hdbFile_
private

Name of the HDB file.

Definition at line 81 of file UnitImplementationLocation.hh.

Referenced by hdbFile(), hdbFileOriginal(), loadState(), saveState(), and setHDBFile().

◆ id_

int IDF::UnitImplementationLocation::id_
private

Entry ID in the HDB.

Definition at line 83 of file UnitImplementationLocation.hh.

Referenced by id(), loadState(), and setID().

◆ OSKEY_HDB_FILE

const string IDF::UnitImplementationLocation::OSKEY_HDB_FILE = "hdb_file"
static

ObjectState attribute key for the name of the HDB file.

Definition at line 73 of file UnitImplementationLocation.hh.

Referenced by IDF::IDFSerializer::convertToFileFormat(), IDF::IDFSerializer::convertToOMFormat(), loadState(), and saveState().

◆ OSKEY_ID

const string IDF::UnitImplementationLocation::OSKEY_ID = "id"
static

◆ OSKEY_UNIT_NAME

const string IDF::UnitImplementationLocation::OSKEY_UNIT_NAME = "unit_name"
static

Objectstate attribute key for the name of the unit.

Definition at line 77 of file UnitImplementationLocation.hh.

Referenced by IDF::IDFSerializer::convertToFileFormat(), IDF::IDFSerializer::convertToOMFormat(), loadState(), and saveState().

◆ OSNAME_UNIT_IMPLEMENTATION

const string IDF::UnitImplementationLocation::OSNAME_UNIT_IMPLEMENTATION
static
Initial value:
=
"unit_implementation"

ObjectState name for unit implementation.

Definition at line 71 of file UnitImplementationLocation.hh.

Referenced by IDF::IDFSerializer::convertToOMFormat(), loadState(), and saveState().

◆ parent_

MachineImplementation* IDF::UnitImplementationLocation::parent_
private

The parent MachineImplementation instance.

Definition at line 87 of file UnitImplementationLocation.hh.

Referenced by hdbFile(), and setParent().

◆ unitName_

std::string IDF::UnitImplementationLocation::unitName_
private

Name of the unit in ADF.

Definition at line 85 of file UnitImplementationLocation.hh.

Referenced by loadState(), and unitName().


The documentation for this class was generated from the following files: