OpenASIP  2.0
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Types | Private Attributes | List of all members
ProGe::ICDecoderGeneratorPlugin Class Referenceabstract

#include <ICDecoderGeneratorPlugin.hh>

Inheritance diagram for ProGe::ICDecoderGeneratorPlugin:
Inheritance graph
Collaboration diagram for ProGe::ICDecoderGeneratorPlugin:
Collaboration graph

Public Member Functions

 ICDecoderGeneratorPlugin (const TTAMachine::Machine &machine, const BinaryEncoding &bem, const std::string &description)
 
virtual ~ICDecoderGeneratorPlugin ()
 
virtual void completeNetlist (NetlistBlock &netlistBlock, const NetlistGenerator &generator)=0
 
virtual void generate (HDL language, const std::string &destinationDirectory, const NetlistGenerator &generator, const IDF::MachineImplementation &implementation, const std::string &entityString)=0
 
virtual std::set< int > requiredRFLatencies (const TTAMachine::ImmediateUnit &iu) const =0
 
virtual void verifyCompatibility () const =0
 
virtual void writeGlobalDefinitions (HDL language, std::ostream &pkgStream) const =0
 
std::string pluginDescription () const
 
int recognizedParameterCount () const
 
std::string recognizedParameter (int index) const
 
std::string parameterDescription (const std::string &paramName) const
 
void setParameter (const std::string &name, const std::string &value)
 
const TTAMachine::Machinemachine () const
 
const BinaryEncodingbem () const
 
virtual void readParameters ()=0
 

Protected Member Functions

void addParameter (const std::string &name, const std::string &description)
 
bool hasParameterSet (const std::string &name) const
 
std::string parameterValue (const std::string &name) const
 

Static Protected Member Functions

static TTAMachine::Socket::Direction convertDirection (HDB::Direction direction)
 

Private Types

typedef std::map< std::string, std::string > StringMap
 Map type for strings. More...
 

Private Attributes

const TTAMachine::Machinemachine_
 The machine to generate. More...
 
const BinaryEncodingbem_
 The binary encoding map. More...
 
StringMap parameterValues_
 Parameters set. More...
 
StringMap parameterDescriptions_
 Parameter descriptions. More...
 
std::string description_
 Description of the plugin. More...
 

Detailed Description

Base class for plugins that are able to generate and IC and decoder.

Todo:
Add rest of the methods.

Definition at line 68 of file ICDecoderGeneratorPlugin.hh.

Member Typedef Documentation

◆ StringMap

typedef std::map<std::string, std::string> ProGe::ICDecoderGeneratorPlugin::StringMap
private

Map type for strings.

Definition at line 151 of file ICDecoderGeneratorPlugin.hh.

Constructor & Destructor Documentation

◆ ICDecoderGeneratorPlugin()

ProGe::ICDecoderGeneratorPlugin::ICDecoderGeneratorPlugin ( const TTAMachine::Machine machine,
const BinaryEncoding bem,
const std::string &  description 
)

Constructor.

Parameters
machineThe machine to generate the IC&decoder for.

Definition at line 48 of file ICDecoderGeneratorPlugin.cc.

51  :
52  machine_(machine), bem_(bem), description_(description) {
53 
54 }

◆ ~ICDecoderGeneratorPlugin()

ProGe::ICDecoderGeneratorPlugin::~ICDecoderGeneratorPlugin ( )
virtual

Destructor.

Definition at line 60 of file ICDecoderGeneratorPlugin.cc.

60  {
61 }

Member Function Documentation

◆ addParameter()

void ProGe::ICDecoderGeneratorPlugin::addParameter ( const std::string &  name,
const std::string &  description 
)
protected

Adds the given parameter to the set of recognized parameters.

Parameters
nameName of the parameter.
descriptionDescription of the parameter.

Definition at line 159 of file ICDecoderGeneratorPlugin.cc.

161  {
162 
163  parameterDescriptions_.erase(name);
164  parameterDescriptions_.insert(
165  std::pair<string, string>(name, description));
166 }

References parameterDescriptions_.

◆ bem()

const BinaryEncoding & ProGe::ICDecoderGeneratorPlugin::bem ( ) const

Returns the binary encoding map.

Returns
The binary encoding map.

Definition at line 214 of file ICDecoderGeneratorPlugin.cc.

214  {
215  return bem_;
216 }

References bem_.

◆ completeNetlist()

virtual void ProGe::ICDecoderGeneratorPlugin::completeNetlist ( NetlistBlock netlistBlock,
const NetlistGenerator generator 
)
pure virtual

Completes the given netlist block by adding IC block and completing the decoder block by adding the ports connected to IC. Connects also IC to all the units in the machine.

Parameters
coreBlockThe netlist block to complete.
generatorThe netlist generator which generated the netlist.

Implemented in DefaultICDecoderGenerator.

Referenced by ProGe::NetlistGenerator::generate().

◆ convertDirection()

static TTAMachine::Socket::Direction ProGe::ICDecoderGeneratorPlugin::convertDirection ( HDB::Direction  direction)
staticprotected

