OpenASIP 2.2
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
HDB::RFImplementation Class Reference

#include <RFImplementation.hh>

Inheritance diagram for HDB::RFImplementation:
Inheritance graph
Collaboration diagram for HDB::RFImplementation:
Collaboration graph

Public Types

typedef HDB::Parameter Parameter
 Parameter of FU implementation.
 

Public Member Functions

 RFImplementation (const std::string &moduleName, const std::string &clkPort, const std::string &rstPort, const std::string &glockPort, const std::string &sizeParam, const std::string &widthParam, const std::string &guardPort, bool sacParam=false)
 
virtual ~RFImplementation ()
 
 RFImplementation (const RFImplementation &o)
 
void setSizeParameter (const std::string &sizeParam)
 
std::string sizeParameter () const
 
void setWidthParameter (const std::string &widthParam)
 
std::string widthParameter () const
 
void setGuardPort (const std::string &guardPort)
 
std::string guardPort () const
 
void setSeparateAddressCycleParameter (bool enable)
 
bool separateAddressCycleParameter () const
 
void addPort (RFPortImplementation *port)
 
void addExternalPort (RFExternalPort *extPort)
 
void deletePort (RFPortImplementation *port)
 
void deleteExternalPort (RFExternalPort *port)
 
int portCount () const
 
int externalPortCount () const
 
RFPortImplementationport (int index) const
 
RFExternalPortexternalPort (int index) const
 
void addParameter (const std::string &name, const std::string &type, const std::string &value)
 
void removeParameter (const std::string &name)
 
int parameterCount () const
 
Parameter parameter (int index) const
 
bool hasParameter (const std::string &name) const
 
- Public Member Functions inherited from HDB::HWBlockImplementation
 HWBlockImplementation (const std::string &moduleName, const std::string &clkPort, const std::string &rstPort, const std::string &glockPort)
 
 HWBlockImplementation (const HWBlockImplementation &b)
 
virtual ~HWBlockImplementation ()
 
bool hasID () const
 
void setID (RowID id)
 
RowID id () const
 
void setModuleName (const std::string &name)
 
std::string moduleName () const
 
void setClkPort (const std::string &name)
 
std::string clkPort () const
 
void setRstPort (const std::string &name)
 
std::string rstPort () const
 
void setGlockPort (const std::string &name)
 
std::string glockPort () const
 
void addImplementationFile (BlockImplementationFile *file)
 
void removeImplementationFile (const BlockImplementationFile &file)
 
int implementationFileCount () const
 
BlockImplementationFilefile (int index) const
 

Private Types

typedef std::vector< RFPortImplementation * > PortTable
 Vector type for RFPortImplementation.
 
typedef std::vector< RFExternalPort * > ExternalPortTable
 Vector type for FUExternalPort.
 
typedef std::vector< ParameterParameterTable
 Vector type for parameter names.
 

Private Attributes

std::string sizeParam_
 Name of the size parameter.
 
std::string widthParam_
 Name of the width parameter.
 
std::string guardPort_
 Name of the guard port.
 
bool sepAddrCycleParam_
 State of separate address cycle parameter.
 
PortTable ports_
 Contains the ports.
 
ExternalPortTable externalPorts_
 Contains the external ports.
 
ParameterTable parameters_
 Contains the parameters.
 

Detailed Description

Repsesents an implementation of a RF in HDB.

Definition at line 50 of file RFImplementation.hh.

Member Typedef Documentation

◆ ExternalPortTable

Vector type for FUExternalPort.

Definition at line 101 of file RFImplementation.hh.

◆ Parameter

Parameter of FU implementation.

Definition at line 53 of file RFImplementation.hh.

◆ ParameterTable

typedef std::vector<Parameter> HDB::RFImplementation::ParameterTable
private

Vector type for parameter names.

Definition at line 103 of file RFImplementation.hh.

◆ PortTable

Vector type for RFPortImplementation.

Definition at line 99 of file RFImplementation.hh.

Constructor & Destructor Documentation

◆ RFImplementation() [1/2]

