OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Static Private Attributes | List of all members
PIGCmdLineOptions Class Reference

#include <PIGCmdLineOptions.hh>

Inheritance diagram for PIGCmdLineOptions:
Inheritance graph
Collaboration diagram for PIGCmdLineOptions:
Collaboration graph

Public Member Functions

 PIGCmdLineOptions ()
 
virtual ~PIGCmdLineOptions ()
 
std::string bemFile () const
 
int tpefFileCount () const
 
std::string tpefFile (int index) const
 
std::string programImageOutputFormat () const
 
std::string dataImageOutputFormat () const
 
std::string compressorPlugin () const
 
int dataMemoryWidthInMAUs () const
 
bool generateDataImages () const
 
bool generateDecompressor () const
 
int compressorParameterCount () const
 
std::string compressorParameter (int index) const
 
bool showCompressors () const
 
std::string progeOutputDirectory () const
 
std::string entityName () const
 
CmdLineOptionParserdataStart () const
 
virtual void printVersion () const
 
virtual void printHelp () const
 
void printUsage () const
 
- Public Member Functions inherited from CmdLineOptions
 CmdLineOptions (std::string description, std::string version="")
 
virtual ~CmdLineOptions ()
 
void parse (char *argv[], int argc)
 
void parse (std::string argv[], int argc)
 
void parse (std::vector< std::string > argv)
 
virtual bool isVerboseSwitchDefined () const
 
virtual bool isVerboseSpamSwitchDefined () const
 
- Public Member Functions inherited from CmdLineParser
 CmdLineParser (std::string description)
 
virtual ~CmdLineParser ()
 
virtual void storeOptions (Options &options)
 
virtual int numberOfArguments () const
 
virtual std::string argument (int index) const
 

Static Private Attributes

static const std::string BEM_PARAM_NAME = "bem"
 Long name of the BEM file parameter.
 
static const std::string TPEF_PARAM_NAME = "program"
 Long name of the TPEF file parameter.
 
static const std::string PI_FORMAT_PARAM_NAME = "piformat"
 Long name of the program image output format parameter.
 
static const std::string DI_FORMAT_PARAM_NAME = "diformat"
 Long name of the data image output format parameter.
 
static const std::string COMPRESSOR_PARAM_NAME = "compressor"
 Long name of the plugin file parameter.
 
static const std::string DATA_IMG_PARAM_NAME = "dataimages"
 Long name of the parameter that defines whether to create data images.
 
static const std::string GEN_DECOMP_PARAM_NAME = "decompressor"
 Long name of the parameter that tells whether to generate decompressor or not.
 
static const std::string DMEM_WIDTH_IN_MAUS_PARAM_NAME
 Long name of the parameter that tells the width of data mem in MAUs.
 
static const std::string IMEM_WIDTH_IN_MAUS_PARAM_NAME
 Long name of the paramter that tells the width of inst mem in MAUs.
 
static const std::string COMPRESSOR_PARAMS_PARAM_NAME
 Long name of parameter passed to code compressor plugin.
 
static const std::string SHOW_COMPRESSORS_PARAM_NAME
 Long name of the parameter that tells whether to show compressors.
 
static const std::string HDL_OUTPUT_DIR = "hdl-dir"
 Long name of the parameter which tells the proge-output dir.
 
static const std::string DATA_START = "data-start"
 

Additional Inherited Members

- Protected Member Functions inherited from CmdLineOptions
bool optionGiven (std::string key) const
 
- Protected Member Functions inherited from CmdLineParser
void addOption (CmdLineOptionParser *opt)
 
CmdLineOptionParserfindOption (std::string name) const
 
bool parseOption (std::string option, std::string &name, std::string &arguments, std::string &prefix, bool &hasArgument) const
 
bool readPrefix (std::string &option, std::string &prefix, bool &longOption) const
 
bool isPrefix (std::string name) const
 
- Protected Attributes inherited from CmdLineParser
std::map< std::string, CmdLineOptionParser * > optionLongNames_
 Database for holding options with their long names as a key.
 
std::map< std::string, CmdLineOptionParser * > optionShortNames_
 Database for holding options with their short names as a key.
 
std::vector< std::string > commandLine_
 Command line is stored here.
 
std::vector< std::string > arguments_
 Command line arguments are stored here.
 
std::vector< std::string > prefixes_
 Legal prefixes are stored here.
 

Detailed Description

Command line options for the command line interface of PIG (generatebits).

Definition at line 41 of file PIGCmdLineOptions.hh.

Constructor & Destructor Documentation

◆ PIGCmdLineOptions()

PIGCmdLineOptions::PIGCmdLineOptions ( )

