Definition at line 72 of file MoveSlotDictionary.cc.
◆ Dictionary
◆ MoveSlotDictionary()
MoveSlotDictionary::MoveSlotDictionary |
( |
| ) |
|
|
inline |
◆ ~MoveSlotDictionary()
MoveSlotDictionary::~MoveSlotDictionary |
( |
| ) |
|
|
inline |
◆ addInstructions()
void MoveSlotDictionary::addInstructions |
( |
| ) |
|
|
inlineprivate |
◆ addToDictionary()
void MoveSlotDictionary::addToDictionary |
( |
const BitVector & |
instructionBits, |
|
|
int |
slotIndex |
|
) |
| |
|
inlineprivate |
Adds the given instruction bits to the move slot dictionary.
- Parameters
-
instructionBits | The instruction bits to add. |
slotIndex | Index of the move slot |
Definition at line 207 of file MoveSlotDictionary.cc.
210 unsigned int code =
dictionary_.at(slotIndex)->size();
212 std::pair<BitVector, unsigned int>(instructionBits, code));
References MapTools::containsKey().
◆ compress()
◆ createDictionary()
void MoveSlotDictionary::createDictionary |
( |
| ) |
|
|
inlineprivate |
◆ evaluateMoveSlotBoundaries()
void MoveSlotDictionary::evaluateMoveSlotBoundaries |
( |
vector< pair< int, int > > & |
boundaries | ) |
|
|
inlineprivate |
Definition at line 424 of file MoveSlotDictionary.cc.
427 if (boundaries.size() == 0) {
431 temp = boundaries.at(boundaries.size()-1).second;
433 int begin = temp + 1;
435 boundaries.push_back(std::make_pair(begin,end));
References MathTools::requiredBits().
◆ generateDecompressor()
virtual void MoveSlotDictionary::generateDecompressor |
( |
std::ostream & |
stream, |
|
|
TCEString |
entityStr |
|
) |
| |
|
inlinevirtual |
Generates the decompressor in VHDL.
Note! The programs must be compressed by compress method before calling this method.
- Parameters
-
stream | The stream to write. |
Implements CodeCompressorPlugin.
Definition at line 131 of file MoveSlotDictionary.cc.
◆ generateDecompressorArchitecture()
void MoveSlotDictionary::generateDecompressorArchitecture |
( |
std::ostream & |
stream, |
|
|
TCEString |
entityStr |
|
) |
| |
|
inlineprivate |
Definition at line 340 of file MoveSlotDictionary.cc.
342 stream <<
"architecture move_slot_dict of " << entityStr
343 <<
"_decompressor is" << endl << endl;
345 bool haveLimm =
false;
350 stream <<
"end move_slot_dict;" << endl;
◆ generateDecompressorBody()
void MoveSlotDictionary::generateDecompressorBody |
( |
std::ostream & |
stream, |
|
|
bool & |
haveLimm |
|
) |
| |
|
inlineprivate |
Definition at line 391 of file MoveSlotDictionary.cc.
392 stream <<
indentation(1) <<
"begin" << endl << endl;
393 stream <<
indentation(1) <<
"glock <= lock;" << endl;
394 stream <<
indentation(1) <<
"fetch_en <= not lock_r;" << endl << endl;
400 <<
"limm_field <= fetchblock(fetchblock'length-1 downto "
401 <<
"fetchblock'length-" << limmEndIndex <<
");" << endl
405 vector<pair<int,int> > moveSlotBoundaries;
412 <<
" <= conv_integer(unsigned(fetchblock("
413 <<
"fetchblock'length-"
414 << moveSlotBoundaries.at(i).first
415 <<
" downto fetchblock'length-"
416 << moveSlotBoundaries.at(i).second
417 <<
")));" << endl << endl;
◆ generateDecompressorEntity()
void MoveSlotDictionary::generateDecompressorEntity |
( |
std::ostream & |
stream, |
|
|
TCEString |
entityStr |
|
) |
| |
|
inlineprivate |
Definition at line 314 of file MoveSlotDictionary.cc.
316 stream <<
"library ieee;" << endl;
317 stream <<
"use ieee.std_logic_1164.all;" << endl;
318 stream <<
"use ieee.std_logic_arith.all;" << endl;
319 stream <<
"use work." << entityStr <<
"_globals.all;" << endl;
320 stream <<
"use work." << entityStr <<
"_dict_init.all;" << endl;
321 stream <<
"use work." << entityStr <<
"_imem_mau.all;" << endl << endl;
323 stream <<
"entity " << entityStr <<
"_decompressor is" << endl;
325 stream <<
indentation(2) <<
"fetch_en : out std_logic;" << endl;
326 stream <<
indentation(2) <<
"lock : in std_logic;" << endl;
328 <<
"fetchblock : in std_logic_vector("
329 <<
"IMEMWIDTHINMAUS*IMEMMAUWIDTH-1 downto 0);" << endl;
331 <<
"instructionword : out std_logic_vector("
332 <<
"INSTRUCTIONWIDTH-1 downto 0);" << endl;
333 stream <<
indentation(2) <<
"glock : out std_logic;" << endl;
334 stream <<
indentation(2) <<
"lock_r : in std_logic;" << endl;
335 stream <<
indentation(2) <<
"clk : in std_logic;" << endl;
336 stream <<
indentation(2) <<
"rstx : in std_logic);" << endl << endl;
337 stream <<
"end " << entityStr <<
"_decompressor;" << endl << endl;
◆ generateDecompressorProcess()
void MoveSlotDictionary::generateDecompressorProcess |
( |
std::ostream & |
stream, |
|
|
bool & |
haveLimm |
|
) |
| |
|
inlineprivate |
Definition at line 439 of file MoveSlotDictionary.cc.
442 stream <<
"limm_field, ";
446 stream <<
"dict_line_" << i;
453 stream <<
")" << endl
457 stream <<
"limm_field&";
461 stream <<
"dict_" << i <<
"(dict_line_" << i <<
")";
463 stream <<
"dict_" << i;
469 stream <<
";" << endl
470 <<
indentation(1) <<
"end process;" << endl << endl;
◆ generateDecompressorSignals()
void MoveSlotDictionary::generateDecompressorSignals |
( |
std::ostream & |
stream, |
|
|
bool & |
haveLimm |
|
) |
| |
|
inlineprivate |
Definition at line 353 of file MoveSlotDictionary.cc.
358 <<
"subtype dict_index_"<< i
359 <<
" is integer range 0 to "
360 <<
"dict_init_slot_" << i
361 <<
"'length-1;" << endl;
363 <<
"signal dict_line_"
364 << i <<
" : dict_index_" << i <<
";" << endl;
366 <<
"constant dict_" << i
367 <<
" : std_logic_dict_matrix_"
368 << i <<
"(0 to dict_init_slot_" << i
369 <<
"'length-1) := dict_init_slot_"
370 << i <<
";" << endl << endl;
373 <<
"constant dict_" << i
374 <<
" : std_logic_vector("
376 <<
"-1 downto 0) := dict_init_slot_"
377 << i <<
";" << endl << endl;
381 int limmEndIndex = 0;
386 <<
"signal limm_field : std_logic_vector("
387 << limmEndIndex <<
"-1 downto 0);" << endl << endl;
◆ generateDictionaryVhdl()
void MoveSlotDictionary::generateDictionaryVhdl |
( |
std::ostream & |
stream, |
|
|
TCEString |
entityStr |
|
) |
| |
|
inlineprivate |
Definition at line 257 of file MoveSlotDictionary.cc.
258 stream <<
"library ieee;" << endl;
259 stream <<
"use ieee.std_logic_1164.all;" << endl;
260 stream <<
"use ieee.std_logic_arith.all;" << endl << endl;
262 TCEString packageName = entityStr +
"_dict_init";
264 stream <<
"package " << packageName <<
" is" << endl << endl;
269 <<
"type std_logic_dict_matrix_" << i
270 <<
" is array (natural range <>) "
272 <<
" downto 0);" << endl << endl;
280 <<
"constant dict_init_slot_" << i
281 <<
" : std_logic_dict_matrix_" << i <<
" := (" << endl;
282 for (
unsigned int j = 0; j <
dictionary_.at(i)->size(); j++) {
283 BitVector instr = MapTools::keyForValue<BitVector>(
287 writer.writeImage(stream);
290 stream <<
"," << endl;
292 stream <<
");" << endl;
297 unsigned int index = 0;
298 BitVector instr = MapTools::keyForValue<BitVector>(
302 <<
"constant dict_init_slot_" << i
303 <<
" : std_logic_vector("
306 writer.writeImage(stream);
307 stream <<
"\");" << endl;
311 stream <<
"end " << packageName <<
";" << endl << endl;
References AsciiImageWriter::writeImage().
◆ printDescription()
virtual void MoveSlotDictionary::printDescription |
( |
std::ostream & |
stream | ) |
|
|
inlinevirtual |
Prints the description of the plugin to the given stream.
- Parameters
-
Implements CodeCompressorPlugin.
Definition at line 143 of file MoveSlotDictionary.cc.
144 stream <<
"Generates the program image using move slot based "
145 <<
"dictionary compression." << endl << endl
146 <<
"Warning! This compressor works correctly only when "
147 <<
"there is one instruction per MAU in the final program "
148 <<
"image. That is, the MAU of the address space should be "
149 <<
"the same as the width of the compressed instructions or "
150 <<
"wider. Otherwise jump and call addresses are invalid in "
151 <<
"the code. This compressor creates the dictionary on the "
152 <<
"move slot level." << endl << endl;
◆ printDetails()
void MoveSlotDictionary::printDetails |
( |
| ) |
|
|
inlineprivate |
Definition at line 473 of file MoveSlotDictionary.cc.
474 int widthInBytes =
static_cast<int>(
478 << widthInBytes <<
" bytes)" << endl;
479 std::size_t totalSize = 0;
480 for (
unsigned int i = 0; i <
dictionary_.size(); i++) {
481 std::size_t index =
static_cast<std::size_t
>(i);
482 std::size_t keyWidth =
486 totalSize += entries * entrySize;
490 "dictionary width: %d bits, entries: %d, "
491 "dictionary size: %d bits (%d bytes)\n")
492 % index % keyWidth % entries % (entries * entrySize)
494 std::ceil(entries * entrySize / 8.0))).str();
498 "Total dictionary size: %d bits (%d bytes)\n\n")
500 % std::size_t(std::ceil(totalSize / 8.0))).str();
References Application::logStream(), and MathTools::requiredBits().
◆ updateDictionary()
void MoveSlotDictionary::updateDictionary |
( |
const Program & |
program | ) |
|
|
inlineprivate |
Creates dictionary for one program.
Definition at line 182 of file MoveSlotDictionary.cc.
184 while (instruction != &NullInstruction::instance()) {
188 unsigned int end = begin;
191 BitVector moveSlot(*instructionBits, begin, end);
195 instruction = &
program.nextInstruction(*instruction);
196 delete instructionBits;
References program.
◆ compressedWidth_
unsigned int MoveSlotDictionary::compressedWidth_ |
|
private |
◆ dictionary_
vector<Dictionary*> MoveSlotDictionary::dictionary_ |
|
private |
◆ dictionaryCreated_
bool MoveSlotDictionary::dictionaryCreated_ |
|
private |
The documentation for this class was generated from the following file:
vector< Dictionary * > dictionary_
The dictionary.
Instruction & firstInstruction() const
std::map< BitVector, unsigned int > Dictionary
Map type for dictionary.
InstructionBitVector * bemBits(const TTAProgram::Program &program)
Instruction & nextInstruction(const Instruction &) const
void generateDecompressorProcess(std::ostream &stream, bool &haveLimm)
static int verboseLevel()
int firstMoveSlotIndex() const
static std::ostream & logStream()
unsigned int compressedWidth_
Total width of compressed instruction (limm fields + move slots)
void addInstruction(const TTAProgram::Instruction &instruction, InstructionBitVector *bits)
void generateDecompressorEntity(std::ostream &stream, TCEString entityStr)
int numberOfPrograms() const
void updateDictionary(const Program &program)
void generateDecompressorBody(std::ostream &stream, bool &haveLimm)
void pushBack(long long unsigned int integer, int size)
InstructionBitVector * bemInstructionBits(const TTAProgram::Instruction &)
int moveSlotCount() const
virtual int width(const TCEString &templateName) const
void startNewProgram(const std::string &programName)
int moveSlotWidth(int index) const
void generateDecompressorArchitecture(std::ostream &stream, TCEString entityStr)
TTAProgram::Program & currentProgram() const
void generateDecompressorSignals(std::ostream &stream, bool &haveLimm)
TPEFMap::const_iterator programElement(int index) const
void addToDictionary(const BitVector &instructionBits, int slotIndex)
void generateDictionaryVhdl(std::ostream &stream, TCEString entityStr)
bool dictionaryCreated_
Indicates whether the dictionary has been created.
void evaluateMoveSlotBoundaries(vector< pair< int, int > > &boundaries)
void setAllInstructionsToStartAtBeginningOfMAU()
find Finds info of the inner loops in the program
const BinaryEncoding & binaryEncoding() const
std::string indentation(int level)
InstructionBitVector * programBits() const
void setImemWidth(int mau, int widthInMaus=1)