OpenASIP  2.0
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. More...
 
static const std::string OSKEY_HDB_FILE = "hdb_file"
 ObjectState attribute key for the name of the HDB file. More...
 
static const std::string OSKEY_ID = "id"
 ObjectState attribute key for the entry ID. More...
 
static const std::string OSKEY_UNIT_NAME = "unit_name"
 Objectstate attribute key for the name of the unit. More...
 

Private Attributes

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

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  :
64  hdbFile_(hdbFile), id_(id), unitName_(unitName), parent_(NULL) {
65 }

◆ 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 }

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(
103  paths.begin(), FileSystem::directoryOfPath(parent_->sourceIDF()));
104  }
105  TCEString expandedPath(hdbFile_);
106  expandedPath.replaceString("tce:", "");
107  expandedPath = FileSystem::expandTilde(expandedPath);
108  return FileSystem::findFileInSearchPaths(paths, expandedPath);
109 }

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 }

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 }

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 }

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:
IDF::UnitImplementationLocation::id_
int id_
Entry ID in the HDB.
Definition: UnitImplementationLocation.hh:83
IDF::UnitImplementationLocation::unitName_
std::string unitName_
Name of the unit in ADF.
Definition: UnitImplementationLocation.hh:85
IDF::UnitImplementationLocation::OSKEY_HDB_FILE
static const std::string OSKEY_HDB_FILE
ObjectState attribute key for the name of the HDB file.
Definition: UnitImplementationLocation.hh:73
ObjectState::stringAttribute
std::string stringAttribute(const std::string &name) const
Definition: ObjectState.cc:249
ObjectStateLoadingException
Definition: Exception.hh:551
ObjectState
Definition: ObjectState.hh:59
IDF::UnitImplementationLocation::loadState
void loadState(const ObjectState *state)
Definition: UnitImplementationLocation.cc:164
IDF::UnitImplementationLocation::OSKEY_ID
static const std::string OSKEY_ID
ObjectState attribute key for the entry ID.
Definition: UnitImplementationLocation.hh:75
InvalidData
Definition: Exception.hh:149
Environment::hdbPaths
static std::vector< std::string > hdbPaths(bool libraryPathsOnly=false)
Definition: Environment.cc:683
__func__
#define __func__
Definition: Application.hh:67
FileSystem::directoryOfPath
static std::string directoryOfPath(const std::string fileName)
Definition: FileSystem.cc:79
Exception
Definition: Exception.hh:54
IDF::MachineImplementation::sourceIDF
std::string sourceIDF() const
Definition: MachineImplementation.cc:121
IDF::UnitImplementationLocation::unitName
virtual std::string unitName() const
Definition: UnitImplementationLocation.cc:138
FileSystem::expandTilde
static std::string expandTilde(const std::string &stringWithTilde)
Definition: FileSystem.cc:217
ObjectState::name
std::string name() const
IDF::UnitImplementationLocation::OSKEY_UNIT_NAME
static const std::string OSKEY_UNIT_NAME
Objectstate attribute key for the name of the unit.
Definition: UnitImplementationLocation.hh:77
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
IDF::UnitImplementationLocation::hdbFile_
std::string hdbFile_
Name of the HDB file.
Definition: UnitImplementationLocation.hh:81
IDF::UnitImplementationLocation::parent_
MachineImplementation * parent_
The parent MachineImplementation instance.
Definition: UnitImplementationLocation.hh:87
IDF::UnitImplementationLocation::id
virtual int id() const
Definition: UnitImplementationLocation.cc:127
TCEString
Definition: TCEString.hh:53
ObjectState::intAttribute
int intAttribute(const std::string &name) const
Definition: ObjectState.cc:276
IDF::UnitImplementationLocation::hdbFile
virtual std::string hdbFile() const
Definition: UnitImplementationLocation.cc:99
IDF::UnitImplementationLocation::OSNAME_UNIT_IMPLEMENTATION
static const std::string OSNAME_UNIT_IMPLEMENTATION
ObjectState name for unit implementation.
Definition: UnitImplementationLocation.hh:71
FileSystem::findFileInSearchPaths
static std::string findFileInSearchPaths(const std::vector< std::string > &searchPaths, const std::string &file)
Definition: FileSystem.cc:562
ObjectState::setAttribute
void setAttribute(const std::string &name, const std::string &value)
Definition: ObjectState.cc:100