The constructor.

Definition at line 62 of file PIGCmdLineOptions.cc.

62 : CmdLineOptions("") {
63
66 TPEF_PARAM_NAME, "The TPEF program file(s)", "p");
68
70 BEM_PARAM_NAME, "The BEM file", "b");
72
75 "The output format of program image(s) ('ascii', 'array', 'mif', "
76 "'coe', 'vhdl', 'hex', 'binary' or 'bin2n'). Default is 'ascii'.",
77 "f");
78 addOption(piOutputMode);
79
81 DI_FORMAT_PARAM_NAME, "The output format of data image(s) "
82 "('ascii', 'array', 'mif', 'coe', 'vhdl', 'hex', 'bin2n' or 'binary'). Default "
83 "is 'ascii'.", "o");
84 addOption(diOutputMode);
85
87 COMPRESSOR_PARAM_NAME, "Name of the code compressor plugin file.",
88 "c");
89 addOption(pluginFile);
90
93 "Create data images.",
94 "d");
95 addOption(createDataImages);
96
97 BoolCmdLineOptionParser* createDecompressor =
99 GEN_DECOMP_PARAM_NAME, "Generate decompressor block.", "g");
100 addOption(createDecompressor);
101
102 IntegerCmdLineOptionParser* dmemMAUsPerLine =
105 "Width of data memory in MAUs. Default is 1.", "w");
106 addOption(dmemMAUsPerLine);
107
108 StringListCmdLineOptionParser* compressorParams =
111 "Parameter to the code compressor in form 'name=value'.", "u");
112 addOption(compressorParams);
113
115 SHOW_COMPRESSORS_PARAM_NAME, "Show compressor plugin descriptions.",
116 "s");
118
119 string hdlDirDesc("Directory root where ProGe generated HDL files. "
120 "Generatebits will write imem_mau_pkg and "
121 "decompressor, if it is needed, under the given "
122 "directory. Otherwise they are written to cwd.");
123
125 HDL_OUTPUT_DIR, hdlDirDesc, "x");
126 addOption(hdlDir);
127
128 string dataStartDesc(
129 "Data-start option is used "
130 "to set the global data start address for the address spaces. "
131 "The default is the first address of the address space. "
132 "data-start option must either be just the start "
133 "of the default address space (a single unsigned integer), "
134 "or a list consisting of pairs: "
135 "<Address-Space Name>,<Address-Space Start>");
137 new StringListCmdLineOptionParser(DATA_START, dataStartDesc);
139
143 "String to use to make the generated VHDL entities unique. This "
144 "should be the same which was given to ProGe when the processor "
145 "was generated (default is 'tta0').", "e");
147}
const string ENTITY_NAME
void addOption(CmdLineOptionParser *opt)
static const std::string DI_FORMAT_PARAM_NAME
Long name of the data image output format parameter.
std::string entityName() const
std::string tpefFile(int index) const
bool showCompressors() const
static const std::string COMPRESSOR_PARAMS_PARAM_NAME
Long name of parameter passed to code compressor plugin.
static const std::string PI_FORMAT_PARAM_NAME
Long name of the program image output format parameter.
static const std::string GEN_DECOMP_PARAM_NAME
Long name of the parameter that tells whether to generate decompressor or not.
static const std::string TPEF_PARAM_NAME
Long name of the TPEF file parameter.
static const std::string COMPRESSOR_PARAM_NAME
Long name of the plugin file parameter.
static const std::string DMEM_WIDTH_IN_MAUS_PARAM_NAME
Long name of the parameter that tells the width of data mem in MAUs.
static const std::string HDL_OUTPUT_DIR
Long name of the parameter which tells the proge-output dir.
CmdLineOptionParser * dataStart() const
static const std::string DATA_IMG_PARAM_NAME
Long name of the parameter that defines whether to create data images.
static const std::string BEM_PARAM_NAME
Long name of the BEM file parameter.
std::string bemFile() const
static const std::string DATA_START
static const std::string SHOW_COMPRESSORS_PARAM_NAME
Long name of the parameter that tells whether to show compressors.

References CmdLineParser::addOption(), BEM_PARAM_NAME, bemFile(), COMPRESSOR_PARAM_NAME, COMPRESSOR_PARAMS_PARAM_NAME, DATA_IMG_PARAM_NAME, DATA_START, dataStart(), DI_FORMAT_PARAM_NAME, DMEM_WIDTH_IN_MAUS_PARAM_NAME, ENTITY_NAME, entityName(), GEN_DECOMP_PARAM_NAME, HDL_OUTPUT_DIR, PI_FORMAT_PARAM_NAME, SHOW_COMPRESSORS_PARAM_NAME, showCompressors(), TPEF_PARAM_NAME, and tpefFile().