HDB::RFImplementation::RFImplementation ( const std::string &  moduleName,
const std::string &  clkPort,
const std::string &  rstPort,
const std::string &  glockPort,
const std::string &  sizeParam,
const std::string &  widthParam,
const std::string &  guardPort,
bool  sacParam = false 
)

The constructor.

Parameters
moduleNameName of the module.
clkPortName of the clock port.
rstPortName of the reset port.
glockPortName of the global lock port.
sizeParamName of the parameter that defines the size of the register file.
widthParamName of the parameter that defines the width of the register file.
guardPortName of the guard port.
sacParamFlag for separate address cycle. Default value is false.

Definition at line 61 of file RFImplementation.cc.

69 :
71 sizeParam_(sizeParam), widthParam_(widthParam), guardPort_(guardPort),
72 sepAddrCycleParam_(sacParam) {
73}
HWBlockImplementation(const std::string &moduleName, const std::string &clkPort, const std::string &rstPort, const std::string &glockPort)
bool sepAddrCycleParam_
State of separate address cycle parameter.
std::string guardPort_
Name of the guard port.
std::string sizeParam_
Name of the size parameter.
std::string guardPort() const
std::string widthParam_
Name of the width parameter.

◆ ~RFImplementation()

HDB::RFImplementation::~RFImplementation ( )
virtual

The destructor.

Definition at line 110 of file RFImplementation.cc.

110 {
113}
PortTable ports_
Contains the ports.
ExternalPortTable externalPorts_
Contains the external ports.
static void deleteAllItems(SequenceType &aSequence)

References SequenceTools::deleteAllItems(), externalPorts_, and ports_.

Here is the call graph for this function:

◆ RFImplementation() [2/2]

HDB::RFImplementation::RFImplementation ( const RFImplementation original)

Copy constructor.

Parameters
originalRFImplementation to copy.

Definition at line 81 of file RFImplementation.cc.

81 :
82 HWBlockImplementation(original) {
83
84 sizeParam_ = original.sizeParam_;
85 widthParam_ = original.widthParam_;
86 guardPort_ = original.guardPort_;
87 sepAddrCycleParam_ = original.sepAddrCycleParam_;
88
89 // Deep copy ports.
90 for (int i = 0; i < original.portCount(); i++) {
91 RFPortImplementation* p = new RFPortImplementation(original.port(i));
92 addPort(p);
93 }
94
95 // Copy parameters.
96 parameters_ = original.parameters_;
97
98 // Deep copy external ports.
99 for (int i = 0; i < original.externalPortCount(); i++) {
100 RFExternalPort* p = new RFExternalPort(original.externalPort(i));
102 }
103
104}
ParameterTable parameters_
Contains the parameters.
void addPort(RFPortImplementation *port)
void addExternalPort(RFExternalPort *extPort)

References addExternalPort(), addPort(), externalPort(), externalPortCount(), guardPort_, parameters_, port(), portCount(), sepAddrCycleParam_, sizeParam_, and widthParam_.

Here is the call graph for this function:

Member Function Documentation

◆ addExternalPort()

void HDB::RFImplementation::addExternalPort ( RFExternalPort extPort)

Adds a new external port to the RF implementation.

Parameters
extPortThe external port to be added.

Definition at line 214 of file RFImplementation.cc.

214 {
215 externalPorts_.push_back(extPort);
216}

References externalPorts_.

Referenced by HDB::RFExternalPort::RFExternalPort(), and RFImplementation().

◆ addParameter()

void HDB::RFImplementation::addParameter ( const std::string &  name,
const std::string &  type,
const std::string &  value 
)

Adds the given parameter for the implementation.

Parameters
nameName of the parameter.
typeType of the parameter.
valueValue of the parameter.
Exceptions
IllegalParametersIf the RF implementation contains a parameter with the same name already.

Definition at line 318 of file RFImplementation.cc.

320 {
321 if (hasParameter(name)) {
322 throw IllegalParameters(__FILE__, __LINE__, __func__);
323 } else {
324 Parameter param = {name, type, value};
325 parameters_.push_back(param);
326 }
327}
#define __func__
HDB::Parameter Parameter
Parameter of FU implementation.
bool hasParameter(const std::string &name) const