◆ generate()

virtual void ProGe::ICDecoderGeneratorPlugin::generate ( HDL  language,
const std::string &  destinationDirectory,
const NetlistGenerator generator,
const IDF::MachineImplementation implementation,
const std::string &  entityString 
)
pure virtual

Generates the interconnection network and instruction decoder to the given destination directory.

Parameters
destinationDirectoryThe destination directory.
generatorThe netlist generator that generated the netlist block.

Implemented in DefaultICDecoderGenerator.

Referenced by ProGe::ProcessorGenerator::generateProcessor().

◆ hasParameterSet()

bool ProGe::ICDecoderGeneratorPlugin::hasParameterSet ( const std::string &  name) const
protected

Tells whether the plugin has the given parameter set.

Parameters
nameName of the parameter.
Returns
True if the given parameter is set, otherwise false.

Definition at line 176 of file ICDecoderGeneratorPlugin.cc.

176  {
178 }

References MapTools::containsKey(), and parameterValues_.

Referenced by parameterValue().

Here is the call graph for this function:

◆ machine()

const TTAMachine::Machine & ProGe::ICDecoderGeneratorPlugin::machine ( ) const

Returns the machine.

Returns
The machine.

Definition at line 203 of file ICDecoderGeneratorPlugin.cc.

203  {
204  return machine_;
205 }

References machine_.

◆ parameterDescription()

std::string ProGe::ICDecoderGeneratorPlugin::parameterDescription ( const std::string &  paramName) const

Returns the description of the given parameter.

Parameters
paramNameName of the parameter.
Returns
The description of the parameter.
Exceptions
IllegalParameterIf the given parameter is unrecognized.

Definition at line 121 of file ICDecoderGeneratorPlugin.cc.

122  {
123  try {
124  return MapTools::valueForKey<string>(
125  parameterDescriptions_, paramName);
126  } catch (const KeyNotFound& e) {
127  throw IllegalParameters(
128  __FILE__, __LINE__, __func__, e.errorMessage());
129  }
130 }

References __func__, Exception::errorMessage(), and parameterDescriptions_.

Here is the call graph for this function:

◆ parameterValue()

std::string ProGe::ICDecoderGeneratorPlugin::parameterValue ( const std::string &  name) const
protected

Returns the value of the given parameter.

Parameters
nameName of the parameter.
Returns
Value of the parameter.
Exceptions
KeyNotFoundIf the given parameter is not set.

Definition at line 189 of file ICDecoderGeneratorPlugin.cc.

189  {
190  if (!hasParameterSet(name)) {
191  throw KeyNotFound(__FILE__, __LINE__, __func__);
192  }
193 
194  return MapTools::valueForKey<string>(parameterValues_, name);
195 }

References __func__, hasParameterSet(), and parameterValues_.

Here is the call graph for this function:

◆ pluginDescription()

std::string ProGe::ICDecoderGeneratorPlugin::pluginDescription ( ) const

Returns the description of the plugin.

Returns
The description.

Definition at line 70 of file ICDecoderGeneratorPlugin.cc.

70  {
71  return description_;
72 }

References description_.

◆ readParameters()

virtual void ProGe::ICDecoderGeneratorPlugin::readParameters ( )
pure virtual

◆ recognizedParameter()

std::string ProGe::ICDecoderGeneratorPlugin::recognizedParameter ( int  index) const

Returns the name of a recognized parameter by the given index.

Parameters
indexThe index.
Returns
The name of the parameter.
Exceptions
OutOfRangeIf the given index is negative or not smaller than the number of recognized parameters.

Definition at line 95 of file ICDecoderGeneratorPlugin.cc.

95  {
96  if (index < 0 || index >= recognizedParameterCount()) {
97  throw OutOfRange(__FILE__, __LINE__, __func__);
98  }
99 
100  int i = 0;
101  for (StringMap::const_iterator iter = parameterDescriptions_.begin();
102  iter != parameterDescriptions_.end(); iter++) {
103  if (i == index) {
104  return iter->first;
105  }
106  i++;
107  }
108 
109  assert(false);
110  return "";
111 }

References __func__, assert, parameterDescriptions_, and recognizedParameterCount().

Here is the call graph for this function:

◆ recognizedParameterCount()

int ProGe::ICDecoderGeneratorPlugin::recognizedParameterCount ( ) const

Returns the number of recognized parameters.

Returns
The number of recognized parameters.

Definition at line 81 of file ICDecoderGeneratorPlugin.cc.

81  {
82  return parameterDescriptions_.size();
83 }

References parameterDescriptions_.

Referenced by recognizedParameter().

◆ requiredRFLatencies()

virtual std::set<int> ProGe::ICDecoderGeneratorPlugin::requiredRFLatencies ( const TTAMachine::ImmediateUnit iu) const
pure virtual

Returns the set of acceptable latencies of the hardware implementation of the given immediate unit.

Parameters
iuThe immediate unit.

