OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
MoveSlotDictionary Class Reference
Inheritance diagram for MoveSlotDictionary:
Inheritance graph
Collaboration diagram for MoveSlotDictionary:
Collaboration graph

Public Member Functions

 MoveSlotDictionary ()
 
 ~MoveSlotDictionary ()
 
virtual InstructionBitVectorcompress (const string &programName)
 
virtual void generateDecompressor (std::ostream &stream, TCEString entityStr)
 
virtual void printDescription (std::ostream &stream)
 
- 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 &)
 

Private Types

typedef std::map< BitVector, unsigned int > Dictionary
 Map type for dictionary.
 

Private Member Functions

void createDictionary ()
 
void updateDictionary (const Program &program)
 
void addToDictionary (const BitVector &instructionBits, int slotIndex)
 
void addInstructions ()
 
void generateDictionaryVhdl (std::ostream &stream, TCEString entityStr)
 
void generateDecompressorEntity (std::ostream &stream, TCEString entityStr)
 
void generateDecompressorArchitecture (std::ostream &stream, TCEString entityStr)
 
void generateDecompressorSignals (std::ostream &stream, bool &haveLimm)
 
void generateDecompressorBody (std::ostream &stream, bool &haveLimm)
 
void evaluateMoveSlotBoundaries (vector< pair< int, int > > &boundaries)
 
void generateDecompressorProcess (std::ostream &stream, bool &haveLimm)
 
void printDetails ()
 

Private Attributes

vector< Dictionary * > dictionary_
 The dictionary.
 
bool dictionaryCreated_
 Indicates whether the dictionary has been created.
 
unsigned int compressedWidth_
 Total width of compressed instruction (limm fields + move slots)
 

Additional Inherited Members

- Public Types inherited from CodeCompressorPlugin
typedef std::vector< ParameterParameterTable
 Table for passing plugin parameters.
 
- Protected Types inherited from CodeCompressorPlugin
typedef std::map< std::string, TPEF::Binary * > TPEFMap
 Map type for handling programs.
 
- 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 72 of file MoveSlotDictionary.cc.

Member Typedef Documentation

◆ Dictionary

typedef std::map<BitVector, unsigned int> MoveSlotDictionary::Dictionary
private

Map type for dictionary.

Definition at line 504 of file MoveSlotDictionary.cc.

Constructor & Destructor Documentation

◆ MoveSlotDictionary()

MoveSlotDictionary::MoveSlotDictionary ( )
inline

The constructor

Definition at line 78 of file MoveSlotDictionary.cc.

80 }
unsigned int compressedWidth_
Total width of compressed instruction (limm fields + move slots)
bool dictionaryCreated_
Indicates whether the dictionary has been created.

◆ ~MoveSlotDictionary()

MoveSlotDictionary::~MoveSlotDictionary ( )
inline

The destructor

Definition at line 85 of file MoveSlotDictionary.cc.

85 {
86 for (unsigned int i = 0; i < dictionary_.size(); i++) {
87 if (dictionary_.at(i) != NULL) {
88 delete dictionary_.at(i);
89 }
90 }
91 }
vector< Dictionary * > dictionary_
The dictionary.

References dictionary_.

Member Function Documentation

◆ addInstructions()

void MoveSlotDictionary::addInstructions ( )
inlineprivate

Adds the compressed instructions to the program.

Definition at line 220 of file MoveSlotDictionary.cc.

