OpenASIP  2.0
Public Member Functions | Private Attributes | List of all members
HDLGenerator::Parameter Class Reference

#include <HDLGenerator.hh>

Inheritance diagram for HDLGenerator::Parameter:
Inheritance graph
Collaboration diagram for HDLGenerator::Parameter:
Collaboration graph

Public Member Functions

 Parameter (std::string name, int value=-1)
 
 Parameter (std::string name, std::string value)
 
Width width () final
 
std::string strValue ()
 
void declare (std::ostream &stream, Language lang, int level=0)
 
- Public Member Functions inherited from HDLGenerator::Generatable
 Generatable (std::string name)
 
virtual ~Generatable ()=default
 
virtual void build ()
 
virtual void reads (const std::string &var)
 
virtual void reads (const LHSValue &var)
 
virtual void writes (const std::string &var)
 
virtual RegistergetRegister (const std::string &var)
 
virtual bool hasOption (const std::string &var)
 
virtual bool isRegister (const std::string &name)
 
virtual bool isVariable (const std::string &name)
 
virtual bool isConstant (const std::string &name)
 
virtual Width width (const std::string &name)
 
int integerWidth (const std::string &name)
 
virtual WireType wireType (const std::string &name)
 
virtual WireType wireType () const
 
virtual void hdl (std::ostream &stream, Language lang, int indent)
 
virtual void hdl (std::ostream &stream, Language lang)
 
virtual void implementAll (std::ostream &stream, Language lang)
 
virtual void implementAll (std::ostream &stream, Language lang, int indent)
 
template<typename Func >
void forAll (Func func)
 
template<typename Type , typename Func >
void forAll (Func func)
 
template<class Type >
bool parentIs ()
 
template<class Type >
Type * parentType ()
 
void pushComponent (std::shared_ptr< Generatable > c)
 
template<class Component >
void addComponent (Component c)
 
const std::string & name () const noexcept
 
void setParent (Generatable *parent) noexcept
 
Generatableparent () const noexcept
 

Private Attributes

int value_
 
std::string strValue_
 

Detailed Description

Generic/parameter.

Definition at line 215 of file HDLGenerator.hh.

Constructor & Destructor Documentation

◆ Parameter() [1/2]

HDLGenerator::Parameter::Parameter ( std::string  name,
int  value = -1 
)
inline

Definition at line 217 of file HDLGenerator.hh.

218  : Generatable(name), value_(value) {}

◆ Parameter() [2/2]

HDLGenerator::Parameter::Parameter ( std::string  name,
std::string  value 
)
inline

Definition at line 219 of file HDLGenerator.hh.

220  : Generatable(name), value_(-1), strValue_(value) {}

Member Function Documentation

◆ declare()

void HDLGenerator::Parameter::declare ( std::ostream &  stream,
Language  lang,
int  level = 0 
)
inline

Definition at line 225 of file HDLGenerator.hh.

225  {
226  stream << StringTools::indent(level);
227  if (lang == Language::VHDL) {
228  stream << name() << " : integer";
229  } else if (lang == Language::Verilog) {
230  stream << "parameter integer " << name();
231  } else {
232  throw std::runtime_error(__PRETTY_FUNCTION__);
233  }
234  }

References StringTools::indent(), HDLGenerator::Generatable::name(), HDLGenerator::Verilog, and HDLGenerator::VHDL.

Here is the call graph for this function:

◆ strValue()

std::string HDLGenerator::Parameter::strValue ( )
inline

Definition at line 223 of file HDLGenerator.hh.

223 { return strValue_; }

References strValue_.

◆ width()

Width HDLGenerator::Parameter::width ( )
inlinefinalvirtual

Reimplemented from HDLGenerator::Generatable.

Definition at line 222 of file HDLGenerator.hh.

222 { return {name(), value_}; }

References HDLGenerator::Generatable::name(), and value_.

Here is the call graph for this function:

Member Data Documentation

◆ strValue_

std::string HDLGenerator::Parameter::strValue_
private

Definition at line 238 of file HDLGenerator.hh.

Referenced by strValue().

◆ value_

int HDLGenerator::Parameter::value_
private

Definition at line 237 of file HDLGenerator.hh.

Referenced by width().


The documentation for this class was generated from the following file:
StringTools::indent
static std::string indent(int level)
Definition: StringTools.cc:319
HDLGenerator::Parameter::value_
int value_
Definition: HDLGenerator.hh:237
HDLGenerator::Generatable::Generatable
Generatable(std::string name)
Definition: Generatable.hh:53
HDLGenerator::Language::Verilog
@ Verilog
HDLGenerator::Parameter::strValue_
std::string strValue_
Definition: HDLGenerator.hh:238
HDLGenerator::Generatable::name
const std::string & name() const noexcept
Definition: Generatable.hh:239
HDLGenerator::Language::VHDL
@ VHDL