OpenASIP  2.0
Classes | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
BlocksModel Class Reference

#include <BlocksModel.hh>

Collaboration diagram for BlocksModel:
Collaboration graph

Classes

struct  FunctionalUnit
 

Public Member Functions

 BlocksModel (std::string filename)
 

Public Attributes

std::list< FunctionalUnitmFunctionalUnitList
 

Private Member Functions

void LoadModelFromXml ()
 
bool VerifyXmlStructure ()
 

Private Attributes

const std::map< std::string, BlocksTranslator::FU_TYPEstringToEnum
 
ObjectStatemdfState_
 

Detailed Description

Definition at line 55 of file BlocksModel.hh.

Constructor & Destructor Documentation

◆ BlocksModel()

BlocksModel::BlocksModel ( std::string  filename)
inline

Definition at line 82 of file BlocksModel.hh.

82  {
83  XMLSerializer* serializer = new XMLSerializer();
84  serializer->setSourceFile(filename);
85  mdfState_ = serializer->readState();
87  };

References LoadModelFromXml(), mdfState_, XMLSerializer::readState(), and XMLSerializer::setSourceFile().

Here is the call graph for this function:

Member Function Documentation

◆ LoadModelFromXml()

void BlocksModel::LoadModelFromXml ( )
private

Load and parse the Blocks 'architecture.xml'.

Definition at line 44 of file BlocksModel.cc.

44  {
45  // TODO(mm): add check for configuration bits
46  if (!VerifyXmlStructure()) return;
47 
48  ObjectState* configs = mdfState_->childByName("configuration");
49  ObjectState* fuState = configs->childByName("functionalunits");
50 
51  for (int i = 0; i < fuState->childCount(); i++) {
52  ObjectState* fu = fuState->child(i);
53  FunctionalUnit unit = {};
54  unit.usesOut0 = false;
55  unit.usesOut1 = false;
56  string unitTypeString = fu->stringAttribute("type");
57  unit.type = stringToEnum.at(unitTypeString);
58  unit.name = fu->stringAttribute("name");
59 
60  // FU ports
61  for (int srcnum = 0; srcnum < fu->childCount(); srcnum++) {
62  ObjectState* srcPort = fu->child(srcnum);
63  unit.src.push_back(srcPort->stringAttribute("source"));
64  }
65 
66  mFunctionalUnitList.push_back(unit); // Add functional unit to list
67  }
68 }

References ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), BlocksModel::FunctionalUnit::name, BlocksModel::FunctionalUnit::src, ObjectState::stringAttribute(), BlocksModel::FunctionalUnit::type, BlocksModel::FunctionalUnit::usesOut0, and BlocksModel::FunctionalUnit::usesOut1.

Referenced by BlocksModel().

Here is the call graph for this function:

◆ VerifyXmlStructure()

bool BlocksModel::VerifyXmlStructure ( )
private

Verify the structure of the 'architecture.xml' file.

Definition at line 74 of file BlocksModel.cc.

74  {
75  return mdfState_->hasChild("configuration") &&
76  mdfState_->hasChild("Core");
77 }

Member Data Documentation

◆ mdfState_

ObjectState* BlocksModel::mdfState_
private

Definition at line 78 of file BlocksModel.hh.

Referenced by BlocksModel().

◆ mFunctionalUnitList

std::list<FunctionalUnit> BlocksModel::mFunctionalUnitList

Definition at line 87 of file BlocksModel.hh.

Referenced by BlocksTranslator::BuildTTAModel().

◆ stringToEnum

const std::map<std::string, BlocksTranslator::FU_TYPE> BlocksModel::stringToEnum
private

The documentation for this class was generated from the following files:
BlocksTranslator::FU_TYPE::ABU
@ ABU
ObjectState::stringAttribute
std::string stringAttribute(const std::string &name) const
Definition: ObjectState.cc:249
XMLSerializer::setSourceFile
void setSourceFile(const std::string &fileName)
Definition: XMLSerializer.cc:115
BlocksModel::VerifyXmlStructure
bool VerifyXmlStructure()
Definition: BlocksModel.cc:74
BlocksTranslator::FU_TYPE::RF
@ RF
BlocksTranslator::FU_TYPE::ID
@ ID
ObjectState
Definition: ObjectState.hh:59
BlocksModel::stringToEnum
const std::map< std::string, BlocksTranslator::FU_TYPE > stringToEnum
Definition: BlocksModel.hh:60
ObjectState::childByName
ObjectState * childByName(const std::string &name) const
Definition: ObjectState.cc:443
BlocksTranslator::FU_TYPE::LSU
@ LSU
BlocksTranslator::FU_TYPE::IU
@ IU
BlocksModel::mdfState_
ObjectState * mdfState_
Definition: BlocksModel.hh:78
XMLSerializer::readState
virtual ObjectState * readState()
Definition: XMLSerializer.cc:200
ObjectState::child
ObjectState * child(int index) const
Definition: ObjectState.cc:471
ObjectState::childCount
int childCount() const
ObjectState::hasChild
bool hasChild(const std::string &name) const
Definition: ObjectState.cc:358
BlocksTranslator::FU_TYPE::MUL
@ MUL
BlocksTranslator::FU_TYPE::ALU
@ ALU
BlocksModel::mFunctionalUnitList
std::list< FunctionalUnit > mFunctionalUnitList
Definition: BlocksModel.hh:87
BlocksModel::LoadModelFromXml
void LoadModelFromXml()
Definition: BlocksModel.cc:44
XMLSerializer
Definition: XMLSerializer.hh:62