220 {
221 Instruction* instruction = &currentProgram().firstInstruction();
222 while (instruction != &NullInstruction::instance()) {
224 InstructionBitVector* compressedInstruction =
226 // Take a BitVector pointer to the compressed instruction because
227 // we _need_ to use BitVector pushBack-methods!
228 BitVector* compressPtr =
229 static_cast<BitVector*>(compressedInstruction);
230
231 // handle limm fields, if any
232 if (firstMoveSlotIndex() != 0) {
233 for (int i = 0; i < firstMoveSlotIndex(); i++) {
234 // false is defined as 0, true is then != 0
235 compressPtr->pushBack(bemBits->at(i) != 0);
236 }
237 }
238 unsigned int begin = firstMoveSlotIndex();
239 unsigned int end = begin;
240 for (int i = 0; i < moveSlotCount(); i++) {
241 end = begin + moveSlotWidth(i)-1;
242 BitVector moveSlot(*bemBits, begin, end);
243 unsigned int code = MapTools::valueForKey<unsigned int>(
244 *(dictionary_.at(i)), moveSlot);
245 // add move slot key to compressed instruction
246 compressPtr->pushBack(
247 code, MathTools::requiredBits(dictionary_.at(i)->size()));
248
249 begin = end + 1;
250 }
251 addInstruction(*instruction, compressedInstruction);
252 instruction = &currentProgram().nextInstruction(*instruction);
253 delete bemBits;
254 }
255 }
void pushBack(long long unsigned int integer, int size)
Definition BitVector.cc:94
InstructionBitVector * bemBits(const TTAProgram::Program &program)
int moveSlotWidth(int index) const
void addInstruction(const TTAProgram::Instruction &instruction, InstructionBitVector *bits)
TTAProgram::Program & currentProgram() const
InstructionBitVector * bemInstructionBits(const TTAProgram::Instruction &)
static KeyType keyForValue(const MapType &aMap, const ValueType &aValue)
static int requiredBits(unsigned long int number)
Instruction & nextInstruction(const Instruction &) const
Definition Program.cc:403
Instruction & firstInstruction() const
Definition Program.cc:353

References CodeCompressorPlugin::addInstruction(), CodeCompressorPlugin::bemBits(), CodeCompressorPlugin::bemInstructionBits(), CodeCompressorPlugin::currentProgram(), dictionary_, TTAProgram::Program::firstInstruction(), CodeCompressorPlugin::firstMoveSlotIndex(), MapTools::keyForValue(), CodeCompressorPlugin::moveSlotCount(), CodeCompressorPlugin::moveSlotWidth(), TTAProgram::Program::nextInstruction(), BitVector::pushBack(), and MathTools::requiredBits().

Referenced by compress().

Here is the call graph for this function:

◆ addToDictionary()

void MoveSlotDictionary::addToDictionary ( const BitVector instructionBits,
int  slotIndex 
)
inlineprivate

Adds the given instruction bits to the move slot dictionary.

Parameters
instructionBitsThe instruction bits to add.
slotIndexIndex of the move slot

Definition at line 207 of file MoveSlotDictionary.cc.

207 {
209 *(dictionary_.at(slotIndex)), instructionBits)) {
210 unsigned int code = dictionary_.at(slotIndex)->size();
211 dictionary_.at(slotIndex)->insert(
212 std::pair<BitVector, unsigned int>(instructionBits, code));
213 }
214 }
static bool containsKey(const MapType &aMap, const KeyType &aKey)

References MapTools::containsKey(), and dictionary_.

Referenced by updateDictionary().

Here is the call graph for this function:

◆ compress()

virtual InstructionBitVector * MoveSlotDictionary::compress ( const string &  programName)
inlinevirtual

Creates compressed code of the program and returns it in bit vector

Implements CodeCompressorPlugin.

Definition at line 97 of file MoveSlotDictionary.cc.

97 {
98 if (!dictionaryCreated_) {
100 // fix imem width (mau == instruction width)
101 int imemWidth = 0;
102 for (unsigned int i = 0; i < dictionary_.size(); i++) {
103 // add dictionary sizes
104 imemWidth +=
106 }
107 // add limm fields, if any
108 imemWidth += firstMoveSlotIndex();
109 compressedWidth_ = imemWidth;
111
112 if (Application::verboseLevel() > 0 && dictionary_.size() > 0) {
113 printDetails();
114 }
115 }
116 startNewProgram(programName);
119 return programBits();
120 }
static int verboseLevel()
void setImemWidth(int mau, int widthInMaus=1)
void startNewProgram(const std::string &programName)
InstructionBitVector * programBits() const

