OpenASIP 2.2
Loading...
Searching...
No Matches
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 };
void LoadModelFromXml()
ObjectState * mdfState_
void setSourceFile(const std::string &fileName)
virtual ObjectState * readState()

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}
bool VerifyXmlStructure()
std::list< FunctionalUnit > mFunctionalUnitList
const std::map< std::string, BlocksTranslator::FU_TYPE > stringToEnum
ObjectState * childByName(const std::string &name) const
ObjectState * child(int index) const
std::string stringAttribute(const std::string &name) const
int childCount() const

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

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}
bool hasChild(const std::string &name) const

References ObjectState::hasChild(), and mdfState_.

Referenced by LoadModelFromXml().

Here is the call graph for this function:

Member Data Documentation

◆ mdfState_

ObjectState* BlocksModel::mdfState_
private

Definition at line 78 of file BlocksModel.hh.

Referenced by BlocksModel(), LoadModelFromXml(), and VerifyXmlStructure().

◆ mFunctionalUnitList

std::list<FunctionalUnit> BlocksModel::mFunctionalUnitList

Definition at line 88 of file BlocksModel.hh.

Referenced by BlocksTranslator::BuildTTAModel(), and LoadModelFromXml().

◆ stringToEnum

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

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