OpenASIP  2.0
Functions | Variables
GenerateBits.cc File Reference
#include <iostream>
#include <cmath>
#include <boost/format.hpp>
#include "PIGCmdLineOptions.hh"
#include "ProgramImageGenerator.hh"
#include "PIGCLITextGenerator.hh"
#include "ADFSerializer.hh"
#include "Machine.hh"
#include "ControlUnit.hh"
#include "BinaryEncoding.hh"
#include "BEMSerializer.hh"
#include "BEMGenerator.hh"
#include "Binary.hh"
#include "BinaryStream.hh"
#include "BinaryReader.hh"
#include "FileSystem.hh"
Include dependency graph for GenerateBits.cc:

Go to the source code of this file.

Functions

static BinaryloadTPEF (const std::string &tpefFile)
 
static BinaryEncodingloadBEM (const std::string &bemFile)
 
static MachineloadMachine (const std::string &adfFile)
 
static bool isInstructionMemory (const TTAMachine::AddressSpace &as)
 
std::string programImemImageFile (const std::string &tpefFile, const std::string &format)
 
std::string programDataImageFile (const std::string &tpefFile, const std::string &format, const std::string &asName)
 
void parseParameter (const std::string &param, std::string &paramName, std::string &paramValue)
 
void createMauPkg (int language, int imemMauWidth, string fileName, string entityNameStr)
 
void createCompressor (string fileName, ProgramImageGenerator &imageGenerator, string entityStr)
 
void copyImageToTb (const string &source, const string &progeDir, const string &newImage)
 
int main (int argc, char *argv[])
 

Variables

const int DEFAULT_IMEMWIDTH_IN_MAUS = 1
 
const string IMEM_MAU_PKG = "imem_mau_pkg.vhdl"
 
const string VER_IMEM_MAU_PKG = "imem_mau_pkg.vh"
 
const string DECOMPRESSOR_FILE = "idecompressor.vhdl"
 
const string TB_DIR = "tb"
 
const string DIR_SEP = FileSystem::DIRECTORY_SEPARATOR
 
const string TB_IMEM_FILE = "imem_init.img"
 
const string TB_DMEM_FILE = "dmem_init.img"
 

Detailed Description

Implementation of the main function of generatebits application.

Author
Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
Otto Esko 2009 (otto.esko-no.spam-tut.fi)
Pekka Jääskeläinen 2009 (pekka.jaaskelainen-no.spam-tut.fi)
Otto Esko 2010 (otto.esko-no.spam-tut.fi)
Pekka Jääskeläinen 2011
Vinogradov Viacheslav(added Verilog generating) 2012
Note
rating: red

Definition in file GenerateBits.cc.

Function Documentation

◆ copyImageToTb()

void copyImageToTb ( const string &  source,
const string &  progeDir,
const string &  newImage 
)

Definition at line 271 of file GenerateBits.cc.

274  {
275 
276  if (!progeDir.empty()) {
277  string tbDir = progeDir + DIR_SEP + TB_DIR;
278  string tbImage = tbDir + DIR_SEP + newImage;
279  if (FileSystem::fileIsDirectory(tbDir)
280  && (FileSystem::fileIsWritable(tbImage)
281  || FileSystem::fileIsCreatable(tbImage))) {
282  try {
283  FileSystem::copy(source, tbImage);
284  } catch (Exception& e) {
285  cerr << e.errorMessage() << endl;
286  }
287  }
288  }
289 }

References FileSystem::copy(), DIR_SEP, Exception::errorMessage(), FileSystem::fileIsCreatable(), FileSystem::fileIsDirectory(), FileSystem::fileIsWritable(), and TB_DIR.

Referenced by main().

Here is the call graph for this function:

◆ createCompressor()

void createCompressor ( string  fileName,
ProgramImageGenerator imageGenerator,
string  entityStr 
)

Definition at line 254 of file GenerateBits.cc.

256  {
257 
258  bool created = FileSystem::createFile(fileName);
259  if (!created) {
260  string errorMsg = "Unable to create file " +
261  fileName;
262  throw IOException(__FILE__, __LINE__, __func__, errorMsg);
263  }
264  std::ofstream decompressorStream(
265  fileName.c_str(), std::ofstream::out);
266  imageGenerator.generateDecompressor(decompressorStream, entityStr);
267  decompressorStream.close();
268 }

References __func__, FileSystem::createFile(), and ProgramImageGenerator::generateDecompressor().

Referenced by main().

Here is the call graph for this function:

◆ createMauPkg()

void createMauPkg ( int  language,
int  imemMauWidth,
string  fileName,
string  entityNameStr 
)

Definition at line 222 of file GenerateBits.cc.

