OpenASIP
2.0
|
#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"
Go to the source code of this file.
Functions | |
static Binary * | loadTPEF (const std::string &tpefFile) |
static BinaryEncoding * | loadBEM (const std::string &bemFile) |
static Machine * | loadMachine (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 ¶m, std::string ¶mName, std::string ¶mValue) |
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" |
Implementation of the main function of generatebits application.
Definition in file GenerateBits.cc.
void copyImageToTb | ( | const string & | source, |
const string & | progeDir, | ||
const string & | newImage | ||
) |
Definition at line 271 of file GenerateBits.cc.
References FileSystem::copy(), DIR_SEP, Exception::errorMessage(), FileSystem::fileIsCreatable(), FileSystem::fileIsDirectory(), FileSystem::fileIsWritable(), and TB_DIR.
Referenced by main().
void createCompressor | ( | string | fileName, |
ProgramImageGenerator & | imageGenerator, | ||
string | entityStr | ||
) |
Definition at line 254 of file GenerateBits.cc.
References __func__, FileSystem::createFile(), and ProgramImageGenerator::generateDecompressor().
Referenced by main().
void createMauPkg | ( | int | language, |
int | imemMauWidth, | ||
string | fileName, | ||
string | entityNameStr | ||
) |
Definition at line 222 of file GenerateBits.cc.
References __func__, FileSystem::createFile(), FileSystem::fileExists(), and FileSystem::fileIsWritable().
Referenced by main().
|
static |
Tells whether the given address space is instruction memory.
as | The address space. |
Definition at line 135 of file GenerateBits.cc.
References TTAMachine::FunctionUnit::addressSpace(), TTAMachine::Machine::controlUnit(), and TTAMachine::Component::machine().
Referenced by main().
|
static |
Loads the given BEM file and creates a BinaryEncoding instance from it.
bemFile | The BEM file. |
SerializerException | If an error occurs while reading the file. |
ObjectStateLoadingException | If an error occurs while loading the state of BinaryEncoding instance. |
Definition at line 106 of file GenerateBits.cc.
References BEMSerializer::readBinaryEncoding(), and XMLSerializer::setSourceFile().
Referenced by main().
|
static |
Loads the given ADF file and creates a Machine instance from it.
adfFile | The ADF file. |
SerializerException | If an error occurs while reading the file. |
ObjectStateLoadingException | If an error occurs while loading the state of Machine instance. |
Definition at line 122 of file GenerateBits.cc.
References ADFSerializer::readMachine(), and XMLSerializer::setSourceFile().
Referenced by main().
|
static |
Loads the given TPEF file and creates a Binary instance from it.
tpefFile | The TPEF file. |
InstanceNotFound | If instance for reading wasn't found. |
UnreachableStream | If given file can't be read. |
KeyAlreadyExists | Key was in use when trying to register object. |
EndOfFile | If end of file were reached while it shouldn't. |
OutOfRange | Some read value was out of range. |
WrongSubclass | Some class couldn't do what it was asked for. |
UnexpectedValue | If there was unexpected value when reading. |
Definition at line 89 of file GenerateBits.cc.
References TPEF::BinaryReader::readBinary().
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
The main function of generatebits application.
Definition at line 294 of file GenerateBits.cc.
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().
void parseParameter | ( | const std::string & | param, |
std::string & | paramName, | ||
std::string & | paramValue | ||
) |
Parses the given parameter which has form 'paramname=paramvalue" to different strings.
param | The parameter. |
paramName | Parameter name is stored here. |
paramValue | Parameter value is stored here. |
InvalidData | If the given parameter is not in the correct form. |
Definition at line 207 of file GenerateBits.cc.
References __func__.
Referenced by main().
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.
tpefFile | Name of the TPEF file. |
format | The image output format |
asName | Name of the address space the image belongs to. |
Definition at line 179 of file GenerateBits.cc.
References FileSystem::fileNameBody().
Referenced by main().
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.
tpefFile | Name of the TPEF file. |
format | The image output format |
Definition at line 154 of file GenerateBits.cc.
References FileSystem::fileNameBody().
Referenced by main().
const string DECOMPRESSOR_FILE = "idecompressor.vhdl" |
Definition at line 68 of file GenerateBits.cc.
Referenced by main().
const int DEFAULT_IMEMWIDTH_IN_MAUS = 1 |
Definition at line 65 of file GenerateBits.cc.
Referenced by main().
const string DIR_SEP = FileSystem::DIRECTORY_SEPARATOR |
Definition at line 71 of file GenerateBits.cc.
Referenced by copyImageToTb(), main(), and PluginTools::registerModule().
const string IMEM_MAU_PKG = "imem_mau_pkg.vhdl" |
Definition at line 66 of file GenerateBits.cc.
Referenced by main().
const string TB_DIR = "tb" |
Definition at line 70 of file GenerateBits.cc.
Referenced by copyImageToTb().
const string TB_DMEM_FILE = "dmem_init.img" |
Definition at line 73 of file GenerateBits.cc.
const string TB_IMEM_FILE = "imem_init.img" |
Definition at line 72 of file GenerateBits.cc.
Referenced by main().
const string VER_IMEM_MAU_PKG = "imem_mau_pkg.vh" |
Definition at line 67 of file GenerateBits.cc.
Referenced by main().