References addInstructions(), compressedWidth_, createDictionary(), dictionary_, dictionaryCreated_, CodeCompressorPlugin::firstMoveSlotIndex(), printDetails(), CodeCompressorPlugin::programBits(), MathTools::requiredBits(), CodeCompressorPlugin::setAllInstructionsToStartAtBeginningOfMAU(), CodeCompressorPlugin::setImemWidth(), CodeCompressorPlugin::startNewProgram(), and Application::verboseLevel().

Here is the call graph for this function:

◆ createDictionary()

void MoveSlotDictionary::createDictionary ( )
inlineprivate

Creates the whole dictionary

Definition at line 162 of file MoveSlotDictionary.cc.

162 {
163 for (int i = 0; i < moveSlotCount(); i++) {
164 dictionary_.push_back(new Dictionary);
165 }
166
167 for (int i = 0; i < numberOfPrograms(); i++) {
168 TPEFMap::const_iterator iter = programElement(i);
169 string name = iter->first;
170 startNewProgram(name);
173 }
174
175 dictionaryCreated_ = true;
176 }
TPEFMap::const_iterator programElement(int index) const
void updateDictionary(const Program &program)
std::map< BitVector, unsigned int > Dictionary
Map type for dictionary.

References CodeCompressorPlugin::currentProgram(), dictionary_, dictionaryCreated_, CodeCompressorPlugin::moveSlotCount(), CodeCompressorPlugin::numberOfPrograms(), CodeCompressorPlugin::programElement(), CodeCompressorPlugin::setAllInstructionsToStartAtBeginningOfMAU(), CodeCompressorPlugin::startNewProgram(), and updateDictionary().

Referenced by compress().

Here is the call graph for this function:

◆ evaluateMoveSlotBoundaries()

void MoveSlotDictionary::evaluateMoveSlotBoundaries ( vector< pair< int, int > > &  boundaries)
inlineprivate

Definition at line 424 of file MoveSlotDictionary.cc.

424 {
425 for (int i = 0; i < moveSlotCount(); i++) {
426 int temp = 0;
427 if (boundaries.size() == 0) {
428 temp = firstMoveSlotIndex();
429 } else {
430 // end point of previous boundary
431 temp = boundaries.at(boundaries.size()-1).second;
432 }
433 int begin = temp + 1;
434 int end = temp + MathTools::requiredBits(dictionary_.at(i)->size());
435 boundaries.push_back(std::make_pair(begin,end));
436 }
437 }

References dictionary_, CodeCompressorPlugin::firstMoveSlotIndex(), CodeCompressorPlugin::moveSlotCount(), and MathTools::requiredBits().

Referenced by generateDecompressorBody().

Here is the call graph for this function:

◆ 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
streamThe stream to write.

Implements CodeCompressorPlugin.

Definition at line 131 of file MoveSlotDictionary.cc.

131 {
132 generateDictionaryVhdl(stream, entityStr);
133 generateDecompressorEntity(stream, entityStr);
134 generateDecompressorArchitecture(stream, entityStr);
135 }
void generateDecompressorArchitecture(std::ostream &stream, TCEString entityStr)
void generateDecompressorEntity(std::ostream &stream, TCEString entityStr)
void generateDictionaryVhdl(std::ostream &stream, TCEString entityStr)

References generateDecompressorArchitecture(), generateDecompressorEntity(), and generateDictionaryVhdl().

Here is the call graph for this function:

◆ generateDecompressorArchitecture()

void MoveSlotDictionary::generateDecompressorArchitecture ( std::ostream &  stream,
TCEString  entityStr 
)
inlineprivate

Definition at line 340 of file MoveSlotDictionary.cc.

341 {
342 stream << "architecture move_slot_dict of " << entityStr
343 << "_decompressor is" << endl << endl;
344
345 bool haveLimm = false;
346 generateDecompressorSignals(stream,haveLimm);
347
348 generateDecompressorBody(stream, haveLimm);
349
350 stream << "end move_slot_dict;" << endl;
351 }
void generateDecompressorSignals(std::ostream &stream, bool &haveLimm)
void generateDecompressorBody(std::ostream &stream, bool &haveLimm)

References generateDecompressorBody(), and generateDecompressorSignals().

Referenced by generateDecompressor().

Here is the call graph for this function:

◆ generateDecompressorBody()

void MoveSlotDictionary::generateDecompressorBody ( std::ostream &  stream,
bool &  haveLimm 
)
inlineprivate

Definition at line 391 of file MoveSlotDictionary.cc.

391 {
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;
395
396
397 if (haveLimm) {
398 int limmEndIndex = firstMoveSlotIndex();
399 stream << indentation(1)
400 << "limm_field <= fetchblock(fetchblock'length-1 downto "
401 << "fetchblock'length-" << limmEndIndex << ");" << endl
402 << endl;
403 }
404 // pair<beginIndex,endIndex>
405 vector<pair<int,int> > moveSlotBoundaries;
406 evaluateMoveSlotBoundaries(moveSlotBoundaries);
407
408 for (int i = 0; i < moveSlotCount(); i++) {
409 if (dictionary_.at(i)->size() > 1) {
410 stream << indentation(1)
411 << "dict_line_" << i
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;
418 }
419 }
420
421 generateDecompressorProcess(stream, haveLimm);
422 }
std::string indentation(int level)
void evaluateMoveSlotBoundaries(vector< pair< int, int > > &boundaries)
void generateDecompressorProcess(std::ostream &stream, bool &haveLimm)

References dictionary_, evaluateMoveSlotBoundaries(), CodeCompressorPlugin::firstMoveSlotIndex(), generateDecompressorProcess(), CodeCompressorPlugin::indentation(), and CodeCompressorPlugin::moveSlotCount().

Referenced by generateDecompressorArchitecture().

Here is the call graph for this function:

◆ generateDecompressorEntity()

void MoveSlotDictionary::generateDecompressorEntity ( std::ostream &  stream,
TCEString  entityStr 
)
inlineprivate

Definition at line 314 of file MoveSlotDictionary.cc.

314 {
315 // write the decompressor entity
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;
322
323 stream << "entity " << entityStr << "_decompressor is" << endl;
324 stream << indentation(1) << "port (" << endl;
325 stream << indentation(2) << "fetch_en : out std_logic;" << endl;
326 stream << indentation(2) << "lock : in std_logic;" << endl;
327 stream << indentation(2)
328 << "fetchblock : in std_logic_vector("
329 << "IMEMWIDTHINMAUS*IMEMMAUWIDTH-1 downto 0);" << endl;
330 stream << indentation(2)
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;
338 }

References CodeCompressorPlugin::indentation().

Referenced by generateDecompressor().

Here is the call graph for this function:

◆ generateDecompressorProcess()

void MoveSlotDictionary::generateDecompressorProcess ( std::ostream &  stream,
bool &  haveLimm 
)
inlineprivate

Definition at line 439 of file MoveSlotDictionary.cc.

439 {
440 stream << indentation(1) << "process (";
441 if (haveLimm) {
442 stream << "limm_field, ";
443 }
444 for (int i = 0; i < moveSlotCount(); i++) {
445 if (dictionary_.at(i)->size() > 1) {
446 stream << "dict_line_" << i;
447 if (i+1 < moveSlotCount()
448 && dictionary_.at(i+1)->size() > 1) {
449 stream << ", ";
450 }
451 }
452 }
453 stream << ")" << endl
454 << indentation(1) << "begin" << endl
455 << indentation(2) << "instructionword <= ";
456 if (haveLimm) {
457 stream << "limm_field&";
458 }
459 for (int i = 0; i < moveSlotCount(); i++) {
460 if (dictionary_.at(i)->size() > 1) {
461 stream << "dict_" << i <<"(dict_line_" << i << ")";
462 } else {
463 stream << "dict_" << i;
464 }
465 if (i+1 < moveSlotCount()) {
466 stream << "&";
467 }
468 }
469 stream << ";" << endl
470 << indentation(1) << "end process;" << endl << endl;
471 }