Implemented in DefaultICDecoderGenerator.

Referenced by ProGe::ProcessorGenerator::checkIULatencies().

◆ setParameter()

void ProGe::ICDecoderGeneratorPlugin::setParameter ( const std::string &  name,
const std::string &  value 
)

Sets the given parameter for the plugin.

Parameters
nameName of the parameter.
valueValue of the parameter.
Exceptions
IllegalParameterIf the given parameter is unrecognized.

Definition at line 140 of file ICDecoderGeneratorPlugin.cc.

141  {
143  string errorMsg = "Unrecognized IC/decoder plugin parameter: " +
144  name;
145  throw IllegalParameters(__FILE__, __LINE__, __func__, errorMsg);
146  }
147 
148  parameterValues_.erase(name);
149  parameterValues_.insert(std::pair<string, string>(name, value));
150 }

References __func__, MapTools::containsKey(), parameterDescriptions_, and parameterValues_.

Referenced by ProGe::ProGeUI::generateProcessor().

Here is the call graph for this function:

◆ verifyCompatibility()

virtual void ProGe::ICDecoderGeneratorPlugin::verifyCompatibility ( ) const
pure virtual

Verifies that the plugin is compatible with the machine.

Exceptions
InvalidDataIf the plugin is not compatible with the machine.

Implemented in DefaultICDecoderGenerator.

Referenced by ProGe::ProcessorGenerator::generateProcessor().

◆ writeGlobalDefinitions()

virtual void ProGe::ICDecoderGeneratorPlugin::writeGlobalDefinitions ( HDL  language,
std::ostream &  pkgStream 
) const
pure virtual

Returns global package definitions in the form of a stream specifically for the variable length instruction architecture.

Parameters
languageThe HDL to use.
pkgStreamThe destination stream

Implemented in DefaultICDecoderGenerator.

Referenced by ProGe::ProcessorGenerator::generateGlobalsPackage().

Member Data Documentation

◆ bem_

const BinaryEncoding& ProGe::ICDecoderGeneratorPlugin::bem_
private

The binary encoding map.

Definition at line 156 of file ICDecoderGeneratorPlugin.hh.

Referenced by bem().

◆ description_

std::string ProGe::ICDecoderGeneratorPlugin::description_
private

Description of the plugin.

Definition at line 162 of file ICDecoderGeneratorPlugin.hh.

Referenced by pluginDescription().

◆ machine_

const TTAMachine::Machine& ProGe::ICDecoderGeneratorPlugin::machine_
private

The machine to generate.

Definition at line 154 of file ICDecoderGeneratorPlugin.hh.

Referenced by machine().

◆ parameterDescriptions_

StringMap ProGe::ICDecoderGeneratorPlugin::parameterDescriptions_
private

◆ parameterValues_

StringMap ProGe::ICDecoderGeneratorPlugin::parameterValues_
private

Parameters set.

Definition at line 158 of file ICDecoderGeneratorPlugin.hh.

Referenced by hasParameterSet(), parameterValue(), and setParameter().


The documentation for this class was generated from the following files:
ProGe::ICDecoderGeneratorPlugin::hasParameterSet
bool hasParameterSet(const std::string &name) const
Definition: ICDecoderGeneratorPlugin.cc:176
OutOfRange
Definition: Exception.hh:320
ProGe::ICDecoderGeneratorPlugin::bem
const BinaryEncoding & bem() const
Definition: ICDecoderGeneratorPlugin.cc:214
ProGe::ICDecoderGeneratorPlugin::machine_
const TTAMachine::Machine & machine_
The machine to generate.
Definition: ICDecoderGeneratorPlugin.hh:154
ProGe::ICDecoderGeneratorPlugin::bem_
const BinaryEncoding & bem_
The binary encoding map.
Definition: ICDecoderGeneratorPlugin.hh:156
assert
#define assert(condition)
Definition: Application.hh:86
ProGe::ICDecoderGeneratorPlugin::description_
std::string description_
Description of the plugin.
Definition: ICDecoderGeneratorPlugin.hh:162
IllegalParameters
Definition: Exception.hh:113
__func__
#define __func__
Definition: Application.hh:67
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
MapTools::containsKey
static bool containsKey(const MapType &aMap, const KeyType &aKey)
ProGe::ICDecoderGeneratorPlugin::parameterDescriptions_
StringMap parameterDescriptions_
Parameter descriptions.
Definition: ICDecoderGeneratorPlugin.hh:160
ProGe::ICDecoderGeneratorPlugin::parameterValues_
StringMap parameterValues_
Parameters set.
Definition: ICDecoderGeneratorPlugin.hh:158
KeyNotFound
Definition: Exception.hh:285
ProGe::ICDecoderGeneratorPlugin::recognizedParameterCount
int recognizedParameterCount() const
Definition: ICDecoderGeneratorPlugin.cc:81
ProGe::ICDecoderGeneratorPlugin::machine
const TTAMachine::Machine & machine() const
Definition: ICDecoderGeneratorPlugin.cc:203