OpenASIP
2.0
|
#include <VHDLNetlistWriter.hh>
Public Member Functions | |
VHDLNetlistWriter (const BaseNetlistBlock &targetBlock) | |
virtual | ~VHDLNetlistWriter () |
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 | writeConnection (const BaseNetlistBlock &block, std::ofstream &stream, edge_descriptor edgeDescriptor, NetlistPort *srcPort, NetlistPort *dstPort) 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 bool | usesParameterWidth (const NetlistPort &port) |
static std::string | portSignalName (const NetlistPort &port) |
static std::string | portSignalType (const NetlistPort &port) |
static TCEString | signalRange (int high, int low, bool allowShort=false) |
static TCEString | parameterWidthValue (const NetlistPort &port) |
static std::string | signalAssignment (const NetlistPort &dst, const NetlistPort &src) |
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 VHDL files which implement the given netlist block.
Definition at line 52 of file VHDLNetlistWriter.hh.
|
private |
Definition at line 74 of file VHDLNetlistWriter.hh.
|
private |
Definition at line 76 of file VHDLNetlistWriter.hh.
|
private |
Definition at line 72 of file VHDLNetlistWriter.hh.
ProGe::VHDLNetlistWriter::VHDLNetlistWriter | ( | const BaseNetlistBlock & | targetBlock | ) |
Constructor. Records the input netlist for which it can generate VHDL.
netlist | The input netlist. |
Definition at line 70 of file VHDLNetlistWriter.cc.
|
virtual |
|
staticprivate |
Returns the string that means the same direction as the given one in VHDL.
Definition at line 688 of file VHDLNetlistWriter.cc.
References assert, ProGe::BIDIR, ProGe::IN, and ProGe::OUT.
Referenced by writeComponentDeclarations(), and 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 751 of file VHDLNetlistWriter.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 VHDL label (i.e. another generic), thus it needs quotation marks.
generic | String generic value |
Definition at line 829 of file VHDLNetlistWriter.cc.
Referenced by writePortMappings().
|
private |
Returns a string which makes indetation of the given level.
level | The indentation level. |
Definition at line 739 of file VHDLNetlistWriter.cc.
References StringTools::indent().
Referenced by generateIndentation(), writeBlock(), writeComponentDeclarations(), writeConnection(), writeGenericDeclaration(), writeNetlistParameterPackage(), writePortDeclaration(), writePortMappings(), writeSignalAssignments(), and writeSignalDeclarations().
|
staticprivate |
Tells whether the given string is a non-negative integer number.
formula | The string. |
Definition at line 712 of file VHDLNetlistWriter.cc.
Referenced by portSignalType(), writeComponentDeclarations(), and writePortDeclaration().
|
private |
Returns the name of the netlist parameter package.
Definition at line 128 of file VHDLNetlistWriter.cc.
References ProGe::BaseNetlistBlock::moduleName(), and ProGe::NetlistWriter::targetNetlistBlock().
Referenced by writeBlock(), and writeNetlistParameterPackage().
|
staticprivate |
Returns port width value of port that uses parameter as width.
Definition at line 880 of file VHDLNetlistWriter.cc.
References ProGe::BaseNetlistBlock::parameter(), ProGe::NetlistPort::parentBlock(), ProGe::Parameter::value(), and ProGe::NetlistPort::widthFormula().
Referenced by portSignalType().
|
staticprivate |
Returns the name of the signal mapped to the given port.
port | The port. |
Definition at line 769 of file VHDLNetlistWriter.cc.
References ProGe::BIT, ProGe::NetlistPort::dataType(), ProGe::NetlistPort::hasStaticValue(), ProGe::BaseNetlistBlock::instanceName(), ProGe::StaticSignal::is(), ProGe::NetlistPort::name(), ProGe::NetlistPort::parentBlock(), ProGe::NetlistPort::staticValue(), and ProGe::StaticSignal::VCC.
Referenced by signalAssignment(), writeConnection(), writePortMappings(), and writeSignalDeclarations().
|
staticprivate |
Returns the type of the signal mapped to the given port.
port | The port. |
Definition at line 798 of file VHDLNetlistWriter.cc.
References ProGe::BIT, ProGe::NetlistPort::dataType(), isNumber(), parameterWidthValue(), ProGe::NetlistPort::realWidth(), ProGe::NetlistPort::realWidthAvailable(), signalRange(), Conversion::toInt(), usesParameterWidth(), and ProGe::NetlistPort::widthFormula().
Referenced by writeSignalDeclarations().
|
staticprivate |
Writes suitable signal assignment code of two signals.
The written code piece is "dst <= src;" with additional signal indexing in case the data types does not macth (i.e. BIT vs. BIT_VECTOR).
Definition at line 892 of file VHDLNetlistWriter.cc.
References ProGe::BIT_VECTOR, ProGe::NetlistPort::dataType(), and portSignalName().
Referenced by writeConnection().
|
staticprivate |
Returns signal range i.e. (<high> downto <low>).
Does not -1 the high index! If high == low and allowShort is true, just (<low>) is returned
high | MSB index |
low | LSB index |
allowShort | If true, skips 'downto' if high == low |
Definition at line 859 of file VHDLNetlistWriter.cc.
References __func__.
Referenced by portSignalType(), writeConnection(), and writeSignalDeclarations().
|
staticprivate |
Returns true if port uses single parameter of its parent block as port width.
Definition at line 728 of file VHDLNetlistWriter.cc.
References ProGe::BaseNetlistBlock::hasParameter(), ProGe::NetlistPort::parentBlock(), and ProGe::NetlistPort::widthFormula().
Referenced by portSignalType().
|
virtual |
Generates the VHDL 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 88 of file VHDLNetlistWriter.cc.
References __func__, 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 141 of file VHDLNetlistWriter.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(), writeComponentDeclarations(), writeGenericDeclaration(), writePortDeclaration(), writePortMappings(), writeSignalAssignments(), and writeSignalDeclarations().
Referenced by write().
|
private |
Writes the component declarations of the given netlist block to the given stream.
block | The netlist block. |
stream | The stream to write. |
Definition at line 520 of file VHDLNetlistWriter.cc.
References ProGe::BIT, AssocTools::containsKey(), ProGe::NetlistPort::dataType(), ProGe::NetlistPort::direction(), directionString(), indentation(), isNumber(), ProGe::BaseNetlistBlock::isVirtual(), ProGe::BaseNetlistBlock::moduleName(), ProGe::Parameter::name(), ProGe::NetlistPort::name(), ProGe::BaseNetlistBlock::parameter(), ProGe::BaseNetlistBlock::parameterCount(), ProGe::BaseNetlistBlock::port(), ProGe::BaseNetlistBlock::portCount(), ProGe::BaseNetlistBlock::subBlock(), ProGe::BaseNetlistBlock::subBlockCount(), Conversion::toInt(), ProGe::Parameter::type(), and ProGe::NetlistPort::widthFormula().
Referenced by writeBlock().
|
private |
Definition at line 444 of file VHDLNetlistWriter.cc.
References ProGe::BIT, ProGe::NetlistPort::dataType(), ProGe::NetlistPort::direction(), indentation(), ProGe::NetlistPort::name(), ProGe::BaseNetlistBlock::netlist(), ProGe::OUT, ProGe::NetlistPort::parentBlock(), portSignalName(), signalAssignment(), signalRange(), and Conversion::toString().
Referenced by writeSignalAssignments().
|
static |
Writes the generic 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 214 of file VHDLNetlistWriter.cc.
References ProGe::Parameter::defaultValue(), TCEString::endsWith(), generateIndentation(), indentation(), TCEString::lower(), ProGe::Parameter::name(), PARAM_STRING, ProGe::BaseNetlistBlock::parameter(), ProGe::BaseNetlistBlock::parameterCount(), TCEString::startsWith(), ProGe::Parameter::type(), and ProGe::Parameter::value().
Referenced by writeBlock().
|
private |
Writes the package that defines parameters of the netlist.
dstDirectory | The destination directory. |
Definition at line 103 of file VHDLNetlistWriter.cc.
References FileSystem::DIRECTORY_SEPARATOR, indentation(), ProGe::Parameter::name(), ProGe::BaseNetlistBlock::netlist(), netlistParameterPkgName(), ProGe::Netlist::parameter(), ProGe::Netlist::parameterCount(), ProGe::NetlistWriter::targetNetlistBlock(), ProGe::Parameter::type(), 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 257 of file VHDLNetlistWriter.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 585 of file VHDLNetlistWriter.cc.
References assert, ProGe::BIT, ProGe::BIT_VECTOR, ProGe::NetlistPort::dataType(), ProGe::Netlist::descriptor(), ProGe::NetlistPort::direction(), genericMapStringValue(), indentation(), ProGe::BaseNetlistBlock::instanceName(), ProGe::BaseNetlistBlock::isVirtual(), TCEString::lower(), ProGe::BaseNetlistBlock::moduleName(), ProGe::Parameter::name(), ProGe::NetlistPort::name(), ProGe::BaseNetlistBlock::netlist(), ProGe::OUT, PARAM_STRING, ProGe::BaseNetlistBlock::parameter(), ProGe::BaseNetlistBlock::parameterCount(), ProGe::NetlistPort::parentBlock(), ProGe::BaseNetlistBlock::port(), ProGe::BaseNetlistBlock::portCount(), portSignalName(), ProGe::BaseNetlistBlock::subBlock(), ProGe::BaseNetlistBlock::subBlockCount(), Conversion::toString(), ProGe::Parameter::type(), ProGe::Parameter::value(), and ProGe::NetlistPort::widthFormula().
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 368 of file VHDLNetlistWriter.cc.
References assert, 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(), ProGe::BaseNetlistBlock::subBlock(), ProGe::BaseNetlistBlock::subBlockCount(), and writeConnection().
Referenced by writeBlock().
|
private |
Writes the VHDL signal declarations to the given stream.
block | The block of which the signals are written. |
stream | The stream to write. |
Definition at line 300 of file VHDLNetlistWriter.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(), signalRange(), ProGe::BaseNetlistBlock::subBlock(), and ProGe::BaseNetlistBlock::subBlockCount().
Referenced by writeBlock().
|
private |
Width of the ground signal.
Definition at line 122 of file VHDLNetlistWriter.hh.
Referenced by writeSignalAssignments(), and writeSignalDeclarations().