223  {
224 
225  string indentation = " ";
226 
227  if (!FileSystem::fileExists(fileName)
228  && !FileSystem::createFile(fileName)) {
229  string errorMsg = "Unable to create file " + fileName;
230  throw IOException(__FILE__, __LINE__, __func__, errorMsg);
231  } else if (!FileSystem::fileIsWritable(fileName)) {
232  string errorMsg = "Unable to write to file " + fileName;
233  throw IOException(__FILE__, __LINE__, __func__, errorMsg);
234  }
235  std::ofstream stream(fileName.c_str());
236  string entityName = entityNameStr + "_imem_mau";
237  if(language==0){//vhdl
238  stream << "package " << entityName << " is" << endl
239  << indentation << "-- created by generatebits" << endl
240  << indentation << "constant IMEMMAUWIDTH : positive := "
241  << imemMauWidth << ";" << endl
242  << "end " << entityName << ";" << endl;
243  } else {
244  stream << "//package " << entityName << " is" << endl
245  << indentation << "// created by generatebits" << endl
246  << indentation << "parameter IMEMMAUWIDTH = "
247  << imemMauWidth << endl
248  << "//end " << entityName << ";" << endl;
249  }
250  stream.close();
251 }

References __func__, FileSystem::createFile(), FileSystem::fileExists(), and FileSystem::fileIsWritable().

Referenced by main().

Here is the call graph for this function:

◆ isInstructionMemory()

static bool isInstructionMemory ( const TTAMachine::AddressSpace as)
static

Tells whether the given address space is instruction memory.

Parameters
asThe address space.
Returns
True if the address space is instruction memory, otherwise false.

Definition at line 135 of file GenerateBits.cc.

135  {
136  Machine* mach = as.machine();
137  ControlUnit* gcu = mach->controlUnit();
138  if (gcu != NULL && gcu->addressSpace() == &as) {
139  return true;
140  } else {
141  return false;
142  }
143 }

References TTAMachine::FunctionUnit::addressSpace(), TTAMachine::Machine::controlUnit(), and TTAMachine::Component::machine().

Referenced by main().

Here is the call graph for this function:

◆ loadBEM()

static BinaryEncoding* loadBEM ( const std::string &  bemFile)
static

Loads the given BEM file and creates a BinaryEncoding instance from it.

Parameters
bemFileThe BEM file.
Returns
The newly created BinaryEncoding instance.
Exceptions
SerializerExceptionIf an error occurs while reading the file.
ObjectStateLoadingExceptionIf an error occurs while loading the state of BinaryEncoding instance.

Definition at line 106 of file GenerateBits.cc.

106  {
107  BEMSerializer serializer;
108  serializer.setSourceFile(bemFile);
109  return serializer.readBinaryEncoding();
110 }

References BEMSerializer::readBinaryEncoding(), and XMLSerializer::setSourceFile().

Referenced by main().

Here is the call graph for this function:

◆ loadMachine()

static Machine* loadMachine ( const std::string &  adfFile)
static

Loads the given ADF file and creates a Machine instance from it.

Parameters
adfFileThe ADF file.
Returns
The newly created Machine instance.
Exceptions
SerializerExceptionIf an error occurs while reading the file.
ObjectStateLoadingExceptionIf an error occurs while loading the state of Machine instance.

Definition at line 122 of file GenerateBits.cc.

122  {
123  ADFSerializer serializer;
124  serializer.setSourceFile(adfFile);
125  return serializer.readMachine();
126 }

References ADFSerializer::readMachine(), and XMLSerializer::setSourceFile().

Referenced by main().

Here is the call graph for this function:

◆ loadTPEF()

static Binary* loadTPEF ( const std::string &  tpefFile)
static

Loads the given TPEF file and creates a Binary instance from it.

Parameters
tpefFileThe TPEF file.
Returns
The newly created Binary instance.
Exceptions
InstanceNotFoundIf instance for reading wasn't found.
UnreachableStreamIf given file can't be read.
KeyAlreadyExistsKey was in use when trying to register object.
EndOfFileIf end of file were reached while it shouldn't.
OutOfRangeSome read value was out of range.
WrongSubclassSome class couldn't do what it was asked for.
UnexpectedValueIf there was unexpected value when reading.

Definition at line 89 of file GenerateBits.cc.

89  {
90  BinaryStream stream(tpefFile);
91  return BinaryReader::readBinary(stream);
92 }

References TPEF::BinaryReader::readBinary().

Referenced by main().

Here is the call graph for this function:

◆ main()

int main ( int  argc,
char *  argv[] 
)

The main function of generatebits application.

Definition at line 294 of file GenerateBits.cc.

294  {
295 
297  try {
298  options->parse(argv, argc);
299  } catch (ParserStopRequest) {
300  return EXIT_SUCCESS;
301  } catch (const IllegalCommandLine& exception) {
302  cerr << exception.errorMessage() << endl;
303  return EXIT_FAILURE;
304  }
305 
307 
308  string adfFile = "";
309  if (options->numberOfArguments() < 1) {
310  PIGCLITextGenerator textGen;
311  cerr << textGen.text(PIGCLITextGenerator::TXT_ADF_REQUIRED) << endl;
312  return EXIT_FAILURE;
313  } else if (options->numberOfArguments() > 1) {
314  PIGCLITextGenerator textGen;
315  cerr << textGen.text(PIGCLITextGenerator::TXT_ILLEGAL_ARGS) << endl;
316  return EXIT_FAILURE;
317  } else {
318  adfFile = options->argument(1);
319  }
320 
321  string bemFile = options->bemFile();
322  string piFormat = options->programImageOutputFormat();
323  string diFormat = options->dataImageOutputFormat();
324  int dmemMAUsPerLine = options->dataMemoryWidthInMAUs();
325  string compressor = options->compressorPlugin();
326  const bool useCompression = compressor != "";
327  bool generateDataImages = options->generateDataImages();
328  bool generateDecompressor = options->generateDecompressor();
329  bool showCompressors = options->showCompressors();
330  int imemMAUsPerLine = DEFAULT_IMEMWIDTH_IN_MAUS;
331  string progeOutputDir = options->progeOutputDirectory();
332 
333  TCEString entityStr = options->entityName();
334  if (entityStr == "")
335  entityStr = "tta0";
336 
337  if (showCompressors) {
338  std::vector<string> compressorFiles =
340  for (std::vector<string>::const_iterator iter =
341  compressorFiles.begin();
342  iter != compressorFiles.end(); iter++) {
343  try {
344  std::cout << "******************************************"
345  << "**********************" << endl;
346  std::cout << "Compressor file: " << *iter << endl;
347 
349  *iter, std::cout);
350  } catch (const Exception& e) {
351  cerr << "Error: " << e.errorMessage() << endl;
352  }
353  std::cout << std::endl;
354  }
355  return EXIT_SUCCESS;
356  }
357 
358  CodeCompressorPlugin::ParameterTable compressorParams;
359  for (int i = 0; i < options->compressorParameterCount(); i++) {
360  string param = options->compressorParameter(i);
361  string paramName;
362  string paramValue;
363  try {
364  parseParameter(param, paramName, paramValue);
365  } catch (const Exception& e) {
366  cerr << e.errorMessage() << endl;
367  return EXIT_FAILURE;
368  }
369  CodeCompressorPlugin::Parameter newParam = {paramName, paramValue};
370  compressorParams.push_back(newParam);
371  }
372 
373  if (adfFile == "" ||
374  (piFormat != "" && piFormat != "binary" && piFormat != "ascii" &&
375  piFormat != "array" && piFormat != "mif" && piFormat != "vhdl" &&
376  piFormat != "coe" && piFormat != "hex" && piFormat != "bin2n") ||
377  (diFormat != "" && diFormat != "binary" &&
378  diFormat != "ascii" && diFormat != "array" && diFormat != "mif" &&
379  diFormat != "vhdl" && diFormat != "coe" && diFormat != "hex" && diFormat != "bin2n")) {
380  options->printHelp();
381  return EXIT_FAILURE;
382  }
383 
384  std::vector<Binary*> tpefTable;
386  try {
387  Machine* mach = loadMachine(adfFile);
388 
389  for (int i = 0; i < options->tpefFileCount(); i++) {
390  string tpefFile = options->tpefFile(i);
391  Binary* tpef = loadTPEF(tpefFile);
392  tpefTable.push_back(tpef);
393  tpefMap[FileSystem::fileOfPath(tpefFile)] = tpef;
394  }
395 
396  BinaryEncoding* bem = NULL;
397 
398  if (bemFile != "") {
399  bem = loadBEM(bemFile);
400  } else {
401  PIGCLITextGenerator textGen;
402 #if 0
403  // useless error output as this happens 100% of the time,
404  // no-one hasn't wanted to customize BEMs yet
405  std::cerr
407  str() << std::endl;
408 #endif
409  BEMGenerator bemGenerator(*mach);
410  bem = bemGenerator.generate();
411  }
412 
413  ProgramImageGenerator imageGenerator;
414  if (useCompression) {
415  imageGenerator.loadCompressorPlugin(compressor);
416  }
417  imageGenerator.loadCompressorParameters(compressorParams);
418  imageGenerator.loadBEM(*bem);
419  imageGenerator.loadMachine(*mach);
420  imageGenerator.loadPrograms(tpefMap);
421  imageGenerator.setEntityName(entityStr);
422 
423  if (Application::verboseLevel() > 0) {
425  << (boost::format(
426  "uncompressed instruction width: %d bits (%d bytes)\n" )
427  % bem->width() % std::ceil(bem->width() / 8.0)).str();
428  }
429 
430  for (size_t i = 0; i < tpefTable.size(); i++) {
431 
432  Binary* program = tpefTable[i];
433  string tpefFile = FileSystem::fileOfPath(options->tpefFile(i));
434  string imageFile = programImemImageFile(tpefFile, piFormat);
435  ofstream piStream(imageFile.c_str());
436  if (piFormat == "binary") {
437  imageGenerator.generateProgramImage(
438  tpefFile, piStream, ProgramImageGenerator::BINARY);
439  } else if (piFormat == "array") {
440  imageGenerator.generateProgramImage(
441  tpefFile, piStream, ProgramImageGenerator::ARRAY,
442  imemMAUsPerLine);
443  } else if (piFormat == "mif") {
444  imageGenerator.generateProgramImage(
445  tpefFile, piStream, ProgramImageGenerator::MIF,
446  imemMAUsPerLine);
447  } else if (piFormat == "vhdl") {
448  imageGenerator.generateProgramImage(
449  tpefFile, piStream, ProgramImageGenerator::VHDL,
450  imemMAUsPerLine);
451  } else if (piFormat == "coe") {
452  imageGenerator.generateProgramImage(
453  tpefFile, piStream, ProgramImageGenerator::COE,
454  imemMAUsPerLine);
455  } else if (piFormat == "hex") {
456  imageGenerator.generateProgramImage(
457  tpefFile, piStream, ProgramImageGenerator::HEX,
458  imemMAUsPerLine);
459  } else if (piFormat == "bin2n") {
460  imageGenerator.generateProgramImage(
461  tpefFile, piStream, ProgramImageGenerator::BIN2N,
462  imemMAUsPerLine);
463  } else {
464  assert(piFormat == "ascii" || piFormat == "");
465  imageGenerator.generateProgramImage(
466  tpefFile, piStream, ProgramImageGenerator::ASCII,
467  imemMAUsPerLine);
468  }
469  piStream.close();
470 
471  if (piFormat == "ascii" || piFormat == "") {
472  copyImageToTb(imageFile, progeOutputDir, TB_IMEM_FILE);
473  }
474 
475  if (generateDataImages) {
477  mach->addressSpaceNavigator();
478  for (int i = 0; i < asNav.count(); i++) {
479  AddressSpace* as = asNav.item(i);
480  if (!isInstructionMemory(*as)) {
481  string fileName =
483  tpefFile, diFormat, as->name());
484  ofstream stream(fileName.c_str());
485  if (diFormat == "binary") {
486  imageGenerator.generateDataImage(
487  tpefFile, *program, as->name(), stream,
489  } else if (diFormat == "array") {
490  imageGenerator.generateDataImage(
491  tpefFile, *program, as->name(), stream,
493  dmemMAUsPerLine, true);
494  } else if (diFormat == "mif") {
495  imageGenerator.generateDataImage(
496  tpefFile, *program, as->name(), stream,
498  dmemMAUsPerLine, true);
499  } else if (diFormat == "vhdl") {
500  imageGenerator.generateDataImage(
501  tpefFile, *program, as->name(), stream,
503  dmemMAUsPerLine, true);
504  } else if (diFormat == "coe") {
505  imageGenerator.generateDataImage(
506  tpefFile, *program, as->name(), stream,
508  dmemMAUsPerLine, true);
509  } else if (diFormat == "hex") {
510  imageGenerator.generateDataImage(
511  tpefFile, *program, as->name(), stream,
513  dmemMAUsPerLine, true);
514  } else if (diFormat == "bin2n") {
515  imageGenerator.generateDataImage(
516  tpefFile, *program, as->name(), stream,
518  dmemMAUsPerLine, true);
519  } else {
520  assert(diFormat == "ascii" || diFormat == "");
521  imageGenerator.generateDataImage(
522  tpefFile, *program, as->name(), stream,
524  dmemMAUsPerLine, true);
525  }
526  stream.close();
527 
528  if (diFormat == "ascii" || piFormat == "") {
529  std::string dmemInitFile("dmem_");
530  dmemInitFile += as->name() + "_init.img";
532  fileName, progeOutputDir, dmemInitFile);
533  }
534  }
535  }
536  }
537  }
538 
539  if (generateDecompressor) {
540  string decomp = DECOMPRESSOR_FILE;
541  if (!progeOutputDir.empty()) {
542  string temp =
543  progeOutputDir + DIR_SEP + "gcu_ic" + DIR_SEP
545  if ( (FileSystem::fileExists(temp)
547  || FileSystem::fileIsCreatable(temp)) {
548  decomp = temp;
549  }
550  }
551  createCompressor(decomp, imageGenerator, entityStr);
552  }
553 
554  int compressedInstructionWidth = imageGenerator.imemMauWidth();
555  if (!progeOutputDir.empty()) {
556  string temp =
557  progeOutputDir + DIR_SEP + "vhdl" + DIR_SEP + entityStr +
558  "_" + IMEM_MAU_PKG;
559  if ( (FileSystem::fileExists(temp)
561  || FileSystem::fileIsCreatable(temp)) {
562  //vhdl
563  createMauPkg(0,compressedInstructionWidth, temp, entityStr);
564  }
565  temp =
566  progeOutputDir + DIR_SEP + "verilog" + DIR_SEP + entityStr +
567  "_" + VER_IMEM_MAU_PKG;
568  if ( (FileSystem::fileExists(temp)
570  || FileSystem::fileIsCreatable(temp)) {
571  //verilog
572  createMauPkg(1,compressedInstructionWidth, temp, entityStr);
573  }
574  } else {//if none exist generate in current folder for both HDLs
575  createMauPkg(0,compressedInstructionWidth, entityStr + "_" +
576  IMEM_MAU_PKG, entityStr); //vhdl
577  createMauPkg(1,compressedInstructionWidth,
578  entityStr + "_" + VER_IMEM_MAU_PKG, entityStr); //verilog
579  }
580 
581  for (std::vector<Binary*>::iterator iter = tpefTable.begin();
582  iter != tpefTable.end(); iter++) {
583  delete *iter;
584  }
585  delete mach;
586  delete bem;
587 
588  return EXIT_SUCCESS;
589 
590  } catch (const Exception& exception) {
591  cerr << exception.errorMessageStack() << endl;
592  return EXIT_FAILURE;
593  }
594 }

References TTAMachine::Machine::addressSpaceNavigator(), CmdLineParser::argument(), ProgramImageGenerator::ARRAY, ProgramImageGenerator::ASCII, assert, ProgramImageGenerator::availableCompressors(), ProgramImageGenerator::BIN2N, ProgramImageGenerator::BINARY, ProgramImageGenerator::COE, copyImageToTb(), TTAMachine::Machine::Navigator< ComponentType >::count(), createCompressor(), createMauPkg(), DECOMPRESSOR_FILE, DEFAULT_IMEMWIDTH_IN_MAUS, DIR_SEP, Exception::errorMessage(), Exception::errorMessageStack(), FileSystem::fileExists(), FileSystem::fileIsCreatable(), FileSystem::fileIsWritable(), FileSystem::fileOfPath(), BEMGenerator::generate(), ProgramImageGenerator::generateDataImage(), ProgramImageGenerator::generateProgramImage(), ProgramImageGenerator::HEX, IMEM_MAU_PKG, ProgramImageGenerator::imemMauWidth(), isInstructionMemory(), TTAMachine::Machine::Navigator< ComponentType >::item(), ProgramImageGenerator::loadBEM(), loadBEM(), ProgramImageGenerator::loadCompressorParameters(), ProgramImageGenerator::loadCompressorPlugin(), ProgramImageGenerator::loadMachine(), loadMachine(), ProgramImageGenerator::loadPrograms(), loadTPEF(), Application::logStream(), ProgramImageGenerator::MIF, TTAMachine::Component::name(), CmdLineParser::numberOfArguments(), options, CmdLineOptions::parse(), parseParameter(), ProgramImageGenerator::printCompressorDescription(), MachInfoCmdLineOptions::printHelp(), program, programDataImageFile(), programImemImageFile(), Application::setCmdLineOptions(), ProgramImageGenerator::setEntityName(), TB_IMEM_FILE, Texts::TextGenerator::text(), PIGCLITextGenerator::TXT_ADF_REQUIRED, PIGCLITextGenerator::TXT_GENERATING_BEM, PIGCLITextGenerator::TXT_ILLEGAL_ARGS, VER_IMEM_MAU_PKG, Application::verboseLevel(), ProgramImageGenerator::VHDL, and BinaryEncoding::width().

Here is the call graph for this function:

◆ parseParameter()

void parseParameter ( const std::string &  param,
std::string &  paramName,
std::string &  paramValue 
)

Parses the given parameter which has form 'paramname=paramvalue" to different strings.

Parameters
paramThe parameter.
paramNameParameter name is stored here.
paramValueParameter value is stored here.
Exceptions
InvalidDataIf the given parameter is not in the correct form.

Definition at line 207 of file GenerateBits.cc.

208  {
209  string::size_type separatorPos = param.find("=", 0);
210  if (separatorPos == string::npos) {
211  string errorMsg =
212  "Compressor parameters must be in form "
213  "'parametername=parametervalue'.";
214  throw InvalidData(__FILE__, __LINE__, __func__, errorMsg);
215  }
216 
217  paramName = param.substr(0, separatorPos);
218  paramValue = param.substr(separatorPos+1, param.length());
219 }

References __func__.

Referenced by main().

◆ programDataImageFile()

std::string programDataImageFile ( const std::string &  tpefFile,
const std::string &  format,
const std::string &  asName 
)

Returns the name of the program data image file for the given TPEF file.

Parameters
tpefFileName of the TPEF file.
formatThe image output format
asNameName of the address space the image belongs to.
Returns
Name of the program image file.

Definition at line 179 of file GenerateBits.cc.

182  {
183 
184  string imageFile = FileSystem::fileNameBody(tpefFile) + "_" + asName;
185  if (format == "mif") {
186  imageFile += ".mif";
187  } else if (format == "vhdl") {
188  imageFile += "_pkg.vhdl";
189  } else if (format == "coe") {
190  imageFile += ".coe";
191  } else {
192  imageFile += ".img";
193  }
194  return imageFile;
195 }

References FileSystem::fileNameBody().

Referenced by main().

Here is the call graph for this function:

◆ programImemImageFile()

std::string programImemImageFile ( const std::string &  tpefFile,
const std::string &  format 
)

Returns the name of the program's imem image file for the given TPEF file.

Parameters
tpefFileName of the TPEF file.
formatThe image output format
Returns
Name of the program image file.

Definition at line 154 of file GenerateBits.cc.

154  {
155 
156  string imageFile = FileSystem::fileNameBody(tpefFile);
157  if (format == "mif") {
158  // altera tools want .mif ending for MIF files
159  imageFile += ".mif";
160  } else if (format == "vhdl") {
161  imageFile += "_imem_pkg.vhdl";
162  } else if (format == "coe") {
163  imageFile += ".coe";
164  } else {
165  imageFile += ".img";
166  }
167  return imageFile;
168 }

References FileSystem::fileNameBody().

Referenced by main().

Here is the call graph for this function:

Variable Documentation

◆ DECOMPRESSOR_FILE

const string DECOMPRESSOR_FILE = "idecompressor.vhdl"

Definition at line 68 of file GenerateBits.cc.

Referenced by main().

◆ DEFAULT_IMEMWIDTH_IN_MAUS

const int DEFAULT_IMEMWIDTH_IN_MAUS = 1

Definition at line 65 of file GenerateBits.cc.

Referenced by main().

◆ DIR_SEP

const string DIR_SEP = FileSystem::DIRECTORY_SEPARATOR

Definition at line 71 of file GenerateBits.cc.

Referenced by copyImageToTb(), main(), and PluginTools::registerModule().

◆ IMEM_MAU_PKG

const string IMEM_MAU_PKG = "imem_mau_pkg.vhdl"

Definition at line 66 of file GenerateBits.cc.

Referenced by main().

◆ TB_DIR

const string TB_DIR = "tb"

Definition at line 70 of file GenerateBits.cc.

Referenced by copyImageToTb().

◆ TB_DMEM_FILE

const string TB_DMEM_FILE = "dmem_init.img"

Definition at line 73 of file GenerateBits.cc.

◆ TB_IMEM_FILE

const string TB_IMEM_FILE = "imem_init.img"

Definition at line 72 of file GenerateBits.cc.

Referenced by main().

◆ VER_IMEM_MAU_PKG

const string VER_IMEM_MAU_PKG = "imem_mau_pkg.vh"

Definition at line 67 of file GenerateBits.cc.

Referenced by main().

ProgramImageGenerator::generateProgramImage
void generateProgramImage(const std::string &programName, std::ostream &stream, OutputFormat format, int mausPerLine=0)
Definition: ProgramImageGenerator.cc:185
IMEM_MAU_PKG
const string IMEM_MAU_PKG
Definition: GenerateBits.cc:66
MachInfoCmdLineOptions::printHelp
virtual void printHelp() const
Definition: MachInfoCmdLineOptions.cc:89
BinaryEncoding
Definition: BinaryEncoding.hh:61
ProgramImageGenerator::availableCompressors
static std::vector< std::string > availableCompressors()
Definition: ProgramImageGenerator.cc:609
ProgramImageGenerator::loadBEM
void loadBEM(const BinaryEncoding &bem)
Definition: ProgramImageGenerator.cc:162
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
ParserStopRequest
Definition: Exception.hh:491
ProgramImageGenerator::loadCompressorParameters
void loadCompressorParameters(CodeCompressorPlugin::ParameterTable parameters)
Definition: ProgramImageGenerator.cc:127
DECOMPRESSOR_FILE
const string DECOMPRESSOR_FILE
Definition: GenerateBits.cc:68
XMLSerializer::setSourceFile
void setSourceFile(const std::string &fileName)
Definition: XMLSerializer.cc:115
TTAMachine::AddressSpace
Definition: AddressSpace.hh:51
CmdLineParser::numberOfArguments
virtual int numberOfArguments() const
TPEF::Binary
Definition: Binary.hh:49
ProgramImageGenerator::ASCII
@ ASCII
ASCII 1's and 0's.
Definition: ProgramImageGenerator.hh:73
programDataImageFile
std::string programDataImageFile(const std::string &tpefFile, const std::string &format, const std::string &asName)
Definition: GenerateBits.cc:179
TPEF::BinaryStream
Definition: BinaryStream.hh:59
CodeCompressorPlugin::Parameter
Parameter struct.
Definition: CodeCompressorPlugin.hh:88
createCompressor
void createCompressor(string fileName, ProgramImageGenerator &imageGenerator, string entityStr)
Definition: GenerateBits.cc:254
Application::setCmdLineOptions
static void setCmdLineOptions(CmdLineOptions *options_)
Definition: Application.cc:381
TB_IMEM_FILE
const string TB_IMEM_FILE
Definition: GenerateBits.cc:72
Application::verboseLevel
static int verboseLevel()
Definition: Application.hh:176
IllegalCommandLine
Definition: Exception.hh:438
TTAMachine::FunctionUnit::addressSpace
virtual AddressSpace * addressSpace() const
Definition: FunctionUnit.cc:580
createMauPkg
void createMauPkg(int language, int imemMauWidth, string fileName, string entityNameStr)
Definition: GenerateBits.cc:222
ProgramImageGenerator::loadPrograms
void loadPrograms(TPEFMap programs)
Definition: ProgramImageGenerator.cc:140
Application::logStream
static std::ostream & logStream()
Definition: Application.cc:155
TTAMachine::Machine::Navigator::count
int count() const
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
ProgramImageGenerator::loadCompressorPlugin
void loadCompressorPlugin(const std::string &fileName)
Definition: ProgramImageGenerator.cc:114
ProgramImageGenerator::printCompressorDescription
static void printCompressorDescription(const std::string &fileName, std::ostream &stream)
Definition: ProgramImageGenerator.cc:645
BEMSerializer
Definition: BEMSerializer.hh:43
loadTPEF
static Binary * loadTPEF(const std::string &tpefFile)
Definition: GenerateBits.cc:89
ProgramImageGenerator::MIF
@ MIF
MIF Memory Initialization File.
Definition: ProgramImageGenerator.hh:75
FileSystem::fileOfPath
static std::string fileOfPath(const std::string pathName)
Definition: FileSystem.cc:101
PIGCLITextGenerator
Definition: PIGCLITextGenerator.hh:41
ProgramImageGenerator::HEX
@ HEX
HEX memory initialization format.
Definition: ProgramImageGenerator.hh:78
FileSystem::fileIsCreatable
static bool fileIsCreatable(const std::string fileName)
Definition: FileSystem.cc:123
BEMGenerator
Definition: BEMGenerator.hh:61
ProgramImageGenerator::imemMauWidth
int imemMauWidth() const
Definition: ProgramImageGenerator.cc:739
assert
#define assert(condition)
Definition: Application.hh:86
CodeCompressorPlugin::ParameterTable
std::vector< Parameter > ParameterTable
Table for passing plugin parameters.
Definition: CodeCompressorPlugin.hh:94
ProgramImageGenerator::loadMachine
void loadMachine(const TTAMachine::Machine &machine)
Definition: ProgramImageGenerator.cc:151
ProgramImageGenerator::generateDataImage
void generateDataImage(const std::string &programName, TPEF::Binary &program, const std::string &addressSpace, std::ostream &stream, OutputFormat format, int mausPerLine, bool usePregeneratedImage)
Definition: ProgramImageGenerator.cc:404
FileSystem::fileIsDirectory
static bool fileIsDirectory(const std::string fileName)
PIGCLITextGenerator::TXT_ADF_REQUIRED
@ TXT_ADF_REQUIRED
Definition: PIGCLITextGenerator.hh:52
copyImageToTb
void copyImageToTb(const string &source, const string &progeDir, const string &newImage)
Definition: GenerateBits.cc:271
TTAMachine::Machine::controlUnit
virtual ControlUnit * controlUnit() const
Definition: Machine.cc:345
InvalidData
Definition: Exception.hh:149
FileSystem::fileIsWritable
static bool fileIsWritable(const std::string fileName)
ProgramImageGenerator::setEntityName
void setEntityName(const std::string &entity)
Definition: ProgramImageGenerator.cc:746
TTAMachine::ControlUnit
Definition: ControlUnit.hh:50
ADFSerializer
Definition: ADFSerializer.hh:49
BinaryEncoding::width
virtual int width(const TCEString &templateName) const
Definition: BinaryEncoding.cc:768
__func__
#define __func__
Definition: Application.hh:67
FileSystem::copy
static void copy(const std::string &source, const std::string &target)
Definition: FileSystem.cc:524
Exception::errorMessageStack
std::string errorMessageStack(bool messagesOnly=false) const
Definition: Exception.cc:138
ProgramImageGenerator
Definition: ProgramImageGenerator.hh:67
ProgramImageGenerator::VHDL
@ VHDL
Array as a Vhdl package.
Definition: ProgramImageGenerator.hh:76
Exception
Definition: Exception.hh:54
TTAMachine::Machine::addressSpaceNavigator
virtual AddressSpaceNavigator addressSpaceNavigator() const
Definition: Machine.cc:392
FileSystem::createFile
static bool createFile(const std::string &file)
Definition: FileSystem.cc:468
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
CmdLineOptions::parse
void parse(char *argv[], int argc)
Definition: CmdLineOptions.cc:107
loadBEM
static BinaryEncoding * loadBEM(const std::string &bemFile)
Definition: GenerateBits.cc:106
DIR_SEP
const string DIR_SEP
Definition: GenerateBits.cc:71
options
static MachInfoCmdLineOptions options
Definition: MachInfo.cc:46
ProgramImageGenerator::BINARY
@ BINARY
Real binary format.
Definition: ProgramImageGenerator.hh:72
DEFAULT_IMEMWIDTH_IN_MAUS
const int DEFAULT_IMEMWIDTH_IN_MAUS
Definition: GenerateBits.cc:65
FileSystem::fileExists
static bool fileExists(const std::string fileName)
PIGCLITextGenerator::TXT_GENERATING_BEM
@ TXT_GENERATING_BEM
Definition: PIGCLITextGenerator.hh:51
TTAMachine::Component::machine
virtual Machine * machine() const
TCEString
Definition: TCEString.hh:53
ProgramImageGenerator::generateDecompressor
void generateDecompressor(std::ostream &stream, TCEString entityStr)
Definition: ProgramImageGenerator.cc:592
parseParameter
void parseParameter(const std::string &param, std::string &paramName, std::string &paramValue)
Definition: GenerateBits.cc:207
loadMachine
static Machine * loadMachine(const std::string &adfFile)
Definition: GenerateBits.cc:122
TB_DIR
const string TB_DIR
Definition: GenerateBits.cc:70
ProgramImageGenerator::BIN2N
@ BIN2N
Binary format padded to 2**n.
Definition: ProgramImageGenerator.hh:79
ADFSerializer::readMachine
TTAMachine::Machine * readMachine()
Definition: ADFSerializer.cc:275
PIGCLITextGenerator::TXT_ILLEGAL_ARGS
@ TXT_ILLEGAL_ARGS
Definition: PIGCLITextGenerator.hh:53
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
program
find Finds info of the inner loops in the program
Definition: InnerLoopFinder.cc:80
IOException
Definition: Exception.hh:130
isInstructionMemory
static bool isInstructionMemory(const TTAMachine::AddressSpace &as)
Definition: GenerateBits.cc:135
VER_IMEM_MAU_PKG
const string VER_IMEM_MAU_PKG
Definition: GenerateBits.cc:67
FileSystem::fileNameBody
static std::string fileNameBody(const std::string &fileName)
Definition: FileSystem.cc:291
CmdLineParser::argument
virtual std::string argument(int index) const
ProgramImageGenerator::COE
@ COE
COE memory initialization format.
Definition: ProgramImageGenerator.hh:77
ProgramImageGenerator::ARRAY
@ ARRAY
ASCII 1's and 0's in array form.
Definition: ProgramImageGenerator.hh:74
TTAMachine::Machine::Navigator
Definition: Machine.hh:186
ProgramImageGenerator::TPEFMap
std::map< std::string, TPEF::Binary * > TPEFMap
Definition: ProgramImageGenerator.hh:81
PIGCmdLineOptions
Definition: PIGCmdLineOptions.hh:41
programImemImageFile
std::string programImemImageFile(const std::string &tpefFile, const std::string &format)
Definition: GenerateBits.cc:154
TTAMachine::Machine
Definition: Machine.hh:73
BEMSerializer::readBinaryEncoding
BinaryEncoding * readBinaryEncoding()
Definition: BEMSerializer.cc:258