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

#include <DefaultCompressor.hh>

Inheritance diagram for DEFAULT_Compressor:
Inheritance graph
Collaboration diagram for DEFAULT_Compressor:
Collaboration graph

Public Member Functions

 DEFAULT_Compressor ()
 
virtual InstructionBitVectorcompress (const std::string &programName)
 
virtual void printDescription (std::ostream &stream)
 
virtual void generateDecompressor (std::ostream &, TCEString)
 
- Public Member Functions inherited from CodeCompressorPlugin
virtual ~CodeCompressorPlugin ()
 
void setParameters (ParameterTable parameters)
 
void setPrograms (std::map< std::string, TPEF::Binary * > &programs)
 
void setMachine (const TTAMachine::Machine &machine)
 
void setBEM (const BinaryEncoding &bem)
 
const BinaryEncodingbinaryEncoding () const
 
const TTAMachine::Machinemachine () const
 
unsigned int memoryAddress (const TTAProgram::Instruction &instruction) const
 
TTAProgram::ProgramcurrentProgram () const
 
int imemMauWidth () const
 
InstructionBitVectorbemInstructionBits (const TTAProgram::Instruction &)
 

Additional Inherited Members

- Public Types inherited from CodeCompressorPlugin
typedef std::vector< ParameterParameterTable
 Table for passing plugin parameters. More...
 
- Protected Types inherited from CodeCompressorPlugin
typedef std::map< std::string, TPEF::Binary * > TPEFMap
 Map type for handling programs. More...
 
- Protected Member Functions inherited from CodeCompressorPlugin
 CodeCompressorPlugin ()
 
InstructionBitVectorbemBits (const TTAProgram::Program &program)
 
int moveSlotCount () const
 
int moveSlotWidth (int index) const
 
int firstMoveSlotIndex () const
 
void startNewProgram (const std::string &programName)
 
void addInstruction (const TTAProgram::Instruction &instruction, InstructionBitVector *bits)
 
void setInstructionToStartAtBeginningOfMAU (const TTAProgram::Instruction &instruction)
 
void setAllInstructionsToStartAtBeginningOfMAU ()
 
InstructionBitVectorprogramBits () const
 
bool hasParameter (const std::string &paramName) const
 
std::string parameterValue (const std::string &paramName) const
 
void setImemWidth (int mau, int widthInMaus=1)
 
int numberOfPrograms () const
 
TPEFMap::const_iterator programElement (int index) const
 
std::string indentation (int level)
 

Detailed Description

Definition at line 41 of file DefaultCompressor.hh.

Constructor & Destructor Documentation

◆ DEFAULT_Compressor()

DEFAULT_Compressor::DEFAULT_Compressor ( )
inline

Definition at line 43 of file DefaultCompressor.hh.

Member Function Documentation

◆ compress()

virtual InstructionBitVector* DEFAULT_Compressor::compress ( const std::string &  program)
inlinevirtual

Generates bit image of the program.

Returns
The bit image.
Exceptions
InvalidDataIf the BEM is erroneous.

Implements CodeCompressorPlugin.

Definition at line 46 of file DefaultCompressor.hh.

46  {
47  try {
48  startNewProgram(programName);
50  Instruction* instruction = &currentProgram().firstInstruction();
51  while (instruction != &NullInstruction::instance()) {
52  InstructionBitVector* instructionBits = bemInstructionBits(
53  *instruction);
54  addInstruction(*instruction, instructionBits);
55  instruction =
56  &currentProgram().nextInstruction(*instruction);
57  }
58 
59  return programBits();
60  } catch (const Exception& e) {
61  throw InvalidData(
62  __FILE__, __LINE__, __func__, e.errorMessage());
63  }
64  }

References __func__, CodeCompressorPlugin::addInstruction(), CodeCompressorPlugin::bemInstructionBits(), CodeCompressorPlugin::currentProgram(), Exception::errorMessage(), TTAProgram::Program::firstInstruction(), TTAProgram::Program::nextInstruction(), CodeCompressorPlugin::programBits(), CodeCompressorPlugin::setAllInstructionsToStartAtBeginningOfMAU(), and CodeCompressorPlugin::startNewProgram().

Here is the call graph for this function:

◆ generateDecompressor()

virtual void DEFAULT_Compressor::generateDecompressor ( std::ostream &  stream,
TCEString  entityStr 
)
inlinevirtual

Generates the HDL code of the decompressor block.

Parameters
streamThe stream to write.

Implements CodeCompressorPlugin.

Definition at line 72 of file DefaultCompressor.hh.

72 {}

◆ printDescription()

virtual void DEFAULT_Compressor::printDescription ( std::ostream &  stream)
inlinevirtual

Prints description of the plugin to the given stream.

Implements CodeCompressorPlugin.

Definition at line 67 of file DefaultCompressor.hh.

67  {
68  stream << "Does not compress instructions at all." << std::endl;
69  }

The documentation for this class was generated from the following file:
TTAProgram::Program::firstInstruction
Instruction & firstInstruction() const
Definition: Program.cc:353
TTAProgram::Program::nextInstruction
Instruction & nextInstruction(const Instruction &) const
Definition: Program.cc:403
TTAProgram::Instruction
Definition: Instruction.hh:57
CodeCompressorPlugin::addInstruction
void addInstruction(const TTAProgram::Instruction &instruction, InstructionBitVector *bits)
Definition: CodeCompressorPlugin.cc:384
InvalidData
Definition: Exception.hh:149
CodeCompressorPlugin::bemInstructionBits
InstructionBitVector * bemInstructionBits(const TTAProgram::Instruction &)
Definition: CodeCompressorPlugin.cc:454
__func__
#define __func__
Definition: Application.hh:67
CodeCompressorPlugin::startNewProgram
void startNewProgram(const std::string &programName)
Definition: CodeCompressorPlugin.cc:328
Exception
Definition: Exception.hh:54
CodeCompressorPlugin::currentProgram
TTAProgram::Program & currentProgram() const
Definition: CodeCompressorPlugin.cc:295
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
CodeCompressorPlugin::setAllInstructionsToStartAtBeginningOfMAU
void setAllInstructionsToStartAtBeginningOfMAU()
Definition: CodeCompressorPlugin.cc:440
CodeCompressorPlugin::CodeCompressorPlugin
CodeCompressorPlugin()
Definition: CodeCompressorPlugin.cc:104
CodeCompressorPlugin::programBits
InstructionBitVector * programBits() const
Definition: CodeCompressorPlugin.cc:533
InstructionBitVector
Definition: InstructionBitVector.hh:50