OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ArrayProgramImageWriter Class Reference

#include <ArrayProgramImageWriter.hh>

Inheritance diagram for ArrayProgramImageWriter:
Inheritance graph
Collaboration diagram for ArrayProgramImageWriter:
Collaboration graph

Public Member Functions

 ArrayProgramImageWriter (const InstructionBitVector &bits)
 
virtual ~ArrayProgramImageWriter ()
 
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 ()
 

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

A program image writer that writes the program as an array. It can be copied to a VHDL file to initialize an array, for example.

Definition at line 44 of file ArrayProgramImageWriter.hh.

Constructor & Destructor Documentation

◆ ArrayProgramImageWriter()

ArrayProgramImageWriter::ArrayProgramImageWriter ( const InstructionBitVector bits)

The constructor.

Parameters
bitsThe program image to write.

Definition at line 42 of file ArrayProgramImageWriter.cc.

44}
const BitVector & bits() const

◆ ~ArrayProgramImageWriter()

ArrayProgramImageWriter::~ArrayProgramImageWriter ( )
virtual

The destructor.

Definition at line 50 of file ArrayProgramImageWriter.cc.

50 {
51}

Member Function Documentation

◆ writeImage()

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

Writes the program image to the given output stream.

Parameters
streamThe output stream.

Reimplemented from ArrayImageWriter.

Reimplemented in VhdlProgramImageWriter.

Definition at line 60 of file ArrayProgramImageWriter.cc.

60 {
61
62 const BitVector& bits = this->bits();
63 const InstructionBitVector* programBits =
64 dynamic_cast<const InstructionBitVector*>(&bits);
65 assert(programBits != NULL);
66
67 unsigned int previousBoundary(0);
68 for (unsigned int i = 1; i < programBits->instructionCount(); i++) {
69 unsigned int instructionBoundary =
70 programBits->instructionStartingPoint(i);
71 stream << "\"";
72 writeSequence(stream, instructionBoundary - previousBoundary);
73 stream << "\"," << std::endl;
74 previousBoundary = instructionBoundary;
75 }
76 stream << "\"";
77 writeSequence(stream, bits.size() - previousBoundary);
78 stream << "\"";
79}
#define assert(condition)
void writeSequence(std::ostream &stream, int length, bool padEnd=false) const
unsigned int instructionCount() const
unsigned int instructionStartingPoint(unsigned int index) const

References assert, AsciiImageWriter::bits(), InstructionBitVector::instructionCount(), InstructionBitVector::instructionStartingPoint(), and AsciiImageWriter::writeSequence().

Referenced by VhdlProgramImageWriter::writeImage().

Here is the call graph for this function:

The documentation for this class was generated from the following files: