OpenASIP
2.0
|
#include <VerilogNetlistWriter.hh>
Public Member Functions | |
VerilogNetlistWriter (const BaseNetlistBlock &targetBlock) | |
virtual | ~VerilogNetlistWriter () |
virtual void | write (const std::string &dstDirectory) |
Public Member Functions inherited from ProGe::NetlistWriter | |
NetlistWriter (const BaseNetlistBlock &targetBlock) | |
virtual | ~NetlistWriter () |
Static Public Member Functions | |
static void | writeGenericDeclaration (const BaseNetlistBlock &block, unsigned int indentationLevel, const std::string &indentation, std::ostream &stream) |
static void | writePortDeclaration (const BaseNetlistBlock &block, unsigned int indentationLevel, const std::string &indentation, std::ostream &stream) |
Private Types | |
typedef boost::graph_traits< Netlist >::vertex_descriptor | vertex_descriptor |
typedef boost::graph_traits< Netlist >::edge_descriptor | edge_descriptor |
typedef boost::graph_traits< Netlist >::out_edge_iterator | out_edge_iterator |
Private Member Functions | |
void | writeNetlistParameterPackage (const std::string &dstDirectory) const |
std::string | netlistParameterPkgName () const |
void | writeBlock (const BaseNetlistBlock &block, const std::string &dstDirectory) |
void | writeSignalDeclarations (const BaseNetlistBlock &block, std::ofstream &stream) |
void | writeSignalAssignments (const BaseNetlistBlock &block, std::ofstream &stream) const |
void | writeComponentDeclarations (const BaseNetlistBlock &block, std::ofstream &stream) const |
void | writePortMappings (const BaseNetlistBlock &block, std::ofstream &stream) const |
std::string | indentation (unsigned int level) const |
TCEString | genericMapStringValue (const TCEString &generic) const |
Static Private Member Functions | |
static std::string | directionString (Direction direction) |
static std::string | generateIndentation (unsigned int level, const std::string &indentation) |
static bool | isNumber (const std::string &formula) |
static std::string | portSignalName (const NetlistPort &port) |
static std::string | portSignalType (const NetlistPort &port) |
Private Attributes | |
int | groundWidth_ |
Width of the ground signal. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from ProGe::NetlistWriter | |
const BaseNetlistBlock & | targetNetlistBlock () const |
Writes Verilog files which implement the given netlist.
Definition at line 52 of file VerilogNetlistWriter.hh.
|
private |
Definition at line 74 of file VerilogNetlistWriter.hh.
|
private |
Definition at line 76 of file VerilogNetlistWriter.hh.
|
private |
Definition at line 72 of file VerilogNetlistWriter.hh.
ProGe::VerilogNetlistWriter::VerilogNetlistWriter | ( | const BaseNetlistBlock & | targetBlock | ) |
Constructor. Records the input netlist for which it can generate Verilog.
netlist | The input netlist. |
Definition at line 68 of file VerilogNetlistWriter.cc.
|
virtual |
|
staticprivate |
Returns the string that means the same direction as the given one in Verilog.
Definition at line 573 of file VerilogNetlistWriter.cc.
References assert, ProGe::BIDIR, ProGe::IN, and ProGe::OUT.
Referenced by writePortDeclaration().
|
staticprivate |
Generates an indentation string with the given parameters.
indentationLevel | The level of indentation. |
indentation | The string used as indentation (one level). |
Definition at line 623 of file VerilogNetlistWriter.cc.
References indentation().
Referenced by writeGenericDeclaration(), and writePortDeclaration().
|
private |
Tries to determine whether the string generic needs quot marks for generic mapping
If string literal contains '.', or "__" it cannot be a valid Verilog label (i.e. another generic), thus it needs quotation marks.
generic | String generic value |
Definition at line 676 of file VerilogNetlistWriter.cc.
Referenced by writePortMappings().
|
private |
Returns a string which makes indetation of the given level.
level | The indentation level. |
Definition at line 611 of file VerilogNetlistWriter.cc.
References StringTools::indent().
Referenced by generateIndentation(), writeBlock(), writeGenericDeclaration(), writePortDeclaration(), writePortMappings(), writeSignalAssignments(), and writeSignalDeclarations().
|
staticprivate |
Tells whether the given string is a non-negative integer number.
formula | The string. |
Definition at line 594 of file VerilogNetlistWriter.cc.
Referenced by portSignalType(), and writePortDeclaration().
|
private |
Returns the name of the netlist parameter package(include file).
Definition at line 126 of file VerilogNetlistWriter.cc.
References ProGe::BaseNetlistBlock::moduleName(), and ProGe::NetlistWriter::targetNetlistBlock().
Referenced by writeBlock(), and writeNetlistParameterPackage().
|
staticprivate |
Returns the name of the signal mapped to the given port.
port | The port. |
Definition at line 641 of file VerilogNetlistWriter.cc.
References ProGe::NetlistPort::hasStaticValue(), ProGe::BaseNetlistBlock::instanceName(), ProGe::StaticSignal::is(), ProGe::NetlistPort::name(), ProGe::NetlistPort::parentBlock(), ProGe::NetlistPort::realWidth(), ProGe::NetlistPort::staticValue(), Conversion::toString(), and ProGe::StaticSignal::VCC.
Referenced by writePortMappings(), writeSignalAssignments(), and writeSignalDeclarations().
|
staticprivate |
Returns the type of the signal mapped to the given port.
port | The port. |
Definition at line 659 of file VerilogNetlistWriter.cc.
References ProGe::BIT, ProGe::NetlistPort::dataType(), isNumber(), ProGe::NetlistPort::realWidth(), ProGe::NetlistPort::realWidthAvailable(), Conversion::toInt(), Conversion::toString(), and ProGe::NetlistPort::widthFormula().
Referenced by writeSignalDeclarations().
|
virtual |
Generates the Verilog files and writes them to the given directory.
dstDirectory | The destination directory. |
IOException | If an IO error occurs. |
InvalidData | If the netlist is invalid. |
Implements ProGe::NetlistWriter.
Definition at line 86 of file VerilogNetlistWriter.cc.
References __func__, ProGe::Netlist::isEmpty(), ProGe::BaseNetlistBlock::netlist(), ProGe::NetlistWriter::targetNetlistBlock(), writeBlock(), and writeNetlistParameterPackage().
Referenced by ProGe::BaseNetlistBlock::writeSelf().
|
private |
Writes the given block of the netlist to the given destination directory.
block | The netlist block. |
dstDirectory | The destination directory. |
IOException | If the file cannot be created. |
Definition at line 139 of file VerilogNetlistWriter.cc.
References __func__, FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), FileSystem::fileIsCreatable(), FileSystem::fileIsWritable(), indentation(), ProGe::BaseNetlistBlock::moduleName(), ProGe::BaseNetlistBlock::netlist(), netlistParameterPkgName(), ProGe::BaseNetlistBlock::package(), ProGe::BaseNetlistBlock::packageCount(), ProGe::Netlist::parameterCount(), writeGenericDeclaration(), writePortDeclaration(), writePortMappings(), writeSignalAssignments(), and writeSignalDeclarations().
Referenced by write().
|
private |
|
static |
Writes the generic(parameter) declarations of the given netlist block.
block | The netlist block. |
indentationLevel | The indentation level where the generic declaration is written. |
indentation | The string used as indentation (one level). |
stream | The stream to write. |
Definition at line 203 of file VerilogNetlistWriter.cc.
References ProGe::Parameter::defaultValue(), TCEString::endsWith(), generateIndentation(), indentation(), TCEString::lower(), ProGe::Parameter::name(), PARAM_STRING, ProGe::BaseNetlistBlock::parameter(), ProGe::BaseNetlistBlock::parameterCount(), TCEString::startsWith(), and ProGe::Parameter::type().
Referenced by writeBlock().
|
private |
Writes the package(include files for verilog) that defines parameters of the netlist.
dstDirectory | The destination directory. |
Definition at line 104 of file VerilogNetlistWriter.cc.
References FileSystem::DIRECTORY_SEPARATOR, ProGe::Parameter::name(), ProGe::BaseNetlistBlock::netlist(), netlistParameterPkgName(), ProGe::Netlist::parameter(), ProGe::Netlist::parameterCount(), ProGe::NetlistWriter::targetNetlistBlock(), and ProGe::Parameter::value().
Referenced by write().
|
static |
Writes the port declaration of the given netlist block.
block | The netlist block. |
indentationLevel | The indentation level where the generic declaration is written. |
indentation | The string used as indentation (one level). |
stream | The stream to write. |
Definition at line 241 of file VerilogNetlistWriter.cc.
References ProGe::BIT, ProGe::NetlistPort::dataType(), ProGe::NetlistPort::direction(), directionString(), generateIndentation(), indentation(), isNumber(), ProGe::NetlistPort::name(), ProGe::BaseNetlistBlock::port(), ProGe::BaseNetlistBlock::portCount(), Conversion::toInt(), and ProGe::NetlistPort::widthFormula().
Referenced by writeBlock().
|
private |
Writes the port mappings of the given block to the given stream.
block | The netlist block. |
stream | The stream to write. |
Definition at line 488 of file VerilogNetlistWriter.cc.
References assert, ProGe::BIT, ProGe::BIT_VECTOR, ProGe::NetlistPort::dataType(), ProGe::Netlist::descriptor(), genericMapStringValue(), indentation(), ProGe::BaseNetlistBlock::instanceName(), ProGe::BaseNetlistBlock::isVirtual(), TCEString::lower(), ProGe::BaseNetlistBlock::moduleName(), ProGe::Parameter::name(), ProGe::NetlistPort::name(), ProGe::BaseNetlistBlock::netlist(), PARAM_STRING, ProGe::BaseNetlistBlock::parameter(), ProGe::BaseNetlistBlock::parameterCount(), ProGe::NetlistPort::parentBlock(), ProGe::BaseNetlistBlock::port(), ProGe::BaseNetlistBlock::portCount(), portSignalName(), ProGe::BaseNetlistBlock::subBlock(), ProGe::BaseNetlistBlock::subBlockCount(), ProGe::Parameter::type(), and ProGe::Parameter::value().
Referenced by writeBlock().
|
private |
Writes the signal assignments of the given block to the given stream.
block | The netlist block. |
stream | The stream. |
Definition at line 350 of file VerilogNetlistWriter.cc.
References assert, ProGe::BIT, AssocTools::containsKey(), ContainerTools::containsValue(), ProGe::NetlistPort::dataType(), ProGe::Netlist::descriptor(), ProGe::NetlistPort::direction(), GROUND_SIGNAL, groundWidth_, indentation(), ProGe::BaseNetlistBlock::netlist(), ProGe::OUT, ProGe::NetlistPort::parentBlock(), ProGe::BaseNetlistBlock::port(), ProGe::BaseNetlistBlock::portCount(), portSignalName(), ProGe::BaseNetlistBlock::subBlock(), ProGe::BaseNetlistBlock::subBlockCount(), and Conversion::toString().
Referenced by writeBlock().
|
private |
Writes the Verilog signal declarations to the given stream.
block | The block of which the signals are written. |
stream | The stream to write. |
Definition at line 286 of file VerilogNetlistWriter.cc.
References ProGe::Netlist::descriptor(), GROUND_SIGNAL, groundWidth_, ProGe::NetlistPort::hasStaticValue(), indentation(), ProGe::BaseNetlistBlock::isVirtual(), ProGe::BaseNetlistBlock::netlist(), ProGe::NetlistPort::parentBlock(), ProGe::BaseNetlistBlock::port(), ProGe::BaseNetlistBlock::portCount(), portSignalName(), portSignalType(), ProGe::NetlistPort::realWidth(), ProGe::NetlistPort::realWidthAvailable(), ProGe::BaseNetlistBlock::subBlock(), and ProGe::BaseNetlistBlock::subBlockCount().
Referenced by writeBlock().
|
private |
Width of the ground signal.
Definition at line 117 of file VerilogNetlistWriter.hh.
Referenced by writeSignalAssignments(), and writeSignalDeclarations().