OpenASIP  2.0
GenerateBits.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2011 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file GenerateBits.cc
26  *
27  * Implementation of the main function of generatebits application.
28  *
29  * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30  * @author Otto Esko 2009 (otto.esko-no.spam-tut.fi)
31  * @author Pekka Jääskeläinen 2009 (pekka.jaaskelainen-no.spam-tut.fi)
32  * @author Otto Esko 2010 (otto.esko-no.spam-tut.fi)
33  * @author Pekka Jääskeläinen 2011
34  * @author Vinogradov Viacheslav(added Verilog generating) 2012
35  * @note rating: red
36  */
37 
38 #include <iostream>
39 #include <cmath>
40 
41 #include <boost/format.hpp>
42 
43 #include "PIGCmdLineOptions.hh"
44 #include "ProgramImageGenerator.hh"
45 #include "PIGCLITextGenerator.hh"
46 #include "ADFSerializer.hh"
47 #include "Machine.hh"
48 #include "ControlUnit.hh"
49 #include "BinaryEncoding.hh"
50 #include "BEMSerializer.hh"
51 #include "BEMGenerator.hh"
52 #include "Binary.hh"
53 #include "BinaryStream.hh"
54 #include "BinaryReader.hh"
55 #include "FileSystem.hh"
56 
57 using std::cerr;
58 using std::endl;
59 using std::string;
60 using std::ofstream;
61 
62 using namespace TPEF;
63 using namespace TTAMachine;
64 
66 const string IMEM_MAU_PKG = "imem_mau_pkg.vhdl";
67 const string VER_IMEM_MAU_PKG = "imem_mau_pkg.vh";
68 const string DECOMPRESSOR_FILE = "idecompressor.vhdl";
69 
70 const string TB_DIR = "tb";
72 const string TB_IMEM_FILE = "imem_init.img";
73 const string TB_DMEM_FILE = "dmem_init.img";
74 
75 /**
76  * Loads the given TPEF file and creates a Binary instance from it.
77  *
78  * @param tpefFile The TPEF file.
79  * @return The newly created Binary instance.
80  * @exception InstanceNotFound If instance for reading wasn't found.
81  * @exception UnreachableStream If given file can't be read.
82  * @exception KeyAlreadyExists Key was in use when trying to register object.
83  * @exception EndOfFile If end of file were reached while it shouldn't.
84  * @exception OutOfRange Some read value was out of range.
85  * @exception WrongSubclass Some class couldn't do what it was asked for.
86  * @exception UnexpectedValue If there was unexpected value when reading.
87  */
88 static Binary*
89 loadTPEF(const std::string& tpefFile) {
90  BinaryStream stream(tpefFile);
91  return BinaryReader::readBinary(stream);
92 }
93 
94 /**
95  * Loads the given BEM file and creates a BinaryEncoding instance from it.
96  *
97  * @param bemFile The BEM file.
98  * @return The newly created BinaryEncoding instance.
99  * @exception SerializerException If an error occurs while reading the
100  * file.
101  * @exception ObjectStateLoadingException If an error occurs while loading
102  * the state of BinaryEncoding
103  * instance.
104  */
105 static BinaryEncoding*
106 loadBEM(const std::string& bemFile) {
107  BEMSerializer serializer;
108  serializer.setSourceFile(bemFile);
109  return serializer.readBinaryEncoding();
110 }
111 
112 /**
113  * Loads the given ADF file and creates a Machine instance from it.
114  *
115  * @param adfFile The ADF file.
116  * @return The newly created Machine instance.
117  * @exception SerializerException If an error occurs while reading the file.
118  * @exception ObjectStateLoadingException If an error occurs while loading
119  * the state of Machine instance.
120  */
121 static Machine*
122 loadMachine(const std::string& adfFile) {
123  ADFSerializer serializer;
124  serializer.setSourceFile(adfFile);
125  return serializer.readMachine();
126 }
127 
128 /**
129  * Tells whether the given address space is instruction memory.
130  *
131  * @param as The address space.
132  * @return True if the address space is instruction memory, otherwise false.
133  */
134 static bool
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 }
144 
145 
146 /**
147  * Returns the name of the program's imem image file for the given TPEF file.
148  *
149  * @param tpefFile Name of the TPEF file.
150  * @param format The image output format
151  * @return Name of the program image file.
152  */
153 std::string
154 programImemImageFile(const std::string& tpefFile, const std::string& format) {
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 }
169 
170 /**
171  * Returns the name of the program data image file for the given TPEF file.
172  *
173  * @param tpefFile Name of the TPEF file.
174  * @param format The image output format
175  * @param asName Name of the address space the image belongs to.
176  * @return Name of the program image file.
177  */
178 std::string
180  const std::string& tpefFile,
181  const std::string& format,
182  const std::string& asName) {
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 }
196 
197 /**
198  * Parses the given parameter which has form 'paramname=paramvalue" to
199  * different strings.
200  *
201  * @param param The parameter.
202  * @param paramName Parameter name is stored here.
203  * @param paramValue Parameter value is stored here.
204  * @exception InvalidData If the given parameter is not in the correct form.
205  */
206 void
208  const std::string& param, std::string& paramName, std::string& paramValue) {
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 }
220 
221 void
222 createMauPkg(int language,
223  int imemMauWidth, string fileName, string entityNameStr) {
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 }
252 
253 void
255  string fileName, ProgramImageGenerator& imageGenerator,
256  string entityStr) {
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 }
269 
270 void
272  const string& source,
273  const string& progeDir,
274  const string& newImage) {
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 }
290 
291 /**
292  * The main function of generatebits application.
293  */
294 int main(int argc, char* argv[]) {
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 }
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
BinaryReader.hh
BEMGenerator.hh
FileSystem.hh
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
main
int main(int argc, char *argv[])
Definition: GenerateBits.cc:294
createCompressor
void createCompressor(string fileName, ProgramImageGenerator &imageGenerator, string entityStr)
Definition: GenerateBits.cc:254
PIGCLITextGenerator.hh
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
ProgramImageGenerator.hh
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
BinaryEncoding.hh
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
Machine.hh
Exception
Definition: Exception.hh:54
TB_DMEM_FILE
const string TB_DMEM_FILE
Definition: GenerateBits.cc:73
PIGCmdLineOptions.hh
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
FileSystem::DIRECTORY_SEPARATOR
static const std::string DIRECTORY_SEPARATOR
Definition: FileSystem.hh:189
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
ADFSerializer.hh
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
ControlUnit.hh
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
BinaryStream.hh
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
BEMSerializer.hh
isInstructionMemory
static bool isInstructionMemory(const TTAMachine::AddressSpace &as)
Definition: GenerateBits.cc:135
TTAMachine
Definition: Assembler.hh:48
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
BEMGenerator::generate
BinaryEncoding * generate()
Definition: BEMGenerator.cc:104
TPEF::BinaryReader::readBinary
static Binary * readBinary(BinaryStream &stream)
Definition: BinaryReader.cc:88
PIGCmdLineOptions
Definition: PIGCmdLineOptions.hh:41
programImemImageFile
std::string programImemImageFile(const std::string &tpefFile, const std::string &format)
Definition: GenerateBits.cc:154
TPEF
Definition: Assembler.hh:43
TTAMachine::Machine
Definition: Machine.hh:73
Binary.hh
BEMSerializer::readBinaryEncoding
BinaryEncoding * readBinaryEncoding()
Definition: BEMSerializer.cc:258