OpenASIP 2.2
|
#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 (std::string scriptName, std::string tbName, std::vector< std::list< std::string > > filesToCompile, bool clearWorkingDir) |
void | generatePlatformGhdlCompile () |
void | generateIverilogCompile () |
void | generateModsimSimulate () |
void | generateGhdlSimulate () |
void | generatePlatformGhdlSimulate () |
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_ |
std::list< std::string > | platformFiles_ |
const std::string | workDir_ |
const std::string | vhdlDir_ |
const std::string | verDir_ |
const std::string | gcuicDir_ |
const std::string | tbDir_ |
const std::string | platformDir_ |
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 | ghdlPlatformCompileScriptName_ |
const std::string | testbenchName_ |
const std::string | platformTestbenchName_ |
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 416 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 729 of file ProGeScriptGenerator.cc.
References FileSystem::absolutePathOf(), FileSystem::DIRECTORY_SEPARATOR, FileSystem::directoryContents(), DS, dstDir_, FileSystem::fileIsDirectory(), findFiles(), FileSystem::findFromDirectoryRecursive(), gcuicDir_, gcuicFiles_, language_, platformDir_, platformFiles_, 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 528 of file ProGeScriptGenerator.cc.
void ProGeScriptGenerator::generateAll | ( | ) |
Generates all scripts to destination dir (dstDir_).
IOException |
Definition at line 134 of file ProGeScriptGenerator.cc.
References gcuicFiles_, generateGhdlCompile(), generateGhdlSimulate(), generateIverilogCompile(), generateIverilogSimulate(), generateModsimCompile(), generateModsimSimulate(), ghdlCompileScriptName_, ghdlPlatformCompileScriptName_, language_, platformFiles_, platformTestbenchName_, testBenchFiles_, testbenchName_, ProGe::VHDL, and vhdlFiles_.
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 432 of file ProGeScriptGenerator.cc.
References Environment::dataDirPath(), and FileSystem::DIRECTORY_SEPARATOR.
Referenced by generateGhdlCompile(), generateIverilogCompile(), and generateModsimCompile().
void ProGeScriptGenerator::generateGhdlCompile | ( | std::string | scriptName, |
std::string | tbName, | ||
std::vector< std::list< std::string > > | filesToCompile, | ||
bool | clearWorkingDir | ||
) |
Generates a script for compilation using ghdl.
IOException |
Definition at line 236 of file ProGeScriptGenerator.cc.
References createExecutableFile(), FileSystem::DIRECTORY_SEPARATOR, dstDir_, generateCompileStart(), outputScriptCommands(), program, and workDir_.
Referenced by generateAll().
void ProGeScriptGenerator::generateGhdlSimulate | ( | ) |
Generates a script for simulating using ghdl.
IOException |
Definition at line 356 of file ProGeScriptGenerator.cc.
References createExecutableFile(), FileSystem::DIRECTORY_SEPARATOR, dstDir_, generateSimulationStart(), and ghdlSimulateScriptName_.
Referenced by generateAll().
void ProGeScriptGenerator::generateIverilogCompile | ( | ) |
Generates a script for compilation using iVerilog.
IOException |
Definition at line 283 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 387 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 163 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 315 of file ProGeScriptGenerator.cc.
References createExecutableFile(), FileSystem::DIRECTORY_SEPARATOR, dstDir_, generateSimulationStart(), modsimSimulateScriptName_, and testbenchName_.
Referenced by generateAll().
void ProGeScriptGenerator::generatePlatformGhdlCompile | ( | ) |
void ProGeScriptGenerator::generatePlatformGhdlSimulate | ( | ) |
|
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 455 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 657 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::FUEntry::implementation(), HDB::RFEntry::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 506 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 482 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 796 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 706 of file ProGeScriptGenerator.cc.
Referenced by prepareFiles().
|
private |
Prepares filename lists, generally sorts them.
Definition at line 818 of file ProGeScriptGenerator.cc.
References FileSystem::DIRECTORY_SEPARATOR, DS, dstDir_, gcuicDir_, gcuicFiles_, getBlockOrder(), language_, platformFiles_, 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 574 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 619 of file ProGeScriptGenerator.cc.
References FileSystem::compareFileNames(), and dstDir_.
Referenced by prepareFiles().
|
private |
|
private |
Definition at line 134 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles(), generateGhdlCompile(), generateGhdlSimulate(), generateIverilogCompile(), generateIverilogSimulate(), generateModsimCompile(), generateModsimSimulate(), prepareFiles(), sortFilesFirst(), and sortFilesLast().
|
private |
Definition at line 152 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles(), and prepareFiles().
|
private |
Definition at line 144 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles(), generateAll(), generateIverilogCompile(), generateModsimCompile(), packageFilesFirst(), and prepareFiles().
|
private |
Definition at line 158 of file ProGeScriptGenerator.hh.
Referenced by generateAll().
|
private |
Definition at line 163 of file ProGeScriptGenerator.hh.
Referenced by generateAll().
|
private |
Definition at line 161 of file ProGeScriptGenerator.hh.
Referenced by generateGhdlSimulate().
|
private |
Definition at line 169 of file ProGeScriptGenerator.hh.
Referenced by getBlockOrder().
|
private |
Definition at line 159 of file ProGeScriptGenerator.hh.
Referenced by generateIverilogCompile().
|
private |
Definition at line 162 of file ProGeScriptGenerator.hh.
Referenced by generateIverilogSimulate().
|
private |
Definition at line 170 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles(), generateAll(), generateModsimCompile(), and prepareFiles().
|
private |
Definition at line 157 of file ProGeScriptGenerator.hh.
Referenced by generateModsimCompile().
|
private |
Definition at line 160 of file ProGeScriptGenerator.hh.
Referenced by generateModsimSimulate().
|
private |
Definition at line 154 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles().
|
private |
Definition at line 146 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles(), generateAll(), and prepareFiles().
|
private |
Definition at line 167 of file ProGeScriptGenerator.hh.
Referenced by generateAll().
|
private |
Definition at line 136 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles(), and prepareFiles().
|
private |
Definition at line 138 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles().
|
private |
Definition at line 173 of file ProGeScriptGenerator.hh.
Referenced by generateIverilogCompile(), generateModsimCompile(), and generateSimulationStart().
|
private |
Definition at line 153 of file ProGeScriptGenerator.hh.
Referenced by prepareFiles().
|
private |
Definition at line 140 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles().
|
private |
Definition at line 145 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles(), generateAll(), generateIverilogCompile(), generateModsimCompile(), packageFilesFirst(), and prepareFiles().
|
private |
Definition at line 166 of file ProGeScriptGenerator.hh.
Referenced by generateAll(), generateIverilogCompile(), generateIverilogSimulate(), and generateModsimSimulate().
|
private |
Definition at line 168 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles(), and prepareFiles().
|
private |
Definition at line 151 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles().
|
private |
Definition at line 150 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles(), and prepareFiles().
|
private |
Definition at line 143 of file ProGeScriptGenerator.hh.
Referenced by fetchFiles(), generateAll(), generateIverilogCompile(), generateModsimCompile(), packageFilesFirst(), and prepareFiles().
|
private |
Definition at line 149 of file ProGeScriptGenerator.hh.
Referenced by generateGhdlCompile(), and generateModsimCompile().