OpenASIP  2.0
Public Member Functions | List of all members
HDLGenerator::Ext Class Reference

#include <WidthTransformations.hh>

Inheritance diagram for HDLGenerator::Ext:
Inheritance graph
Collaboration diagram for HDLGenerator::Ext:
Collaboration graph

Public Member Functions

 Ext (std::string name, int extWidth, int signalWidth)
 
 Ext (std::string name, std::string extWidth, int signalWidth)
 
void write_rtl (std::string name, std::string extWidth, std::string signalWidth)
 
- Public Member Functions inherited from HDLGenerator::LHSValue
 LHSValue ()
 
void hdl (std::ostream &stream, Language lang, int level)
 
void hdl (std::ostream &stream, Language lang)
 
void writeSignals (std::unordered_set< std::string > &readList) const
 
std::string vhdl () const
 
std::string verilog () const
 
LHSValue operator|| (LHSValue rhs)
 
LHSValue operator| (LHSValue rhs)
 
LHSValue operator&& (LHSValue rhs)
 
LHSValue operator& (LHSValue rhs)
 
LHSValue operator^ (LHSValue rhs)
 
LHSValue operator! ()
 
LHSValue operator~ ()
 

Additional Inherited Members

- Protected Attributes inherited from HDLGenerator::LHSValue
std::unordered_set< std::string > readList_
 
std::string vhdl_
 
std::string verilog_
 

Detailed Description

Unsigned extend.

Definition at line 39 of file WidthTransformations.hh.

Constructor & Destructor Documentation

◆ Ext() [1/2]

HDLGenerator::Ext::Ext ( std::string  name,
int  extWidth,
int  signalWidth 
)
inline

Definition at line 41 of file WidthTransformations.hh.

41  {
42  readList_.insert(name);
43  if (extWidth > signalWidth) {
44  write_rtl(name, std::to_string(extWidth),
45  std::to_string(signalWidth));
46  } else {
47  vhdl_ = name;
48  verilog_ = name;
49  }
50  }

References HDLGenerator::LHSValue::readList_, HDLGenerator::LHSValue::verilog_, HDLGenerator::LHSValue::vhdl_, and write_rtl().

Here is the call graph for this function:

◆ Ext() [2/2]

HDLGenerator::Ext::Ext ( std::string  name,
std::string  extWidth,
int  signalWidth 
)
inline

Definition at line 51 of file WidthTransformations.hh.

51  {
52  readList_.insert(name);
53  write_rtl(name, extWidth, std::to_string(signalWidth));
54  }

References HDLGenerator::LHSValue::readList_, and write_rtl().

Here is the call graph for this function:

Member Function Documentation

◆ write_rtl()

void HDLGenerator::Ext::write_rtl ( std::string  name,
std::string  extWidth,
std::string  signalWidth 
)
inline

Definition at line 56 of file WidthTransformations.hh.

57  {
58  vhdl_ = "((" + extWidth + "-1 downto " + signalWidth
59  + " => '0') & " + name + ")";
60  verilog_ = "{{" + extWidth + "-" + signalWidth + "{"
61  + "1'b0}}, " + name + "}";
62  }

References HDLGenerator::LHSValue::verilog_, and HDLGenerator::LHSValue::vhdl_.

Referenced by Ext().


The documentation for this class was generated from the following file:
HDLGenerator::LHSValue::vhdl_
std::string vhdl_
Definition: LHSValue.hh:59
HDLGenerator::LHSValue::verilog_
std::string verilog_
Definition: LHSValue.hh:60
HDLGenerator::LHSValue::readList_
std::unordered_set< std::string > readList_
Definition: LHSValue.hh:58
HDLGenerator::Ext::write_rtl
void write_rtl(std::string name, std::string extWidth, std::string signalWidth)
Definition: WidthTransformations.hh:56