Here is the call graph for this function:

◆ ~PIGCmdLineOptions()

PIGCmdLineOptions::~PIGCmdLineOptions ( )
virtual

The destructor.

Definition at line 153 of file PIGCmdLineOptions.cc.

153 {
154}

Member Function Documentation

◆ bemFile()

std::string PIGCmdLineOptions::bemFile ( ) const

Returns the name of the BEM file given as command line parameter.

Returns
The name of the BEM file.

Definition at line 163 of file PIGCmdLineOptions.cc.

163 {
165}
virtual std::string String(int index=0) const
CmdLineOptionParser * findOption(std::string name) const

References BEM_PARAM_NAME, CmdLineParser::findOption(), and CmdLineOptionParser::String().

Referenced by PIGCmdLineOptions().

Here is the call graph for this function:

◆ compressorParameter()

std::string PIGCmdLineOptions::compressorParameter ( int  index) const

By the given index, returns a parameter given to code compressor.

Parameters
indexThe index.
Exceptions
OutOfRangeIf the given index is negative or not smaller than the number of parameters given to compressor.

Definition at line 281 of file PIGCmdLineOptions.cc.

281 {
282 if (index < 0 || index >= compressorParameterCount()) {
283 throw OutOfRange(__FILE__, __LINE__, __func__);
284 }
285
287}
#define __func__
int compressorParameterCount() const

References __func__, COMPRESSOR_PARAMS_PARAM_NAME, compressorParameterCount(), CmdLineParser::findOption(), and CmdLineOptionParser::String().

Here is the call graph for this function:

◆ compressorParameterCount()

int PIGCmdLineOptions::compressorParameterCount ( ) const

Returns the number of parameters given to compressor.

Returns
The number of parameters.

Definition at line 268 of file PIGCmdLineOptions.cc.

268 {
270}
virtual int listSize() const

References COMPRESSOR_PARAMS_PARAM_NAME, CmdLineParser::findOption(), and CmdLineOptionParser::listSize().

Referenced by compressorParameter().

Here is the call graph for this function:

◆ compressorPlugin()

std::string PIGCmdLineOptions::compressorPlugin ( ) const

Returns the code compressor plugin file name.

Returns
The plugin file.

Definition at line 222 of file PIGCmdLineOptions.cc.

222 {
224}

References COMPRESSOR_PARAM_NAME, CmdLineParser::findOption(), and CmdLineOptionParser::String().

Here is the call graph for this function:

◆ dataImageOutputFormat()

std::string PIGCmdLineOptions::dataImageOutputFormat ( ) const

Returns the data image output format given as command line parameter.

Returns
The output format.

Definition at line 211 of file PIGCmdLineOptions.cc.

211 {
213}

References DI_FORMAT_PARAM_NAME, CmdLineParser::findOption(), and CmdLineOptionParser::String().

Here is the call graph for this function:

◆ dataMemoryWidthInMAUs()

int PIGCmdLineOptions::dataMemoryWidthInMAUs ( ) const

Returns the given width of data memory in MAUs.

Returns
The width.

Definition at line 233 of file PIGCmdLineOptions.cc.

233 {
236 if (option->isDefined()) {
237 return option->integer();
238 } else {
239 return 1;
240 }
241}
virtual int integer(int index=0) const

References DMEM_WIDTH_IN_MAUS_PARAM_NAME, CmdLineParser::findOption(), CmdLineOptionParser::integer(), and CmdLineOptionParser::isDefined().

Here is the call graph for this function:

◆ dataStart()

CmdLineOptionParser * PIGCmdLineOptions::dataStart ( ) const

Definition at line 308 of file PIGCmdLineOptions.cc.

308 {
309 return findOption(DATA_START);
310}

References DATA_START, and CmdLineParser::findOption().

Referenced by PIGCmdLineOptions().

Here is the call graph for this function:

◆ entityName()

std::string PIGCmdLineOptions::entityName ( ) const

Definition at line 313 of file PIGCmdLineOptions.cc.

313 {
314 return findOption(ENTITY_NAME)->String();
315}

References ENTITY_NAME, CmdLineParser::findOption(), and CmdLineOptionParser::String().

Referenced by PIGCmdLineOptions().

Here is the call graph for this function:

◆ generateDataImages()

bool PIGCmdLineOptions::generateDataImages ( ) const

Tells whether to create data images or not.

Definition at line 248 of file PIGCmdLineOptions.cc.

248 {
250}
virtual bool isFlagOn() const

