OpenASIP  2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
VhdlImageWriter Class Reference

#include <VhdlImageWriter.hh>

Inheritance diagram for VhdlImageWriter:
Inheritance graph
Collaboration diagram for VhdlImageWriter:
Collaboration graph

Public Member Functions

 VhdlImageWriter (const BitVector &bits, int rowLength, const std::string &entityName)
 
virtual ~VhdlImageWriter ()
 
virtual void writeImage (std::ostream &stream) const
 
- Public Member Functions inherited from ArrayImageWriter
 ArrayImageWriter (const BitVector &bits, int rowLength)
 
virtual ~ArrayImageWriter ()
 
- Public Member Functions inherited from AsciiImageWriter
 AsciiImageWriter (const BitVector &bits, int rowLength)
 
virtual ~AsciiImageWriter ()
 
- Public Member Functions inherited from BitImageWriter
virtual ~BitImageWriter ()
 

Private Member Functions

void writeHeader (std::ostream &stream) const
 
void writeEnding (std::ostream &stream) const
 
std::string packageName () const
 

Private Attributes

std::string entityName_
 

Additional Inherited Members

- Protected Member Functions inherited from AsciiImageWriter
const BitVectorbits () const
 
int rowLength () const
 
void writeSequence (std::ostream &stream, int length, bool padEnd=false) const
 
void writeHexSequence (std::ostream &stream, int length, bool padEnd=false) const
 

Detailed Description

Writes the (instruction) bit image to a vhdl package.

Definition at line 43 of file VhdlImageWriter.hh.

Constructor & Destructor Documentation

◆ VhdlImageWriter()

VhdlImageWriter::VhdlImageWriter ( const BitVector bits,
int  rowLength,
const std::string &  entityName 
)

The constructor.

Parameters
bitsThe bits to write.
rowLengthLength of the rows to write.

Definition at line 45 of file VhdlImageWriter.cc.

48  :
50 }

◆ ~VhdlImageWriter()

VhdlImageWriter::~VhdlImageWriter ( )
virtual

The destructor.

Definition at line 55 of file VhdlImageWriter.cc.

55  {
56 }

Member Function Documentation

◆ packageName()

std::string VhdlImageWriter::packageName ( ) const
private

Definition at line 95 of file VhdlImageWriter.cc.

95  {
96 
97  std::string package = "dmem_image";
98  if (!entityName_.empty()) {
99  package = entityName_ + "_" + package;
100  }
101  return package;
102 }

References entityName_.

Referenced by writeEnding(), and writeHeader().

◆ writeEnding()

void VhdlImageWriter::writeEnding ( std::ostream &  stream) const
private

Writes the end declarations to the stream

Definition at line 89 of file VhdlImageWriter.cc.

89  {
90  stream << ");" << endl << endl
91  << "end " << packageName() << ";" << endl;
92 }

References packageName().

Referenced by writeImage().

Here is the call graph for this function:

◆ writeHeader()

void VhdlImageWriter::writeHeader ( std::ostream &  stream) const
private

Writes the vhdl declaration stuff to the beginning of the stream

Definition at line 73 of file VhdlImageWriter.cc.

73  {
74  stream << "library ieee;" << endl
75  << "use ieee.std_logic_1164.all;" << endl
76  << "use ieee.std_logic_arith.all;" << endl << endl;
77 
78  stream << "package " << packageName() << " is" << endl << endl
79  << " type std_logic_dmem_matrix is array (natural range <>) of "
80  << "std_logic_vector(" << rowLength() << "-1 downto 0);"
81  << endl << endl;
82 
83  stream << " constant dmem_array : std_logic_dmem_matrix := (" << endl;
84 }

References packageName(), and AsciiImageWriter::rowLength().

Referenced by writeImage().

Here is the call graph for this function:

◆ writeImage()

void VhdlImageWriter::writeImage ( std::ostream &  stream) const
virtual

Writes the bit image to the given stream.

Parameters
streamThe stream to write.

Reimplemented from ArrayImageWriter.

Definition at line 63 of file VhdlImageWriter.cc.

63  {
64  writeHeader(stream);
66  writeEnding(stream);
67 }

References writeEnding(), writeHeader(), and ArrayImageWriter::writeImage().

Here is the call graph for this function:

Member Data Documentation

◆ entityName_

std::string VhdlImageWriter::entityName_
private

Definition at line 59 of file VhdlImageWriter.hh.

Referenced by packageName().


The documentation for this class was generated from the following files:
VhdlImageWriter::entityName_
std::string entityName_
Definition: VhdlImageWriter.hh:59
AsciiImageWriter::rowLength
int rowLength() const
Definition: AsciiImageWriter.cc:112
ArrayImageWriter::ArrayImageWriter
ArrayImageWriter(const BitVector &bits, int rowLength)
Definition: ArrayImageWriter.cc:45
ArrayImageWriter::writeImage
virtual void writeImage(std::ostream &stream) const
Definition: ArrayImageWriter.cc:63
AsciiImageWriter::bits
const BitVector & bits() const
Definition: AsciiImageWriter.cc:101
VhdlImageWriter::writeHeader
void writeHeader(std::ostream &stream) const
Definition: VhdlImageWriter.cc:73
VhdlImageWriter::writeEnding
void writeEnding(std::ostream &stream) const
Definition: VhdlImageWriter.cc:89
VhdlImageWriter::packageName
std::string packageName() const
Definition: VhdlImageWriter.cc:95