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

#include <LHSValue.hh>

Inheritance diagram for HDLGenerator::BinaryLiteral:
Inheritance graph
Collaboration diagram for HDLGenerator::BinaryLiteral:
Collaboration graph

Public Member Functions

 BinaryLiteral (std::string value)
 
 BinaryLiteral (int value, int width, bool signExtend)
 
std::string name ()
 
- 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~ ()
 

Private Attributes

std::string value_
 

Additional Inherited Members

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

Detailed Description

Definition at line 71 of file LHSValue.hh.

Constructor & Destructor Documentation

◆ BinaryLiteral() [1/2]

HDLGenerator::BinaryLiteral::BinaryLiteral ( std::string  value)

Definition at line 99 of file LHSValue.cc.

99  : value_(value) {
100  std::string delim;
101  if (value.size() > 1) {
102  delim = "\"";
103  } else {
104  delim = "'";
105  }
106  vhdl_ = delim + value + delim;
107  verilog_ = value;
108 }

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

◆ BinaryLiteral() [2/2]

HDLGenerator::BinaryLiteral::BinaryLiteral ( int  value,
int  width,
bool  signExtend 
)

Definition at line 110 of file LHSValue.cc.

111  : value_(std::to_string(value)) {
112  // e.g. std_logic_vector(to_signed(value, width))
113  std::string type = signExtend ? "signed" : "unsigned";
114  vhdl_ = "std_logic_vector(to_" + type + "(" + std::to_string(value) +
115  ", " + std::to_string(width) + "))";
116 
117  verilog_ = value;
118 }

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

Member Function Documentation

◆ name()

std::string HDLGenerator::BinaryLiteral::name ( )
inline

Definition at line 75 of file LHSValue.hh.

75 { return value_; }

References value_.

Referenced by HDLGenerator::Register::reset().

Member Data Documentation

◆ value_

std::string HDLGenerator::BinaryLiteral::value_
private

Definition at line 77 of file LHSValue.hh.

Referenced by name().


The documentation for this class was generated from the following files:
HDLGenerator::LHSValue::vhdl_
std::string vhdl_
Definition: LHSValue.hh:59
HDLGenerator::BinaryLiteral::value_
std::string value_
Definition: LHSValue.hh:77
HDLGenerator::LHSValue::verilog_
std::string verilog_
Definition: LHSValue.hh:60