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

#include <WidthTransformations.hh>

Inheritance diagram for HDLGenerator::Sext:
Inheritance graph
Collaboration diagram for HDLGenerator::Sext:
Collaboration graph

Public Member Functions

 Sext (std::string name, int extWidth, int signalWidth)
 
 Sext (std::string name, std::string extWidth, int signalWidth)
 
void write_rtl (std::string name, std::string extWidth, int 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

Signed extend.

Definition at line 82 of file WidthTransformations.hh.

Constructor & Destructor Documentation

◆ Sext() [1/2]

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

Definition at line 84 of file WidthTransformations.hh.

84  {
85  readList_.insert(name);
86  if (extWidth > signalWidth) {
87  write_rtl(name, std::to_string(extWidth), signalWidth);
88  } else {
89  vhdl_ = name;
90  verilog_ = name;
91  }
92  }

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

Here is the call graph for this function:

◆ Sext() [2/2]

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

Definition at line 94 of file WidthTransformations.hh.

94  {
95  readList_.insert(name);
96  write_rtl(name, extWidth, signalWidth);
97  }

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

Here is the call graph for this function:

Member Function Documentation

◆ write_rtl()

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

Definition at line 99 of file WidthTransformations.hh.

100  {
101  std::string sigWidth = std::to_string(signalWidth);
102  vhdl_ = "((" + extWidth + "-1 downto " + sigWidth + " => " + name;
103  verilog_ = "{{" + extWidth + "-" + sigWidth + "{" + name + "}";
104  if (signalWidth > 1) {
105  vhdl_ += "(" + sigWidth + "-1)";
106  verilog_ += "[" + sigWidth + "-1]";
107  }
108  vhdl_ += ") & " + name + ")";
109  verilog_ += "}}" + name + "}";
110  }

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

Referenced by Sext().


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::Sext::write_rtl
void write_rtl(std::string name, std::string extWidth, int signalWidth)
Definition: WidthTransformations.hh:99