OpenASIP
2.0
|
#include <ProGeScriptGenerator.hh>
Public Member Functions | |
ProGeScriptGenerator (const ProGe::HDL language, const IDF::MachineImplementation &idf, const std::string &dstDir, const std::string &progeOutDir, const std::string &sharedOutDir, const std::string &testBenchDir, const std::string &toplevelEntity, const std::string &simulationRuntime="52390") | |
virtual | ~ProGeScriptGenerator () |
void | generateAll () |
void | generateModsimCompile () |
void | generateGhdlCompile () |
void | generateIverilogCompile () |
void | generateModsimSimulate () |
void | generateGhdlSimulate () |
void | generateIverilogSimulate () |
Private Member Functions | |
void | generateCompileStart (std::ostream &stream) |
void | generateSimulationStart (std::ostream &stream) |
void | createExecutableFile (const std::string &fileName) |
void | outputScriptCommands (std::ostream &stream, const std::list< std::string > &files, const std::string &cmdPrefix, const std::string &cmdPostfix) |
void | outputScriptCommand (std::ostream &stream, const std::string &file, const std::string &cmdPrefix, const std::string &cmdPostfix) |
template<typename T > | |
void | findFiles (const std::string &perlre, T files, std::list< std::string > &found) |
template<typename T > | |
void | findFiles (const std::string &perlre, T &files) |
void | findText (const std::string &perlre, const unsigned int &matchRegion, const std::string &fileName, std::list< std::string > &found) |
void | getBlockOrder (std::list< std::string > &order) |
void | sortFilesFirst (std::list< std::string > &toSort, std::list< std::string > &acSort) |
void | sortFilesLast (std::list< std::string > &toSort, std::list< std::string > &acSort) |
template<typename CONT > | |
void | uniqueFileNames (CONT &files, const std::string &rootDirectory) |
void | prefixStrings (std::list< std::string > &tlist, const std::string &prefix, int start=0, int end=-1) |
void | fetchFiles () |
void | packageFilesFirst () |
void | prepareFiles () |
Private Attributes | |
std::string | dstDir_ |
std::string | progeOutDir_ |
std::string | sharedOutDir_ |
std::string | testBenchDir_ |
std::list< std::string > | vhdlFiles_ |
std::list< std::string > | gcuicFiles_ |
std::list< std::string > | testBenchFiles_ |
const std::string | workDir_ |
const std::string | vhdlDir_ |
const std::string | verDir_ |
const std::string | gcuicDir_ |
const std::string | tbDir_ |
const std::string | modsimCompileScriptName_ |
const std::string | ghdlCompileScriptName_ |
const std::string | iverilogCompileScriptName_ |
const std::string | modsimSimulateScriptName_ |
const std::string | ghdlSimulateScriptName_ |
const std::string | iverilogSimulateScriptName_ |
const std::string | testbenchName_ |
const std::string | toplevelEntity_ |
const IDF::MachineImplementation & | idf_ |
const ProGe::HDL | language_ |
const std::string | simulationRuntime_ |
Class for script generating objects.
Base class for script generating. simulationRuntime defaults to 52390ns, can be changed in generateprocessor with a command line parameter, but not in ProDe yet. TODO.
Definition at line 52 of file ProGeScriptGenerator.hh.
ProGeScriptGenerator::ProGeScriptGenerator | ( | const ProGe::HDL | language, |
const IDF::MachineImplementation & | idf, | ||
const std::string & | dstDir, | ||
const std::string & | progeOutDir, | ||
const std::string & | sharedOutDir, | ||
const std::string & | testBenchDir, | ||
const std::string & | toplevelEntity = "tta0" , |
||
const std::string & | simulationRuntime = "52390" |
||
) |
The constructor.
Script generating needs a IDF file and hdb files mentioned there. Working directory is assumed to be the destination directory for script files.
dstDir | Directory where to generate scripts. |
progeOutDir | Directory where ProGes output vhdl files lie. |
testBenchDir | Directory where a test bench files are located. |
projectRoot | Directory that is project root, needed if relative dirs wanted to generated scripts. Useful if other dirs given are under this directory. |
Definition at line 86 of file ProGeScriptGenerator.cc.
References fetchFiles(), packageFilesFirst(), and prepareFiles().
|
virtual |
|
private |
Creates a script file given as parameter and sets permissions.
Name | of the script file to be created |
IOException |
Definition at line 403 of file ProGeScriptGenerator.cc.
References __func__, FileSystem::createFile(), FileSystem::removeFileOrDirectory(), and FileSystem::setFileExecutable().
Referenced by generateGhdlCompile(), generateGhdlSimulate(), generateIverilogCompile(), generateIverilogSimulate(), generateModsimCompile(), and generateModsimSimulate().
|
private |
Gets file names from project directory.
Definition at line 716 of file ProGeScriptGenerator.cc.
References FileSystem::absolutePathOf(), FileSystem::DIRECTORY_SEPARATOR, FileSystem::directoryContents(), dstDir_, FileSystem::fileIsDirectory(), findFiles(), FileSystem::findFromDirectoryRecursive(), gcuicDir_, gcuicFiles_, language_, progeOutDir_, sharedOutDir_, testBenchDir_, testBenchFiles_, toplevelEntity_, verDir_, ProGe::VHDL, vhdlDir_, and vhdlFiles_.
Referenced by ProGeScriptGenerator().
|
private |
|
private |
Referenced by fetchFiles().
|
private |
Regex find from a file.
Finds text matching the given regex from file by line at a time. Case is ignored when interpreting the regex.
perlre | Perl syntax regular expression. |
matchRegion | Region from the match appended to output list. |
fileName | Name and path of file name to be opened and read. |
found | List where matches are appended. |
Definition at line 515 of file ProGeScriptGenerator.cc.
void ProGeScriptGenerator::generateAll | ( | ) |
Generates all scripts to destination dir (dstDir_).
IOException |
Definition at line 136 of file ProGeScriptGenerator.cc.
References generateGhdlCompile(), generateGhdlSimulate(), generateIverilogCompile(), generateIverilogSimulate(), generateModsimCompile(), generateModsimSimulate(), language_, and ProGe::VHDL.
Referenced by ProGe::ProGeUI::generateScripts().
|
private |
Generates the start of the shell script for compilation script.
stream | Stream where output is put. |
Definition at line 419 of file ProGeScriptGenerator.cc.
References Environment::dataDirPath(), and FileSystem::DIRECTORY_SEPARATOR.
Referenced by generateGhdlCompile(), generateIverilogCompile(), and generateModsimCompile().
void ProGeScriptGenerator::generateGhdlCompile | ( | ) |
Generates a script for compilation using ghdl.
IOException |
Definition at line 226 of file ProGeScriptGenerator.cc.
References createExecutableFile(), FileSystem::DIRECTORY_SEPARATOR, dstDir_, gcuicFiles_, generateCompileStart(), ghdlCompileScriptName_, outputScriptCommands(), program, testBenchFiles_, testbenchName_, vhdlFiles_, and workDir_.
Referenced by generateAll().
void ProGeScriptGenerator::generateGhdlSimulate | ( | ) |
Generates a script for simulating using ghdl.
IOException |
Definition at line 344 of file ProGeScriptGenerator.cc.
References createExecutableFile(), FileSystem::DIRECTORY_SEPARATOR, dstDir_, generateSimulationStart(), ghdlSimulateScriptName_, and testbenchName_.
Referenced by generateAll().
void ProGeScriptGenerator::generateIverilogCompile | ( | ) |
Generates a script for compilation using iVerilog.
IOException |
Definition at line 271 of file ProGeScriptGenerator.cc.
References createExecutableFile(), FileSystem::DIRECTORY_SEPARATOR, dstDir_, gcuicFiles_, generateCompileStart(), iverilogCompileScriptName_, outputScriptCommands(), simulationRuntime_, testBenchFiles_, testbenchName_, and vhdlFiles_.
Referenced by generateAll().
void ProGeScriptGenerator::generateIverilogSimulate | ( | ) |
Generates a script for simulating using iVerilog.
IOException |
Definition at line 374 of file ProGeScriptGenerator.cc.
References createExecutableFile(), FileSystem::DIRECTORY_SEPARATOR, dstDir_, generateSimulationStart(), iverilogSimulateScriptName_, and testbenchName_.
Referenced by generateAll().
void ProGeScriptGenerator::generateModsimCompile | ( | ) |
Generates a script for compilation using modelsim.
IOException |
Definition at line 158 of file ProGeScriptGenerator.cc.
References createExecutableFile(), FileSystem::DIRECTORY_SEPARATOR, dstDir_, gcuicFiles_, generateCompileStart(), language_, modsimCompileScriptName_, outputScriptCommand(), outputScriptCommands(), program, simulationRuntime_, testBenchFiles_, ProGe::VHDL, vhdlFiles_, and workDir_.
Referenced by generateAll().
void ProGeScriptGenerator::generateModsimSimulate | ( | ) |
Generates a script for simulating using modelsims vsim.
Definition at line 303 of file ProGeScriptGenerator.cc.
References createExecutableFile(), FileSystem::DIRECTORY_SEPARATOR, dstDir_, generateSimulationStart(), modsimSimulateScriptName_, and testbenchName_.
Referenced by generateAll().
|
private |
Generates the start of the shell script for simulation script.
The script includes option parsing for simulation controls. Shell variable "runtime" holds default simulation time set by this class or user defined time by option.
stream | Stream where output is put. |
Definition at line 442 of file ProGeScriptGenerator.cc.
References Environment::dataDirPath(), FileSystem::DIRECTORY_SEPARATOR, and simulationRuntime_.
Referenced by generateGhdlSimulate(), generateIverilogSimulate(), and generateModsimSimulate().
|
private |
Gets compilation order for vhdl files from IDF/HDB files.
order | List of file names is relative compilation order. |
Definition at line 644 of file ProGeScriptGenerator.cc.
References HDB::HWBlockImplementation::file(), FileSystem::fileOfPath(), HDB::HDBManager::fuByEntryID(), IDF::MachineImplementation::fuImplementation(), IDF::MachineImplementation::fuImplementationCount(), HDB::HDBRegistry::hdb(), IDF::UnitImplementationLocation::hdbFile(), idf_, HDB::RFEntry::implementation(), HDB::FUEntry::implementation(), HDB::HWBlockImplementation::implementationFileCount(), HDB::HDBRegistry::instance(), HDB::BlockImplementationFile::pathToFile(), HDB::HDBManager::rfByEntryID(), IDF::MachineImplementation::rfImplementation(), and IDF::MachineImplementation::rfImplementationCount().
Referenced by prepareFiles().
|
private |
Outputs shell command to stream.
Creates script commands using a file and command prefix and outputs them to the given stream.
stream | Output stream. |
files | List of filenames to use. |
cmdPrefix | Prefix command. |
cmdPostfix | Postfix command. |
Definition at line 493 of file ProGeScriptGenerator.cc.
Referenced by generateModsimCompile(), and outputScriptCommands().
|
private |
Outputs shell commands to stream.
Creates script commands using list of files and command prefix and outputs them to the given stream.
stream | Output stream. |
files | List of filenames to use. |
cmdPrefix | Prefix command. |
cmdPostfix | Prefix command. |
Definition at line 469 of file ProGeScriptGenerator.cc.
References outputScriptCommand().
Referenced by generateGhdlCompile(), generateIverilogCompile(), and generateModsimCompile().
|
private |
Reorders filename lists by arranging packages (*_pkg*) to the beginning of the lists.
Definition at line 774 of file ProGeScriptGenerator.cc.
References gcuicFiles_, testBenchFiles_, and vhdlFiles_.
Referenced by ProGeScriptGenerator().
|
private |
Prefixes strings in a container with a string within a range.
tlist | Container of strings. |
prefix | Prefix to be added to strings in container. |
start | Starting location in a container, 0 is the first. |
end | Ending location in a container, size-1 is the last. |
Definition at line 693 of file ProGeScriptGenerator.cc.
Referenced by prepareFiles().
|
private |
Prepares filename lists, generally sorts them.
Definition at line 796 of file ProGeScriptGenerator.cc.
References FileSystem::DIRECTORY_SEPARATOR, DS, dstDir_, gcuicDir_, gcuicFiles_, getBlockOrder(), language_, prefixStrings(), progeOutDir_, FileSystem::relativeDir(), sortFilesFirst(), sortFilesLast(), tbDir_, testBenchFiles_, toplevelEntity_, ProGe::VHDL, vhdlDir_, and vhdlFiles_.
Referenced by ProGeScriptGenerator().
|
private |
Relative file name/path sort using a reference.
Sorts file in one list according to other list,placing in beginning of list, only relative order matters (which entry comes first). Algorithm used does relative sort between two lists, the other is sorted according to the other.
toSort | List to be sorted. |
acSort | List where reference order is taken from. |
Definition at line 561 of file ProGeScriptGenerator.cc.
References FileSystem::compareFileNames(), and dstDir_.
Referenced by prepareFiles().
|
private |
Relative file name/path sort using a reference.
Sorts file in one list according to other list, placing in end of list, only relative order matters (which entry comes first). Algorithm used does relative sort between two lists, the other is sorted according to the other.
toSort | List to be sorted. |
acSort | List where reference order is taken from. |
Definition at line 606 of file ProGeScriptGenerator.cc.
References FileSystem::compareFileNames(), and dstDir_.
Referenced by prepareFiles().
|
private |
|
private |
Definition at line 128 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles(), generateGhdlCompile(), generateGhdlSimulate(), generateIverilogCompile(), generateIverilogSimulate(), generateModsimCompile(), generateModsimSimulate(), prepareFiles(), sortFilesFirst(), and sortFilesLast().
|
private |
Definition at line 145 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles(), and prepareFiles().
|
private |
Definition at line 138 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles(), generateGhdlCompile(), generateIverilogCompile(), generateModsimCompile(), packageFilesFirst(), and prepareFiles().
|
private |
Definition at line 150 of file ProGeScriptGenerator.hh.
Referenced by generateGhdlCompile().
|
private |
Definition at line 153 of file ProGeScriptGenerator.hh.
Referenced by generateGhdlSimulate().
|
private |
Definition at line 159 of file ProGeScriptGenerator.hh.
Referenced by getBlockOrder().
|
private |
Definition at line 151 of file ProGeScriptGenerator.hh.
Referenced by generateIverilogCompile().
|
private |
Definition at line 154 of file ProGeScriptGenerator.hh.
Referenced by generateIverilogSimulate().
|
private |
Definition at line 160 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles(), generateAll(), generateModsimCompile(), and prepareFiles().
|
private |
Definition at line 149 of file ProGeScriptGenerator.hh.
Referenced by generateModsimCompile().
|
private |
Definition at line 152 of file ProGeScriptGenerator.hh.
Referenced by generateModsimSimulate().
|
private |
Definition at line 130 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles(), and prepareFiles().
|
private |
Definition at line 132 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles().
|
private |
Definition at line 163 of file ProGeScriptGenerator.hh.
Referenced by generateIverilogCompile(), generateModsimCompile(), and generateSimulationStart().
|
private |
Definition at line 146 of file ProGeScriptGenerator.hh.
Referenced by prepareFiles().
|
private |
Definition at line 134 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles().
|
private |
Definition at line 139 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles(), generateGhdlCompile(), generateIverilogCompile(), generateModsimCompile(), packageFilesFirst(), and prepareFiles().
|
private |
Definition at line 157 of file ProGeScriptGenerator.hh.
Referenced by generateGhdlCompile(), generateGhdlSimulate(), generateIverilogCompile(), generateIverilogSimulate(), and generateModsimSimulate().
|
private |
Definition at line 158 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles(), and prepareFiles().
|
private |
Definition at line 144 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles().
|
private |
Definition at line 143 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles(), and prepareFiles().
|
private |
Definition at line 137 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles(), generateGhdlCompile(), generateIverilogCompile(), generateModsimCompile(), packageFilesFirst(), and prepareFiles().
|
private |
Definition at line 142 of file ProGeScriptGenerator.hh.
Referenced by generateGhdlCompile(), and generateModsimCompile().