References dictionary_, CodeCompressorPlugin::indentation(), and CodeCompressorPlugin::moveSlotCount().

Referenced by generateDecompressorBody().

Here is the call graph for this function:

◆ generateDecompressorSignals()

void MoveSlotDictionary::generateDecompressorSignals ( std::ostream &  stream,
bool &  haveLimm 
)
inlineprivate

Definition at line 353 of file MoveSlotDictionary.cc.

353 {
354 // signal types & signals for dictionaries
355 for (int i = 0; i < moveSlotCount(); i++) {
356 if (dictionary_.at(i)->size() > 1) {
357 stream << indentation(1)
358 << "subtype dict_index_"<< i
359 <<" is integer range 0 to "
360 << "dict_init_slot_" << i
361 << "'length-1;" << endl;
362 stream << indentation(1)
363 << "signal dict_line_"
364 << i <<" : dict_index_" << i << ";" << endl;
365 stream << indentation(1)
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;
371 } else {
372 stream << indentation(1)
373 << "constant dict_" << i
374 << " : std_logic_vector("
375 << moveSlotWidth(i)
376 << "-1 downto 0) := dict_init_slot_"
377 << i << ";" << endl << endl;
378 }
379 }
380 // handle limm fields if present
381 int limmEndIndex = 0;
382 if (firstMoveSlotIndex() != 0) {
383 haveLimm = true;
384 limmEndIndex = firstMoveSlotIndex();
385 stream << indentation(1)
386 << "signal limm_field : std_logic_vector("
387 << limmEndIndex << "-1 downto 0);" << endl << endl;
388 }
389 }

References dictionary_, CodeCompressorPlugin::firstMoveSlotIndex(), CodeCompressorPlugin::indentation(), CodeCompressorPlugin::moveSlotCount(), and CodeCompressorPlugin::moveSlotWidth().

Referenced by generateDecompressorArchitecture().

Here is the call graph for this function:

◆ generateDictionaryVhdl()

void MoveSlotDictionary::generateDictionaryVhdl ( std::ostream &  stream,
TCEString  entityStr 
)
inlineprivate

Definition at line 257 of file MoveSlotDictionary.cc.

257 {
258 stream << "library ieee;" << endl;
259 stream << "use ieee.std_logic_1164.all;" << endl;
260 stream << "use ieee.std_logic_arith.all;" << endl << endl;
261
262 TCEString packageName = entityStr + "_dict_init";
263
264 stream << "package " << packageName << " is" << endl << endl;
265
266 for (int i = 0; i < moveSlotCount(); i++) {
267 if (dictionary_.at(i)->size() > 1) {
268 stream << indentation(1)
269 << "type std_logic_dict_matrix_" << i
270 << " is array (natural range <>) "
271 << "of std_logic_vector(" << moveSlotWidth(i)-1
272 << " downto 0);" << endl << endl;
273 }
274 }
275
276 // write the dictionary contents
277 for (int i = 0; i < moveSlotCount(); i++) {
278 if (dictionary_.at(i)->size() > 1) {
279 stream << indentation(1)
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++) {
284 *(dictionary_.at(i)), j);
285 AsciiImageWriter writer(instr, instr.size());
286 stream << indentation(2) << "\"";
287 writer.writeImage(stream);
288 stream << "\"";
289 if (j+1 < dictionary_.at(i)->size()) {
290 stream << "," << endl;
291 } else {
292 stream << ");" << endl;
293 }
294 }
295 } else {
296 // there's always at least 1 instruction in dictionary
297 unsigned int index = 0;
299 *(dictionary_.at(i)), index);
300 AsciiImageWriter writer(instr, instr.size());
301 stream << indentation(1)
302 << "constant dict_init_slot_" << i
303 << " : std_logic_vector("
304 << moveSlotWidth(i) << "-1 downto 0) := (" << endl
305 << indentation(2) << "\"";
306 writer.writeImage(stream);
307 stream << "\");" << endl;
308 }
309 stream << endl;
310 }
311 stream << "end " << packageName << ";" << endl << endl;
312 }

References dictionary_, CodeCompressorPlugin::indentation(), MapTools::keyForValue(), CodeCompressorPlugin::moveSlotCount(), CodeCompressorPlugin::moveSlotWidth(), and AsciiImageWriter::writeImage().

Referenced by generateDecompressor().

Here is the call graph for this function:

◆ printDescription()

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

Prints the description of the plugin to the given stream.

Parameters
streamThe stream.

Implements CodeCompressorPlugin.

Definition at line 143 of file MoveSlotDictionary.cc.

143 {
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;
153 }

◆ printDetails()

void MoveSlotDictionary::printDetails ( )
inlineprivate

Definition at line 473 of file MoveSlotDictionary.cc.

473 {
474 int widthInBytes = static_cast<int>(
475 std::ceil(compressedWidth_ / 8.0));
476 Application::logStream() << "compressed instruction width: "
477 << compressedWidth_ << " ("
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 =
484 std::size_t entrySize = binaryEncoding().width();
485 std::size_t entries = dictionary_.at(i)->size();
486 totalSize += entries * entrySize;
488 << (boost::format(
489 "Dictionary %d:\n"
490 "dictionary width: %d bits, entries: %d, "
491 "dictionary size: %d bits (%d bytes)\n")
492 % index % keyWidth % entries % (entries * entrySize)
493 % std::size_t(
494 std::ceil(entries * entrySize / 8.0))).str();
495 }
497 << (boost::format(
498 "Total dictionary size: %d bits (%d bytes)\n\n")
499 % totalSize
500 % std::size_t(std::ceil(totalSize / 8.0))).str();
501 }
static std::ostream & logStream()
virtual int width(const TCEString &templateName) const
const BinaryEncoding & binaryEncoding() const

References CodeCompressorPlugin::binaryEncoding(), compressedWidth_, dictionary_, Application::logStream(), MathTools::requiredBits(), and BinaryEncoding::width().

Referenced by compress().

Here is the call graph for this function:

◆ updateDictionary()

void MoveSlotDictionary::updateDictionary ( const Program program)
inlineprivate

Creates dictionary for one program.

Definition at line 182 of file MoveSlotDictionary.cc.

182 {
183 Instruction* instruction = &program.firstInstruction();
184 while (instruction != &NullInstruction::instance()) {
185 InstructionBitVector* instructionBits = bemInstructionBits(
186 *instruction);
187 unsigned int begin = firstMoveSlotIndex();
188 unsigned int end = begin;
189 for (int i = 0; i < moveSlotCount(); i++) {
190 end = begin + moveSlotWidth(i) - 1;
191 BitVector moveSlot(*instructionBits, begin, end);
192 addToDictionary(moveSlot, i);
193 begin = end + 1;
194 }
195 instruction = &program.nextInstruction(*instruction);
196 delete instructionBits;
197 }
198 }
find Finds info of the inner loops in the program
void addToDictionary(const BitVector &instructionBits, int slotIndex)

References addToDictionary(), CodeCompressorPlugin::bemInstructionBits(), CodeCompressorPlugin::firstMoveSlotIndex(), CodeCompressorPlugin::moveSlotCount(), CodeCompressorPlugin::moveSlotWidth(), and program.

Referenced by createDictionary().

Here is the call graph for this function:

Member Data Documentation

◆ compressedWidth_

unsigned int MoveSlotDictionary::compressedWidth_
private

Total width of compressed instruction (limm fields + move slots)

Definition at line 513 of file MoveSlotDictionary.cc.

Referenced by compress(), and printDetails().

◆ dictionary_

vector<Dictionary*> MoveSlotDictionary::dictionary_
private

◆ dictionaryCreated_

bool MoveSlotDictionary::dictionaryCreated_
private

Indicates whether the dictionary has been created.

Definition at line 510 of file MoveSlotDictionary.cc.

Referenced by compress(), and createDictionary().


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