References __func__, hasParameter(), and parameters_.

Referenced by RFImplementationDialog::onAddParameter(), RFImplementationDialog::onEditParameter(), and RFImplementationDialog::onParameterActivation().

Here is the call graph for this function:

◆ addPort()

void HDB::RFImplementation::addPort ( RFPortImplementation port)

Adds a new port to the RF implementation.

Parameters
portThe port to be added.

Definition at line 204 of file RFImplementation.cc.

204 {
205 ports_.push_back(port);
206}
RFPortImplementation & port(int index) const

References port(), and ports_.

Referenced by RFImplementation(), and HDB::RFPortImplementation::RFPortImplementation().

Here is the call graph for this function:

◆ deleteExternalPort()

void HDB::RFImplementation::deleteExternalPort ( RFExternalPort port)

Deletes the given external port.

Parameters
portThe port to delete.
Exceptions
InstanceNotFoundIf the given port is not in this RF implementation.

Definition at line 242 of file RFImplementation.cc.

242 {
244 if (!removed) {
245 throw InstanceNotFound(__FILE__, __LINE__, __func__);
246 }
247}
static bool deleteValueIfExists(ContainerType &aContainer, const ElementType &aKey)

References __func__, ContainerTools::deleteValueIfExists(), externalPorts_, and port().

Referenced by RFImplementationDialog::onAddExternalPort(), and RFImplementationDialog::onDeleteExternalPort().

Here is the call graph for this function:

◆ deletePort()

void HDB::RFImplementation::deletePort ( RFPortImplementation port)

Deletes the given port from the RF implementation.

Parameters
portThe port to delete.
Exceptions
InstanceNotFoundIf the given port is not in this RF implementation.

Definition at line 227 of file RFImplementation.cc.

227 {
229 if (!deleted) {
230 throw InstanceNotFound(__FILE__, __LINE__, __func__);
231 }
232}

References __func__, ContainerTools::deleteValueIfExists(), port(), and ports_.

Referenced by RFImplementationDialog::onAddPort(), and RFImplementationDialog::onDeletePort().

Here is the call graph for this function:

◆ externalPort()

RFExternalPort & HDB::RFImplementation::externalPort ( int  index) const

Returns the external port at the given position.

Parameters
indexThe position index.
Returns
The port.
Exceptions
OutOfRangeIf the given index is negative or not smaller the number of external ports.

Definition at line 299 of file RFImplementation.cc.

299 {
300 if (index < 0 || index >= externalPortCount()) {
301 const string procName = "RFImplementation::externalPort";
302 throw OutOfRange(__FILE__, __LINE__, procName);
303 }
304
305 return *externalPorts_[index];
306}

References externalPortCount(), and externalPorts_.

Referenced by RFImplementationDialog::onDeleteParameter(), RFImplementationDialog::onEditParameter(), RFImplementationDialog::onParameterActivation(), RFImplementation(), HDBToHtml::rfImplToHtml(), RFImplementationDialog::selectedExternalPort(), and RFImplementationDialog::update().

Here is the call graph for this function:

◆ externalPortCount()

int HDB::RFImplementation::externalPortCount ( ) const

Returns the number of external ports.

Returns
The number of external ports.

Definition at line 266 of file RFImplementation.cc.

266 {
267 return externalPorts_.size();
268
269}

References externalPorts_.

Referenced by externalPort(), RFImplementationDialog::onDeleteParameter(), RFImplementationDialog::onEditParameter(), RFImplementationDialog::onParameterActivation(), RFImplementation(), HDBToHtml::rfImplToHtml(), and RFImplementationDialog::update().

◆ guardPort()

std::string HDB::RFImplementation::guardPort ( ) const

Returns the name of the guard port.

Returns
The name of the guard port.

Definition at line 176 of file RFImplementation.cc.

176 {
177 return guardPort_;
178}

References guardPort_.

Referenced by HDBToHtml::rfImplToHtml(), and setGuardPort().

◆ hasParameter()

bool HDB::RFImplementation::hasParameter ( const std::string &  name) const

Tells whether the implementation has the given parameter.

Parameters
nameName of the parameter.
Returns
True if the implementation has the parameter, otherwise false.

Definition at line 381 of file RFImplementation.cc.

381 {
382 for (ParameterTable::const_iterator iter = parameters_.begin();
383 iter != parameters_.end(); iter++) {
384 if (iter->name == name) {
385 return true;
386 }
387 }
388 return false;
389}

References parameters_.

Referenced by addParameter().

◆ parameter()

RFImplementation::Parameter HDB::RFImplementation::parameter ( int  index) const

Returns a parameter by the given index.

Parameters
indexThe index.
Returns
The parameter.
Exceptions
OutOfRangeIf the index is negative or not smaller than the number of parameters.

Definition at line 366 of file RFImplementation.cc.

366 {
367 if (index < 0 || index >= parameterCount()) {
368 throw OutOfRange(__FILE__, __LINE__, __func__);
369 }
370
371 return parameters_[index];
372}

References __func__, parameterCount(), and parameters_.

Referenced by RFExternalPortDialog::initialize(), HDBToHtml::rfImplToHtml(), RFImplementationDialog::selectedParameter(), and RFImplementationDialog::update().

Here is the call graph for this function:

◆ parameterCount()

int HDB::RFImplementation::parameterCount ( ) const

Returns the number of parameters.

Returns
The number of parameters.

Definition at line 352 of file RFImplementation.cc.

352 {
353 return parameters_.size();
354}

References parameters_.

Referenced by RFExternalPortDialog::initialize(), RFExternalPortDialog::onOK(), parameter(), HDBToHtml::rfImplToHtml(), and RFImplementationDialog::update().

◆ port()

RFPortImplementation & HDB::RFImplementation::port ( int  index) const

Returns the port at the given position.

Parameters
indexThe position index.
Returns
The port.
Exceptions
OutOfRangeIf the index is negative or not smaller than the number of ports.

Definition at line 281 of file RFImplementation.cc.

281 {
282 if (index < 0 || index >= portCount()) {
283 const string procName = "RFImplementation::port";
284 throw OutOfRange(__FILE__, __LINE__, procName);
285 }
286
287 return *ports_[index];
288}

References portCount(), and ports_.

Referenced by addPort(), deleteExternalPort(), deletePort(), RFTestbenchGenerator::parseRfPorts(), RFImplementation(), HDBToHtml::rfImplToHtml(), RFImplementationDialog::selectedPort(), and RFImplementationDialog::update().

Here is the call graph for this function:

◆ portCount()

int HDB::RFImplementation::portCount ( ) const

Returns the number of ports.

Returns
The number of ports.

Definition at line 255 of file RFImplementation.cc.

255 {
256 return ports_.size();
257}

References ports_.

Referenced by RFTestbenchGenerator::parseRfPorts(), port(), RFImplementation(), HDBToHtml::rfImplToHtml(), and RFImplementationDialog::update().

◆ removeParameter()

void HDB::RFImplementation::removeParameter ( const std::string &  name)

Removes the parameter of the given name.

Parameters
nameName of the parameter.

Definition at line 335 of file RFImplementation.cc.

335 {
336 for (ParameterTable::iterator iter = parameters_.begin();
337 iter != parameters_.end(); iter++) {
338 if (iter->name == name) {
339 parameters_.erase(iter);
340 return;
341 }
342 }
343}

References parameters_.

Referenced by RFImplementationDialog::onDeleteParameter(), RFImplementationDialog::onEditParameter(), and RFImplementationDialog::onParameterActivation().

◆ separateAddressCycleParameter()

bool HDB::RFImplementation::separateAddressCycleParameter ( ) const

Returns flag for separate address cycle.

Returns
The flag value. True if enabled.

Definition at line 194 of file RFImplementation.cc.

194 {
195 return sepAddrCycleParam_;
196}

References sepAddrCycleParam_.

Referenced by HDBToHtml::rfImplToHtml(), and DefaultDecoderGenerator::sacEnabled().

◆ setGuardPort()

void HDB::RFImplementation::setGuardPort ( const std::string &  guardPort)

Sets the name of the guard port.

Parameters
guardPortName of the guard port.

Definition at line 165 of file RFImplementation.cc.

165 {
167}

References guardPort(), and guardPort_.

Referenced by RFImplementationDialog::onOK().

Here is the call graph for this function:

◆ setSeparateAddressCycleParameter()

void HDB::RFImplementation::setSeparateAddressCycleParameter ( bool  enable)

Sets flag for separate address cycle.

Parameters
enableFlag value.

Definition at line 185 of file RFImplementation.cc.

185 {
186 sepAddrCycleParam_ = enable;
187}

References sepAddrCycleParam_.

Referenced by RFImplementationDialog::onOK().

◆ setSizeParameter()

void HDB::RFImplementation::setSizeParameter ( const std::string &  sizeParam)

Sets the name of the size parameter.

Parameters
sizeParamName of the size parameter.

Definition at line 121 of file RFImplementation.cc.

121 {
122 sizeParam_ = sizeParam;
123}

References sizeParam_.

Referenced by RFImplementationDialog::onOK().

◆ setWidthParameter()

void HDB::RFImplementation::setWidthParameter ( const std::string &  widthParam)

Sets the name of the width parameter.

Parameters
widthParamName of the width parameter.

Definition at line 143 of file RFImplementation.cc.

143 {
144 widthParam_ = widthParam;
145}

References widthParam_.

Referenced by RFImplementationDialog::onOK().

◆ sizeParameter()

std::string HDB::RFImplementation::sizeParameter ( ) const

Returns the name of the size parameter.

Returns
The name of the size parameter.

Definition at line 132 of file RFImplementation.cc.

132 {
133 return sizeParam_;
134}

References sizeParam_.

Referenced by RFTestbenchGenerator::createTbInstantiation(), and HDBToHtml::rfImplToHtml().

◆ widthParameter()

std::string HDB::RFImplementation::widthParameter ( ) const

Returns the name of the width parameter.

Returns
The name of the width parameter.

Definition at line 154 of file RFImplementation.cc.

154 {
155 return widthParam_;
156}

References widthParam_.

Referenced by RFTestbenchGenerator::createTbInstantiation(), and HDBToHtml::rfImplToHtml().

Member Data Documentation

◆ externalPorts_

ExternalPortTable HDB::RFImplementation::externalPorts_
private

Contains the external ports.

Definition at line 117 of file RFImplementation.hh.

Referenced by addExternalPort(), deleteExternalPort(), externalPort(), externalPortCount(), and ~RFImplementation().

◆ guardPort_

std::string HDB::RFImplementation::guardPort_
private

Name of the guard port.

Definition at line 110 of file RFImplementation.hh.

Referenced by guardPort(), RFImplementation(), and setGuardPort().

◆ parameters_

ParameterTable HDB::RFImplementation::parameters_
private

Contains the parameters.

Definition at line 119 of file RFImplementation.hh.

Referenced by addParameter(), hasParameter(), parameter(), parameterCount(), removeParameter(), and RFImplementation().

◆ ports_

PortTable HDB::RFImplementation::ports_
private

Contains the ports.

Definition at line 115 of file RFImplementation.hh.

Referenced by addPort(), deletePort(), port(), portCount(), and ~RFImplementation().

◆ sepAddrCycleParam_

bool HDB::RFImplementation::sepAddrCycleParam_
private

State of separate address cycle parameter.

Definition at line 112 of file RFImplementation.hh.

Referenced by RFImplementation(), separateAddressCycleParameter(), and setSeparateAddressCycleParameter().

◆ sizeParam_

std::string HDB::RFImplementation::sizeParam_
private

Name of the size parameter.

Definition at line 106 of file RFImplementation.hh.

Referenced by RFImplementation(), setSizeParameter(), and sizeParameter().

◆ widthParam_

std::string HDB::RFImplementation::widthParam_
private

Name of the width parameter.

Definition at line 108 of file RFImplementation.hh.

Referenced by RFImplementation(), setWidthParameter(), and widthParameter().


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