OpenASIP 2.2
|
Public Member Functions | |
InstructionDictionary () | |
virtual InstructionBitVector * | compress (const std::string &programName) |
virtual void | generateDecompressor (std::ostream &stream, TCEString entityStr) |
virtual void | printDescription (std::ostream &stream) |
![]() | |
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 BinaryEncoding & | binaryEncoding () const |
const TTAMachine::Machine & | machine () const |
unsigned int | memoryAddress (const TTAProgram::Instruction &instruction) const |
TTAProgram::Program & | currentProgram () const |
int | imemMauWidth () const |
InstructionBitVector * | bemInstructionBits (const TTAProgram::Instruction &) |
Private Types | |
typedef std::map< BitVector, unsigned int > | Dictionary |
Map type for dictionary. | |
Private Member Functions | |
void | createDictionary () |
void | addToDictionary (const BitVector &instructionBits) |
void | updateDictionary (const Program &program) |
void | addInstructions () |
Private Attributes | |
Dictionary | dictionary_ |
The dictionary. | |
bool | compatibilityProgDone_ |
Indicates whether the compatibility program is in dictionary. | |
bool | dictionaryCreated_ |
Indicates whether the whole dictionary has been created. | |
Additional Inherited Members | |
![]() | |
typedef std::vector< Parameter > | ParameterTable |
Table for passing plugin parameters. | |
![]() | |
typedef std::map< std::string, TPEF::Binary * > | TPEFMap |
Map type for handling programs. | |
![]() | |
CodeCompressorPlugin () | |
InstructionBitVector * | bemBits (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 () |
InstructionBitVector * | programBits () const |
bool | hasParameter (const std::string ¶mName) const |
std::string | parameterValue (const std::string ¶mName) const |
void | setImemWidth (int mau, int widthInMaus=1) |
int | numberOfPrograms () const |
TPEFMap::const_iterator | programElement (int index) const |
std::string | indentation (int level) |
Implements a simple instruction based dictionary compression scheme.
Definition at line 78 of file InstructionDictionary.cc.
|
private |
Map type for dictionary.
Definition at line 251 of file InstructionDictionary.cc.
|
inline |
The constructor.
Definition at line 84 of file InstructionDictionary.cc.
|
inlineprivate |
Adds the compressed instructions to the program.
Definition at line 315 of file InstructionDictionary.cc.
References CodeCompressorPlugin::addInstruction(), CodeCompressorPlugin::bemBits(), CodeCompressorPlugin::bemInstructionBits(), CodeCompressorPlugin::currentProgram(), dictionary_, TTAProgram::Program::firstInstruction(), TTAProgram::NullInstruction::instance(), MapTools::keyForValue(), TTAProgram::Program::nextInstruction(), and MathTools::requiredBits().
Referenced by compress().
|
inlineprivate |
Adds the given instruction bits to the dictionary.
instructionBits | The instruction bits to add. |
Definition at line 287 of file InstructionDictionary.cc.
References MapTools::containsKey(), and dictionary_.
Referenced by updateDictionary().
|
inlinevirtual |
Creates the compressed code and returns the bit vector of it.
Implements CodeCompressorPlugin.
Definition at line 94 of file InstructionDictionary.cc.
References __func__, addInstructions(), assert, TTAProgram::TPEFProgramFactory::build(), compatibilityProgDone_, createDictionary(), dictionary_, dictionaryCreated_, ENSURE_PROGRAMMABILITY, Exception::errorMessage(), CodeCompressorPlugin::hasParameter(), CodeCompressorPlugin::machine(), CodeCompressorPlugin::parameterValue(), ProgrammabilityValidator::profile(), CodeCompressorPlugin::programBits(), MathTools::requiredBits(), CodeCompressorPlugin::setAllInstructionsToStartAtBeginningOfMAU(), CodeCompressorPlugin::setImemWidth(), CodeCompressorPlugin::startNewProgram(), updateDictionary(), and YES.
|
inlineprivate |
Creates the whole dictionary
Definition at line 258 of file InstructionDictionary.cc.
References CodeCompressorPlugin::binaryEncoding(), CodeCompressorPlugin::currentProgram(), dictionary_, dictionaryCreated_, Application::logStream(), CodeCompressorPlugin::numberOfPrograms(), CodeCompressorPlugin::programElement(), MathTools::requiredBits(), CodeCompressorPlugin::setAllInstructionsToStartAtBeginningOfMAU(), CodeCompressorPlugin::startNewProgram(), updateDictionary(), Application::verboseLevel(), and BinaryEncoding::width().
Referenced by compress().
|
inlinevirtual |
Generates the decompressor in VHDL.
Note! The programs must be compressed by compress method before calling this method.
stream | The stream to write. |
Implements CodeCompressorPlugin.
Definition at line 141 of file InstructionDictionary.cc.
References CodeCompressorPlugin::binaryEncoding(), dictionary_, CodeCompressorPlugin::indentation(), MapTools::keyForValue(), MathTools::requiredBits(), BinaryEncoding::width(), and AsciiImageWriter::writeImage().
|
inlinevirtual |
Prints the description of the plugin to the given stream.
stream | The stream. |
Implements CodeCompressorPlugin.
Definition at line 230 of file InstructionDictionary.cc.
|
inlineprivate |
Creates the dictionary.
Definition at line 300 of file InstructionDictionary.cc.
References addToDictionary(), CodeCompressorPlugin::bemInstructionBits(), TTAProgram::NullInstruction::instance(), and program.
Referenced by compress(), and createDictionary().
|
private |
Indicates whether the compatibility program is in dictionary.
Definition at line 337 of file InstructionDictionary.cc.
Referenced by compress().
|
private |
The dictionary.
Definition at line 335 of file InstructionDictionary.cc.
Referenced by addInstructions(), addToDictionary(), compress(), createDictionary(), and generateDecompressor().
|
private |
Indicates whether the whole dictionary has been created.
Definition at line 339 of file InstructionDictionary.cc.
Referenced by compress(), and createDictionary().