References DATA_IMG_PARAM_NAME, CmdLineParser::findOption(), and CmdLineOptionParser::isFlagOn().

Here is the call graph for this function:

◆ generateDecompressor()

bool PIGCmdLineOptions::generateDecompressor ( ) const

Tells whether to generate decompressor block or not.

Definition at line 257 of file PIGCmdLineOptions.cc.

257 {
259}

References CmdLineParser::findOption(), GEN_DECOMP_PARAM_NAME, and CmdLineOptionParser::isFlagOn().

Here is the call graph for this function:

◆ printHelp()

void PIGCmdLineOptions::printHelp ( ) const
virtual

Prints the help menu of the program.

Reimplemented from CmdLineOptions.

Definition at line 336 of file PIGCmdLineOptions.cc.

336 {
337 printVersion();
338 printUsage();
340}
virtual void printHelp() const
virtual void printVersion() const

References CmdLineOptions::printHelp(), printUsage(), and printVersion().

Here is the call graph for this function:

◆ printUsage()

void PIGCmdLineOptions::printUsage ( ) const

Prints the usage of the CLI.

Definition at line 347 of file PIGCmdLineOptions.cc.

347 {
348 PIGCLITextGenerator textGen;
349 std::cerr << textGen.text(PIGCLITextGenerator::TXT_CLI_USAGE).str()
350 << std::endl;
351}
virtual boost::format text(int textId)

References Texts::TextGenerator::text(), and PIGCLITextGenerator::TXT_CLI_USAGE.

Referenced by printHelp().

Here is the call graph for this function:

◆ printVersion()

void PIGCmdLineOptions::printVersion ( ) const
virtual

Prints the version of the user interface.

Implements CmdLineOptions.

Definition at line 322 of file PIGCmdLineOptions.cc.

322 {
323 PIGCLITextGenerator textGenerator;
324 std::cerr <<
325 textGenerator.text(PIGCLITextGenerator::TXT_CLI_TITLE).str()
326 << " "
328 str() << std::endl;
329}

References Texts::TextGenerator::text(), PIGCLITextGenerator::TXT_CLI_TITLE, and PIGCLITextGenerator::TXT_CLI_VERSION.

Referenced by printHelp().

Here is the call graph for this function:

◆ progeOutputDirectory()

std::string PIGCmdLineOptions::progeOutputDirectory ( ) const

Returns the proge output directory. Empty if not given

Returns
proge output directory

Definition at line 303 of file PIGCmdLineOptions.cc.

303 {
305}

References CmdLineParser::findOption(), HDL_OUTPUT_DIR, and CmdLineOptionParser::String().

Here is the call graph for this function:

◆ programImageOutputFormat()

std::string PIGCmdLineOptions::programImageOutputFormat ( ) const

Returns the program image output format given as command line parameter.

Returns
The output format.

Definition at line 200 of file PIGCmdLineOptions.cc.

200 {
202}

References CmdLineParser::findOption(), PI_FORMAT_PARAM_NAME, and CmdLineOptionParser::String().

Here is the call graph for this function:

◆ showCompressors()

bool PIGCmdLineOptions::showCompressors ( ) const

Tells whether to show code compressor descriptions or not.

Definition at line 293 of file PIGCmdLineOptions.cc.

293 {
295}

References CmdLineParser::findOption(), CmdLineOptionParser::isFlagOn(), and SHOW_COMPRESSORS_PARAM_NAME.

Referenced by PIGCmdLineOptions().

Here is the call graph for this function:

◆ tpefFile()

std::string PIGCmdLineOptions::tpefFile ( int  index) const

Returns the name of the TPEF file given as command line parameter.

Returns
The name of the TPEF file.

Definition at line 185 of file PIGCmdLineOptions.cc.

185 {
187 if (index < 0 || index >= tpefFileCount()) {
188 throw OutOfRange(__FILE__, __LINE__, __func__);
189 }
190
191 return option->String(index + 1);
192}

References __func__, CmdLineParser::findOption(), CmdLineOptionParser::String(), TPEF_PARAM_NAME, and tpefFileCount().

Referenced by PIGCmdLineOptions().

Here is the call graph for this function:

◆ tpefFileCount()

int PIGCmdLineOptions::tpefFileCount ( ) const

Returns the number of TPEF files given.

Returns
The number of TPEF files.

Definition at line 174 of file PIGCmdLineOptions.cc.

174 {
176}

References CmdLineParser::findOption(), CmdLineOptionParser::listSize(), and TPEF_PARAM_NAME.

Referenced by tpefFile().

Here is the call graph for this function:

Member Data Documentation

◆ BEM_PARAM_NAME

