OpenASIP  2.0
Public Member Functions | List of all members
HexImageWriter Class Reference

#include <HexImageWriter.hh>

Inheritance diagram for HexImageWriter:
Inheritance graph
Collaboration diagram for HexImageWriter:
Collaboration graph

Public Member Functions

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

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 bit image in HEX format. It's used for both ASIC and FPGA memory models

Definition at line 46 of file HexImageWriter.hh.

Constructor & Destructor Documentation

◆ HexImageWriter()

HexImageWriter::HexImageWriter ( const BitVector bits,
int  rowLength 
)

The constructor.

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

Definition at line 51 of file HexImageWriter.cc.

51  :
53 }

◆ ~HexImageWriter()

HexImageWriter::~HexImageWriter ( )
virtual

The destructor.

Definition at line 58 of file HexImageWriter.cc.

58  {
59 }

Member Function Documentation

◆ writeImage()

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

Writes the bit image to the given stream.

Parameters
streamThe stream to write.

Reimplemented from AsciiImageWriter.

Definition at line 68 of file HexImageWriter.cc.

68  {
69  const int lineCount = static_cast<int>(
70  ceil(static_cast<double>(bits().size()) / rowLength()));
71 
72  const int nibbleCount = static_cast<int>(
73  ceil(static_cast<double>(rowLength() / 4)));
74 
75  if (lineCount == 0) {
76  stream << std::hex << std::setfill('0')
77  << std::setw(nibbleCount) << 0 << std::endl;
78 
79  } else {
80  bool padEndings = false;
81 
82  for (int i = 0; i < lineCount; ++i) {
83  writeHexSequence(stream, rowLength(), padEndings);
84  stream << endl;
85  }
86  }
87 }

References AsciiImageWriter::bits(), AsciiImageWriter::rowLength(), and AsciiImageWriter::writeHexSequence().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
AsciiImageWriter::AsciiImageWriter
AsciiImageWriter(const BitVector &bits, int rowLength)
Definition: AsciiImageWriter.cc:55
AsciiImageWriter::rowLength
int rowLength() const
Definition: AsciiImageWriter.cc:112
AsciiImageWriter::writeHexSequence
void writeHexSequence(std::ostream &stream, int length, bool padEnd=false) const
Definition: AsciiImageWriter.cc:160
AsciiImageWriter::bits
const BitVector & bits() const
Definition: AsciiImageWriter.cc:101