const std::string PIGCmdLineOptions::BEM_PARAM_NAME = "bem"
staticprivate

Long name of the BEM file parameter.

Definition at line 67 of file PIGCmdLineOptions.hh.

Referenced by bemFile(), and PIGCmdLineOptions().

◆ COMPRESSOR_PARAM_NAME

const std::string PIGCmdLineOptions::COMPRESSOR_PARAM_NAME = "compressor"
staticprivate

Long name of the plugin file parameter.

Definition at line 75 of file PIGCmdLineOptions.hh.

Referenced by compressorPlugin(), and PIGCmdLineOptions().

◆ COMPRESSOR_PARAMS_PARAM_NAME

const std::string PIGCmdLineOptions::COMPRESSOR_PARAMS_PARAM_NAME
staticprivate
Initial value:
=
"compressor param"

Long name of parameter passed to code compressor plugin.

Definition at line 87 of file PIGCmdLineOptions.hh.

Referenced by compressorParameter(), compressorParameterCount(), and PIGCmdLineOptions().

◆ DATA_IMG_PARAM_NAME

const std::string PIGCmdLineOptions::DATA_IMG_PARAM_NAME = "dataimages"
staticprivate

Long name of the parameter that defines whether to create data images.

Definition at line 78 of file PIGCmdLineOptions.hh.

Referenced by generateDataImages(), and PIGCmdLineOptions().

◆ DATA_START

const std::string PIGCmdLineOptions::DATA_START = "data-start"
staticprivate

Definition at line 93 of file PIGCmdLineOptions.hh.

Referenced by dataStart(), and PIGCmdLineOptions().

◆ DI_FORMAT_PARAM_NAME

const std::string PIGCmdLineOptions::DI_FORMAT_PARAM_NAME = "diformat"
staticprivate

Long name of the data image output format parameter.

Definition at line 73 of file PIGCmdLineOptions.hh.

Referenced by dataImageOutputFormat(), and PIGCmdLineOptions().

◆ DMEM_WIDTH_IN_MAUS_PARAM_NAME

const std::string PIGCmdLineOptions::DMEM_WIDTH_IN_MAUS_PARAM_NAME
staticprivate
Initial value:
=
"dmemwidthinmaus"

Long name of the parameter that tells the width of data mem in MAUs.

Definition at line 83 of file PIGCmdLineOptions.hh.

Referenced by dataMemoryWidthInMAUs(), and PIGCmdLineOptions().

◆ GEN_DECOMP_PARAM_NAME

const std::string PIGCmdLineOptions::GEN_DECOMP_PARAM_NAME = "decompressor"
staticprivate

Long name of the parameter that tells whether to generate decompressor or not.

Definition at line 81 of file PIGCmdLineOptions.hh.

Referenced by generateDecompressor(), and PIGCmdLineOptions().

◆ HDL_OUTPUT_DIR

const std::string PIGCmdLineOptions::HDL_OUTPUT_DIR = "hdl-dir"
staticprivate

Long name of the parameter which tells the proge-output dir.

Definition at line 91 of file PIGCmdLineOptions.hh.

Referenced by PIGCmdLineOptions(), and progeOutputDirectory().

◆ IMEM_WIDTH_IN_MAUS_PARAM_NAME

const std::string PIGCmdLineOptions::IMEM_WIDTH_IN_MAUS_PARAM_NAME
staticprivate

Long name of the paramter that tells the width of inst mem in MAUs.

Definition at line 85 of file PIGCmdLineOptions.hh.

◆ PI_FORMAT_PARAM_NAME

const std::string PIGCmdLineOptions::PI_FORMAT_PARAM_NAME = "piformat"
staticprivate

Long name of the program image output format parameter.

Definition at line 71 of file PIGCmdLineOptions.hh.

Referenced by PIGCmdLineOptions(), and programImageOutputFormat().

◆ SHOW_COMPRESSORS_PARAM_NAME

const std::string PIGCmdLineOptions::SHOW_COMPRESSORS_PARAM_NAME
staticprivate
Initial value:
=
"showcompressors"

Long name of the parameter that tells whether to show compressors.

Definition at line 89 of file PIGCmdLineOptions.hh.

Referenced by PIGCmdLineOptions(), and showCompressors().

◆ TPEF_PARAM_NAME

const std::string PIGCmdLineOptions::TPEF_PARAM_NAME = "program"
staticprivate

Long name of the TPEF file parameter.

Definition at line 69 of file PIGCmdLineOptions.hh.

Referenced by PIGCmdLineOptions(), tpefFile(), and tpefFileCount().


The documentation for this class was generated from the following files: