torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::bitstream::Assembler Class Referenceabstract

Base class for bitstream assembly. More...

#include <Assembler.hpp>

+ Inheritance diagram for torc::bitstream::Assembler:
+ Collaboration diagram for torc::bitstream::Assembler:

Public Types

enum  EOperation { eAND, eOR, eXOR, eNOT }
 Permissible operations on LUT frames. More...
 
enum  EMergeMode { eSet, eClear }
 
typedef std::string string
 Imported type name. More...
 
typedef std::istream istream
 Imported type name. More...
 
typedef
torc::physical::DesignSharedPtr 
DesignSharedPtr
 Imported type name. More...
 
typedef
torc::physical::InstanceSharedPtr 
InstanceSharedPtr
 Imported type name. More...
 
typedef torc::architecture::DDB DDB
 Imported type name. More...
 
typedef boost::filesystem::path path
 Imported type name. More...
 
typedef std::map< const string,
std::vector< string > > 
CompoundSettingMap
 Element name to vector of related element names that collectively affect bits. More...
 
typedef std::map< const string,
std::vector< uint32_t > > 
ConfigValuesToBits
 Map from config value to vector of config bits. ConfigValuesToBits. More...
 
typedef std::map< const string,
ConfigValuesToBits
ConfigSettingsToValues
 Map from config setting to config values. ConfigSettingsToValues. More...
 
typedef std::map< const string,
ConfigSettingsToValues
SiteTypeToConfigSettings
 Map from site type to config settings. SiteTypeToConfigSettings. More...
 
typedef std::map< const string,
SiteTypeToConfigSettings
TileTypeToSiteType
 Map from tile type to site types. Includes routing as a site type. More...
 
typedef std::map< int32_t, map
< int32_t, uint32_t > > 
FrameWords
 Currently not in use. Datastructure to store LUT frames in efficient and flexible way. More...
 

Public Member Functions

 Assembler (DDB &inDB)
 Constructor take only Xdl design pointer. More...
 
virtual ~Assembler (void)
 Destructor does not do anything. More...
 
virtual int generateBitstream (DesignSharedPtr inDesignPtr, const path inTargetBitstreamPath, EMergeMode inMergeMode=eSet, path baseBitstreamPath=path())
 Function to generate bitstream, takes target bitstream path and optional base bitstream path. More...
 
bool processLut (const string &input, const string &name="string stream")
 Import Lut expression from a string. More...
 
void error (const location &l, const string &m)
 Lut parse error handling. More...
 
void error (const string &m)
 Lut general error handling. More...
 
void failure (void)
 Signals a parsing failure by deasserting the success flag. More...
 
void binaryLutFrameOperation (EOperation inOperation)
 Function called from parser when it encounters a bit operator. More...
 
void pushLutFrame (string inLiteral)
 Function called from parser when it encounters a literal. More...
 

Static Public Member Functions

static int hexCharacterToDec (char inDigit)
 Convert a hex ASCII character to a decimal value. More...
 

Data Fields

bool mTraceScanning
 Enable debug output in the flex scanner. More...
 
bool mTraceParsing
 Enable debug output in the bison parser. More...
 
string mStreamName
 Name of file or input stream for error messages. More...
 
class torc::LutScannerlexer
 Pointer to the current lexer instance. More...
 

Protected Member Functions

void initialize (void)
 Initializations done in constructor. More...
 
void convertXdlToBitstream (void)
 Initiates Xdl to bitstream conversion. More...
 
void saveBitstream (void)
 Save bitstream. More...
 
void assembleInstances (void)
 Assemble bitstream for instances. More...
 
void assembleNets (void)
 Assemble bitstream for nets. More...
 
void assembleRamb (torc::physical::InstanceSharedPtr inInstancePtr)
 Assemble bitstream for Ramb. More...
 
string getTiletypeFromSitename (const string &inSiteType)
 Get tile type from site type. More...
 
virtual void checkValidityAndMergeBitstream (string inElementName, string inConfigValue, const ConfigSettingsToValues &inConfigMap)
 Verify the configuratino and merge with base bitstream. More...
 
virtual bool isLutEquationSetting (const string &inConfigValue)
 Is config value a LUT equation. More...
 
virtual bool isRoutethrough (const string &inSetting)
 Is config a _ROUTETHROUGH. More...
 
virtual bool isLutRamOrRomSetting (const string &inConfigVal)
 Is config value a LUT ram setting. More...
 
virtual bool isRambSite (const string &inSiteType)
 Returns true if the site is some form of RAMB site. More...
 
virtual bool isConfigValHexString (const string &inSiteType, const string &inElementName)
 Does the configuration have hex string in config value. More...
 
bool isMemoryInitSetting (const string &inConfigName)
 Is ramb memory init setting. More...
 
bool isMemoryParityInitSetting (const string &inConfigName)
 Is ramb parity init setting. More...
 
bool tileAndSiteExistInLibrary (const string &inTileType, const string &inSiteType)
 Is site present in library database ToDo: This function will need tile type also. More...
 
bool elementAndConfigExistInLibrary (const string &inElementName, const string &configValue, ConfigSettingsToValues &inConfigSettingToValues)
 Is configuration present in given map. More...
 
virtual void getAnnotatedSiteTypeForSlicel (string &inOutSiteType, const string &siteLocation)
 If slice site type, annotate type as per even or odd column. More...
 
void mergeLutEquationBits (const string &inElementName, const string &inConfigValue, ConfigSettingsToValues &inConfigSettingToValues)
 Merge micro-bitstream for Lut equation. More...
 
void mergeLutRamOrRomBits (const string &inElementName, const string &inConfigVal, ConfigSettingsToValues &inConfigSettingToValues)
 Merge micro-bitsram for Lut in ram/rom mode. More...
 
void mergeCompoundSettingBits (string inElement1Name, string inConfig1Val, InstanceSharedPtr inInstancePtr, const ConfigSettingsToValues &inConfigSettingToValues)
 Merge micro-bitstream for compound setting. More...
 
void mergeHexConfigBits (string inElementName, string inConfigVal, const ConfigSettingsToValues &inConfigSettingToValues)
 Merge micro-bitstream for configuration with Hex values. More...
 
void mergeRambInitBits (const string &inConfigVal, uint32_t inMemoryInitRow, const vector< uint32_t > &inBitAddresses, uint32_t inBlock)
 Merge micro-bitstreams for ramb memory init values. More...
 
void populateLibraryMap (path inLibDBPath)
 Read micro-bitstream library file and populate it in a map. More...
 
bool isBigEndianMachine ()
 Check if processor is big endian. More...
 
void readWord (std::ifstream &fileStream, uint32_t &outWord)
 Read word from stream and convert endianness if required. More...
 
uint32_t reverseEndianness (uint32_t inWord)
 Reverse endianness of input word. More...
 
virtual bool isSiteTypeSupported (const string &inSiteType)=0
 Is site supporeted for Xdl to bitstream conversion. More...
 
virtual void initializeFrameDataForSite (const string &inSiteName)=0
 Store frame blocks and bit offset for given site. More...
 
virtual void initializeFrameDataForTile (TileIndex inTileIndex)=0
 Store frame blocks and bit offset for given tile index. More...
 
virtual vector< stringgetDependantConfigs (string inElement1Name)=0
 Returs vector of related configurations. More...
 
virtual bool isCompoundSetting (string inElementName)=0
 Does element need compound setting. More...
 
virtual void mergeWithBaseBitstream (const vector< uint32_t > &inBitAddresses, uint32_t inBlockIndex)=0
 Merge micro-bitstream with base bitstream. More...
 

Protected Attributes

torc::physical::DesignSharedPtr mDesignPtr
 Xdl design pointer. More...
 
path mTargetBitstreamPath
 Target bitstream path. More...
 
EMergeMode mMergeMode
 Merge mode - set bits or clear bits. More...
 
TileTypeToSiteType mLibrary
 Micro-bitstream library in map datastructure. More...
 
const torc::architecture::DDBmDB
 Torc database of architecutre on which design is implemented. More...
 
const torc::architecture::SitesmSites
 Sites from the architecture database. More...
 
const torc::architecture::TilesmTiles
 Tiles from architecture database. More...
 
bool mFreeDB
 To track if DB object was allocated in constructor. More...
 
torc::bitstream::BitstreamSharedPtr mBitstreamPtr
 
boost::filesystem::path mLibraryPath
 Pointer to bitstream object to which micro bitstreams are merged. More...
 
string mParentFamilyName
 
bool mSuccess
 Flag signaling parsing success. More...
 
bool mBigEndian
 
vector< vector< uint32_t > > mLutFrameSetStack
 Frame set for literals are pushed to this stack. More...
 
uint32_t mLutCurrentReferenceFrameIndex
 Address of 1st frame being affected by Lut equation. More...
 
uint32_t mCurrentReferenceWordIndex
 Address of 1st work within frame affected by Lut equation. More...
 
std::vector< uint32_t > mLutFrameSetForOne
 Frame set for Lut output assigned to 1. More...
 
ConfigValuesToBits mCurrentConfigToBitMap
 Map from Lut config value to micro-bitstreams. More...
 
string mLutCurrentEquationLhs
 LHS of Lut equation currently being processed. More...
 
int mUnsupportedTileTypeCount
 
int mUnsupportedTileCount
 
int mUnsupportedPipCount
 
int mUnsupportedInstCount
 
int mMissingConfigs
 
std::set< std::string > mUnsupportedTileTypeSet
 

Static Protected Attributes

static const string sLibraryRelativePath = "torc/bitstream/assembler/libraries"
 Path to library folder containing mirco-bitstream database. More...
 
static const string sLibraryExtension = ".ldb"
 Extension used for micro-bitstream libraries. More...
 
static const string sConfigOff = "#OFF"
 String used when an element is explicity configured off. More...
 
static const boost::regex sLutRamOrRomConfigRegEx
 Regex to identify Luts configured as ram/rom. More...
 
static const boost::regex sLutConfigRegEx
 Regex to identify Lut configuration. More...
 
static const boost::regex sRoutethroughRegEx
 Regex to indentify ROUTETHROUGH configuration in instances. More...
 

Friends

class torc::LutParser
 The LutParse has access to our members. More...
 

Detailed Description

Base class for bitstream assembly.

Definition at line 46 of file Assembler.hpp.

Member Typedef Documentation

typedef std::map<const string, std::vector<string> > torc::bitstream::Assembler::CompoundSettingMap

Element name to vector of related element names that collectively affect bits.

Definition at line 71 of file Assembler.hpp.

Map from config setting to config values. ConfigSettingsToValues.

Definition at line 75 of file Assembler.hpp.

typedef std::map<const string, std::vector<uint32_t> > torc::bitstream::Assembler::ConfigValuesToBits

Map from config value to vector of config bits. ConfigValuesToBits.

Definition at line 73 of file Assembler.hpp.

Imported type name.

Definition at line 65 of file Assembler.hpp.

Imported type name.

Definition at line 61 of file Assembler.hpp.

typedef std::map<int32_t, map<int32_t, uint32_t> > torc::bitstream::Assembler::FrameWords

Currently not in use. Datastructure to store LUT frames in efficient and flexible way.

Definition at line 81 of file Assembler.hpp.

Imported type name.

Definition at line 59 of file Assembler.hpp.

typedef boost::filesystem::path torc::bitstream::Assembler::path

Imported type name.

Definition at line 67 of file Assembler.hpp.

Map from site type to config settings. SiteTypeToConfigSettings.

Definition at line 77 of file Assembler.hpp.

Imported type name.

Definition at line 57 of file Assembler.hpp.

Map from tile type to site types. Includes routing as a site type.

Definition at line 79 of file Assembler.hpp.

Member Enumeration Documentation

Permissible operations on LUT frames.

Enumerator
eAND 
eOR 
eXOR 
eNOT 

Definition at line 51 of file Assembler.hpp.

Constructor & Destructor Documentation

torc::bitstream::Assembler::Assembler ( DDB inDB)
inline

Constructor take only Xdl design pointer.

Constructor takes Xdl design pointer and architecture database object

Definition at line 90 of file Assembler.hpp.

90  : mTraceScanning(false),
91  mTraceParsing(false), mDB(inDB), mSites(mDB.getSites()),
92  mTiles(mDB.getTiles()), mFreeDB(false) {
93  initialize();
94  }
bool mTraceParsing
Enable debug output in the bison parser.
Definition: Assembler.hpp:110
const Tiles & getTiles(void) const
Returns a constant reference to the family and device tile data.
Definition: DDB.hpp:146
const Sites & getSites(void) const
Returns a constant reference to the family and device site data.
Definition: DDB.hpp:144
void initialize(void)
Initializations done in constructor.
Definition: Assembler.cpp:46
bool mTraceScanning
Enable debug output in the flex scanner.
Definition: Assembler.hpp:108
const torc::architecture::DDB & mDB
Torc database of architecutre on which design is implemented.
Definition: Assembler.hpp:312
const torc::architecture::Sites & mSites
Sites from the architecture database.
Definition: Assembler.hpp:313
bool mFreeDB
To track if DB object was allocated in constructor.
Definition: Assembler.hpp:315
const torc::architecture::Tiles & mTiles
Tiles from architecture database.
Definition: Assembler.hpp:314

+ Here is the call graph for this function:

virtual torc::bitstream::Assembler::~Assembler ( void  )
inlinevirtual

Destructor does not do anything.

Definition at line 96 of file Assembler.hpp.

96  {
97  if(mFreeDB)
98  delete &mDB;
99  }
const torc::architecture::DDB & mDB
Torc database of architecutre on which design is implemented.
Definition: Assembler.hpp:312
bool mFreeDB
To track if DB object was allocated in constructor.
Definition: Assembler.hpp:315

Member Function Documentation

void torc::bitstream::Assembler::assembleInstances ( void  )
protected

Assemble bitstream for instances.

Function to assemble micro-bitstreams for instances of Xdl design. This function iterates over instances, stores frame blocks and bit offset within for site location, and then iterates over config settings of the instance. Ramb instances are handled in separate function. Special cases for configurations are - lut equations, lut in ram/rom mode, compound configuration, and configuration with hex values.

Definition at line 123 of file Assembler.cpp.

123  {
124 
125  std::cout << "Assembling micro-bitstream for instances... count: " << mDesignPtr->getInstanceCount() <<
126  std::endl;
127  // Get instances begin and end
128  InstanceSharedPtrVector::const_iterator pInstance = mDesignPtr->instancesBegin();
129  InstanceSharedPtrVector::const_iterator eInstance = mDesignPtr->instancesEnd();
130 
131  // Iterate over all the instances
132  while(pInstance != eInstance) {
133 
134  InstanceSharedPtr instancePtr = *pInstance++;
135  string siteType = instancePtr->getType();
136  // Check if instance is placed on supported site type
137  //if(isSiteTypeSupported(siteType) ) {
138 
139  const string &siteName = instancePtr->getSite();
140  if(siteName.empty()) {
141  std::cout << " WARNING: Unplaced instance " << instancePtr->getName() << endl;
142  continue;
143  }
144  const string &tileType = getTiletypeFromSitename(siteName);
145  std::cout << " Processing instance " << instancePtr->getName() << " placed on site "
146  << siteName << " in tile " << tileType << " with " << instancePtr->getConfigCount() << " configs set."
147  << std::endl;
148 
149  getAnnotatedSiteTypeForSlicel(siteType, siteName);
150  if(!tileAndSiteExistInLibrary(tileType, siteType))
151  continue;
152  // Store frame blocks and bit offset for current site location
153  initializeFrameDataForSite(siteName);
154 
155  // RAMB sites are handled in a slightly different manner
156  if(isRambSite(siteType)) {
157  assembleRamb(instancePtr);
158  } else {
159 
160  // Get the element to config map for the given site type
161  SiteTypeToConfigSettings sitetypeToConfigSettings = mLibrary[tileType];
162  ConfigSettingsToValues configSettingToValuesMap = sitetypeToConfigSettings[siteType];
163 
164  // Go over all the configurations of the instance
165  ConfigMap::const_iterator pConfig = instancePtr->configBegin();
166  ConfigMap::const_iterator eConfig = instancePtr->configEnd();
167 
168  while(pConfig != eConfig) {
169 
170  // Ignore routethrough config setting as they don't set bits in bitstream
171  if(isRoutethrough(pConfig->first)) {
172  pConfig++;
173  continue;
174  }
175 
176  // std::cout << "\tWorking on config " << pConfig->first << "::"
177  // << pConfig->second.getValue() << std::endl;
178  // Lut equation has to be handled differently from other config setting.
179  // The boolean operation in the LUT equation have to be performed on the relevant bits.
180  if(isLutEquationSetting(pConfig->second.getValue())) {
181  mergeLutEquationBits(pConfig->first, pConfig->second.getValue(), configSettingToValuesMap);
182  } // LUT ROM and RAM settings also need special care
183  else if(isLutRamOrRomSetting(pConfig->second.getValue())) {
184  mergeLutRamOrRomBits(pConfig->first, pConfig->second.getValue(), configSettingToValuesMap);
185  } // Some elements together effect the bitstream.
186  else if(isCompoundSetting(pConfig->first)) {
187  mergeCompoundSettingBits(pConfig->first, pConfig->second.getValue(),
188  instancePtr, configSettingToValuesMap);
189  } // The DSP MASK and PATTERN have hex values
190  else if(isConfigValHexString(instancePtr->getType(), pConfig->first)) {
191  mergeHexConfigBits(pConfig->first, pConfig->second.getValue(), configSettingToValuesMap);
192  } else {
193  // Merge compressed bitstream to main bitstream if valid setting
194  checkValidityAndMergeBitstream(pConfig->first, pConfig->second.getValue(),
195  configSettingToValuesMap);
196  }
197  //std::cout << "\t------------------" << std::endl;
198  pConfig++;
199  }
200  }
201  // } else {
202  // std::cout << "WARNING: Site " << instancePtr->getType() << " not supported."
203  // << std::endl;
204  // }
205  }
206 
207 }
void mergeHexConfigBits(string inElementName, string inConfigVal, const ConfigSettingsToValues &inConfigSettingToValues)
Merge micro-bitstream for configuration with Hex values.
Definition: Assembler.cpp:590
string getTiletypeFromSitename(const string &inSiteType)
Get tile type from site type.
Definition: Assembler.cpp:345
virtual void checkValidityAndMergeBitstream(string inElementName, string inConfigValue, const ConfigSettingsToValues &inConfigMap)
Verify the configuratino and merge with base bitstream.
Definition: Assembler.cpp:357
virtual bool isLutRamOrRomSetting(const string &inConfigVal)
Is config value a LUT ram setting.
Definition: Assembler.hpp:187
virtual bool isCompoundSetting(string inElementName)=0
Does element need compound setting.
std::map< const string, ConfigValuesToBits > ConfigSettingsToValues
Map from config setting to config values. ConfigSettingsToValues.
Definition: Assembler.hpp:75
virtual bool isLutEquationSetting(const string &inConfigValue)
Is config value a LUT equation.
Definition: Assembler.hpp:179
virtual bool isConfigValHexString(const string &inSiteType, const string &inElementName)
Does the configuration have hex string in config value.
Definition: Assembler.hpp:200
bool tileAndSiteExistInLibrary(const string &inTileType, const string &inSiteType)
Is site present in library database ToDo: This function will need tile type also. ...
Definition: Assembler.hpp:222
virtual bool isRoutethrough(const string &inSetting)
Is config a _ROUTETHROUGH.
Definition: Assembler.hpp:183
void assembleRamb(torc::physical::InstanceSharedPtr inInstancePtr)
Assemble bitstream for Ramb.
Definition: Assembler.cpp:260
const_iterator const_iterator
Constant iterator to {setting,Config} pairs.
Definition: ConfigMap.hpp:52
void mergeCompoundSettingBits(string inElement1Name, string inConfig1Val, InstanceSharedPtr inInstancePtr, const ConfigSettingsToValues &inConfigSettingToValues)
Merge micro-bitstream for compound setting.
Definition: Assembler.cpp:550
virtual void initializeFrameDataForSite(const string &inSiteName)=0
Store frame blocks and bit offset for given site.
boost::shared_ptr< Instance > InstanceSharedPtr
Shared pointer encapsulation of an Instance.
virtual void getAnnotatedSiteTypeForSlicel(string &inOutSiteType, const string &siteLocation)
If slice site type, annotate type as per even or odd column.
Definition: Assembler.cpp:396
void mergeLutEquationBits(const string &inElementName, const string &inConfigValue, ConfigSettingsToValues &inConfigSettingToValues)
Merge micro-bitstream for Lut equation.
Definition: Assembler.cpp:420
std::map< const string, ConfigSettingsToValues > SiteTypeToConfigSettings
Map from site type to config settings. SiteTypeToConfigSettings.
Definition: Assembler.hpp:77
void mergeLutRamOrRomBits(const string &inElementName, const string &inConfigVal, ConfigSettingsToValues &inConfigSettingToValues)
Merge micro-bitsram for Lut in ram/rom mode.
Definition: Assembler.cpp:491
TileTypeToSiteType mLibrary
Micro-bitstream library in map datastructure.
Definition: Assembler.hpp:311
torc::physical::DesignSharedPtr mDesignPtr
Xdl design pointer.
Definition: Assembler.hpp:308
virtual bool isRambSite(const string &inSiteType)
Returns true if the site is some form of RAMB site.
Definition: Assembler.hpp:193

+ Here is the call graph for this function:

void torc::bitstream::Assembler::assembleNets ( void  )
protected

Assemble bitstream for nets.

Function to assemble micro-bitstreams for net of Xdl design.

Definition at line 210 of file Assembler.cpp.

210  {
211  // Get the iterators to nets
212  NetSharedPtrVector::const_iterator pNets = mDesignPtr->netsBegin();
213  NetSharedPtrVector::const_iterator eNets = mDesignPtr->netsEnd();
214 
215  std::cout << "Assembling micro-bitstreams for Nets... count: " << mDesignPtr->getNetCount()
216  << std::endl;
217  // Iterate over nets
218  while(pNets != eNets) {
219 
220  NetSharedPtr netPtr = *pNets;
221  // std::cout << " Processing net: " << netPtr->getName() << std::endl;
222 
223  // Iterate over pips in the net
224  Net::PipConstIterator pPips = netPtr->pipsBegin();
225  Net::PipConstIterator ePips = netPtr->pipsEnd();
226  while(pPips != ePips) {
227  Pip pip = *pPips++;
228  // Store frame blocks and bit offset for this tile
229  TileIndex tileIndex = mTiles.findTileIndex(pip.getTileName());
230  initializeFrameDataForTile(tileIndex);
231 
232  const TileInfo& tileInfo = mTiles.getTileInfo(tileIndex);
233  string tileType = mTiles.getTileTypeName(tileInfo.getTypeIndex());
234  if(!tileAndSiteExistInLibrary(tileType, "routing")) {
236  continue;
237  }
238  ConfigSettingsToValues configSettingToValuesMap = mLibrary[tileType]["routing"];
239  // std::cout << "\tTile " << tileInfo.getName() << " Src: " << pip.getSourceWireName()
240  // << " Sink: " << pip.getSinkWireName() << std::endl;
242  configSettingToValuesMap);
243 
244  }
245 
246  pNets++;
247  }
248 
249 }
Encapsulation of a tile index in an unsigned 32-bit integer.
virtual void checkValidityAndMergeBitstream(string inElementName, string inConfigValue, const ConfigSettingsToValues &inConfigMap)
Verify the configuratino and merge with base bitstream.
Definition: Assembler.cpp:357
std::map< const string, ConfigValuesToBits > ConfigSettingsToValues
Map from config setting to config values. ConfigSettingsToValues.
Definition: Assembler.hpp:75
PipVector::const_iterator PipConstIterator
Constant iterator to Pip objects.
const TileInfo & getTileInfo(TileIndex inTileIndex) const
Returns the TileInfo object for the specified tile.
Definition: Tiles.hpp:137
bool tileAndSiteExistInLibrary(const string &inTileType, const string &inSiteType)
Is site present in library database ToDo: This function will need tile type also. ...
Definition: Assembler.hpp:222
const WireName & getSinkWireName(void) const
Returns the pip sink wire.
Definition: Pip.hpp:77
Encapsulation of a tile within a device tile map.
Definition: TileInfo.hpp:33
boost::shared_ptr< Net > NetSharedPtr
Shared pointer encapsulation of a Net.
const char * getTileTypeName(TileTypeIndex inTileTypeIndex) const
Returns the tile type name for the given tile type index.
Definition: Tiles.hpp:164
const TileTypeIndex & getTypeIndex(void) const
Returns the tile type index for this tile.
Definition: TileInfo.hpp:92
TileIndex findTileIndex(const string &inName) const
Returns the tile index for the given tile name.
Definition: Tiles.hpp:170
const TileName & getTileName(void) const
Returns the pip tile.
Definition: Pip.hpp:73
Physical design programmable interconnect point.
Definition: Pip.hpp:34
const WireName & getSourceWireName(void) const
Returns the pip source wire.
Definition: Pip.hpp:75
TileTypeToSiteType mLibrary
Micro-bitstream library in map datastructure.
Definition: Assembler.hpp:311
torc::physical::DesignSharedPtr mDesignPtr
Xdl design pointer.
Definition: Assembler.hpp:308
virtual void initializeFrameDataForTile(TileIndex inTileIndex)=0
Store frame blocks and bit offset for given tile index.
const torc::architecture::Tiles & mTiles
Tiles from architecture database.
Definition: Assembler.hpp:314

+ Here is the call graph for this function:

void torc::bitstream::Assembler::assembleRamb ( torc::physical::InstanceSharedPtr  inInstancePtr)
protected

Assemble bitstream for Ramb.

Assemble micro-bitstream for ramb site. First the base micro-bitstream is merged. Micro-bitstream info for memory and parity init values are gathered from ll files.

Definition at line 260 of file Assembler.cpp.

260  {
261  // Get the element to config map for the given site type
262  const string &tileType = getTiletypeFromSitename(inInstancePtr->getSite());
263  ConfigSettingsToValues configSettingToValuesMap = mLibrary[tileType][inInstancePtr->getType()];
264 
265  // Open the RAMBIT memory file and store data in a vector
266  // This file stores memory address to bitstream address map
267  string memoryMapFileName = mParentFamilyName + "-" + tileType + "-map.bits";
268  string rambMemoryMapFilePath = mLibraryPath.string() + "/memory/" + memoryMapFileName;
269  std::ifstream rambMemoryBitFile(rambMemoryMapFilePath.c_str(), std::ios::binary);
270  if(!rambMemoryBitFile.is_open()) {
271  std::cout << "Could not open bram memory map file " << rambMemoryMapFilePath << std::endl;
272  return;
273  }
274 
275  std::vector<uint32_t> bitAddresses;
276  uint32_t count = 0, bitAddress = 0;
277  while(!rambMemoryBitFile.eof()) {
278  // Alternate number is ignored.
279  rambMemoryBitFile.read((char *) &count, 4);
280  rambMemoryBitFile.read((char *) &bitAddress, 4);
281  bitAddress = ntohl(bitAddress);
282  bitAddresses.push_back(bitAddress);
283  }
284  rambMemoryBitFile.close();
285 
286  // Open the RAMB parity bit file and store the data in a vector
287  string parMapFileName = mParentFamilyName + "-" + tileType + "-map-par.bits";
288  string rambParityBitFilePath = mLibraryPath.string() + "/memory/" + parMapFileName;
289  std::ifstream rambParityBitFile(rambParityBitFilePath.c_str(), std::ios::binary);
290  if(!rambParityBitFile.is_open()) {
291  std::cerr << "ERROR: Could not open file " << rambParityBitFilePath << std::endl;
292  return;
293  }
294  std::vector<uint32_t> parityBitAddresses;
295  count = 0, bitAddress = 0;
296  while(!rambParityBitFile.eof()) {
297  rambParityBitFile.read((char *) &count, 4);
298  rambParityBitFile.read((char *) &bitAddress, 4);
299  bitAddress = ntohl(bitAddress);
300  parityBitAddresses.push_back(bitAddress);
301  }
302  rambParityBitFile.close();
303 
304  // Before going over configs, merge the RAMB base bits.
305  mergeWithBaseBitstream(configSettingToValuesMap[inInstancePtr->getType()]["BASE"], 0);
306 
307  // Go over all the configurations of the instance
308  ConfigMap::const_iterator pConfig = inInstancePtr->configBegin();
309  ConfigMap::const_iterator eConfig = inInstancePtr->configEnd();
310  while(pConfig != eConfig) {
311 
312  std::cout << "\tWorking on config " << pConfig->first << "::"
313  << pConfig->second.getValue() << std::endl;
314 
315  // ToDo: Most of the code for memory and parity is same with only the bit address being different.
316  // Try to merge the two if statements.
317  // RAMB memory and parity init values have to be handled differently.
318  if(isMemoryInitSetting(pConfig->first)) {
319 
320  // Get the row number from config name. Last two character are row number in hex form.
321  stringstream ssRow;
322  uint32_t memoryInitRow;
323  ssRow << std::hex << pConfig->first.substr(pConfig->first.length() - 2, 2);
324  ssRow >> memoryInitRow;
325 
326  mergeRambInitBits(pConfig->second.getValue(), memoryInitRow, bitAddresses, 1);
327  } else if(isMemoryParityInitSetting(pConfig->first)) {
328 
329  // Get the row number from config name. Last two character are row number in hex form.
330  stringstream ssRow;
331  uint32_t memoryInitRow;
332  ssRow << std::hex << pConfig->first.substr(pConfig->first.length() - 2, 2);
333  ssRow >> memoryInitRow;
334  mergeRambInitBits(pConfig->second.getValue(), memoryInitRow, parityBitAddresses, 1);
335  } else {
336  // Merge compressed bitstream to main bitstream
337  checkValidityAndMergeBitstream(pConfig->first, pConfig->second.getValue(), configSettingToValuesMap);
338  }
339  pConfig++;
340  }
341 }
bool isMemoryInitSetting(const string &inConfigName)
Is ramb memory init setting.
Definition: Assembler.hpp:212
string getTiletypeFromSitename(const string &inSiteType)
Get tile type from site type.
Definition: Assembler.cpp:345
virtual void checkValidityAndMergeBitstream(string inElementName, string inConfigValue, const ConfigSettingsToValues &inConfigMap)
Verify the configuratino and merge with base bitstream.
Definition: Assembler.cpp:357
std::map< const string, ConfigValuesToBits > ConfigSettingsToValues
Map from config setting to config values. ConfigSettingsToValues.
Definition: Assembler.hpp:75
void mergeRambInitBits(const string &inConfigVal, uint32_t inMemoryInitRow, const vector< uint32_t > &inBitAddresses, uint32_t inBlock)
Merge micro-bitstreams for ramb memory init values.
Definition: Assembler.cpp:614
const_iterator const_iterator
Constant iterator to {setting,Config} pairs.
Definition: ConfigMap.hpp:52
bool isMemoryParityInitSetting(const string &inConfigName)
Is ramb parity init setting.
Definition: Assembler.hpp:217
boost::filesystem::path mLibraryPath
Pointer to bitstream object to which micro bitstreams are merged.
Definition: Assembler.hpp:317
TileTypeToSiteType mLibrary
Micro-bitstream library in map datastructure.
Definition: Assembler.hpp:311
virtual void mergeWithBaseBitstream(const vector< uint32_t > &inBitAddresses, uint32_t inBlockIndex)=0
Merge micro-bitstream with base bitstream.

+ Here is the call graph for this function:

void torc::bitstream::Assembler::binaryLutFrameOperation ( Assembler::EOperation  inOperation)

Function called from parser when it encounters a bit operator.

Perform bit operation on two frame set from stack for lut operation.

Definition at line 747 of file Assembler.cpp.

747  {
748 
749  bool debug = false;
750  if(debug) {
751  std::cout << "In DoBinaryOperation " << inOperation << std::endl;
752  }
753  std::vector<uint32_t> lutWords1 = mLutFrameSetStack.back();
754  std::vector<uint32_t> lutWordsNew;
755  mLutFrameSetStack.pop_back();
756  std::vector<uint32_t> lutWords2;
757  if(inOperation == eOR || inOperation == eAND || inOperation == eXOR) {
758  lutWords2 = mLutFrameSetStack.back();
759  mLutFrameSetStack.pop_back();
760  } else if(inOperation == eNOT) {
761  lutWords2 = mLutFrameSetForOne;
762  } else {
763  cout << "WARNING: Unknown LUT operation " << inOperation << std::endl;
764  return;
765  }
766  std::vector<uint32_t>::const_iterator pWord1 = lutWords1.begin();
767  std::vector<uint32_t>::const_iterator eWord1 = lutWords1.end();
768  std::vector<uint32_t>::const_iterator pWord2 = lutWords2.begin();
769  std::vector<uint32_t>::const_iterator eWord2 = lutWords2.end();
770  if(inOperation == eOR) {
771  while(pWord1 != eWord1 && pWord2 != eWord2) {
772  lutWordsNew.push_back((*pWord1 | *pWord2));
773  pWord1++;
774  pWord2++;
775  }
776  } else if(inOperation == eAND) {
777  while(pWord1 != eWord1) {
778  lutWordsNew.push_back((*pWord1 & *pWord2));
779  pWord1++;
780  pWord2++;
781  }
782  } else if(inOperation == eXOR || inOperation == eNOT) {
783  while(pWord1 != eWord1) {
784  lutWordsNew.push_back((*pWord1 ^ *pWord2));
785  pWord1++;
786  pWord2++;
787  }
788  }
789 
790  if(debug) {
791  std::cout << "LUT frames after the logic " << std::endl;
792  for(std::vector<uint32_t>::const_iterator iter = lutWordsNew.begin(); iter
793  != lutWordsNew.end(); iter++) {
794  std::cout << " " << Hex32(*iter);
795  }
796  std::cout << std::endl;
797  }
798 
799  mLutFrameSetStack.push_back(lutWordsNew);
800 }
std::vector< uint32_t > mLutFrameSetForOne
Frame set for Lut output assigned to 1.
Definition: Assembler.hpp:325
vector< vector< uint32_t > > mLutFrameSetStack
Frame set for literals are pushed to this stack.
Definition: Assembler.hpp:322

+ Here is the caller graph for this function:

void torc::bitstream::Assembler::checkValidityAndMergeBitstream ( string  inElementName,
string  inConfigValue,
const ConfigSettingsToValues inConfigMap 
)
protectedvirtual

Verify the configuratino and merge with base bitstream.

Check if configurations is present in library. If yes, merge the corresponding bits with the bitstream.

Definition at line 357 of file Assembler.cpp.

358  {
359 
360  ConfigSettingsToValues::const_iterator pConfigSettings = inConfigSettingToValues.find(inElementName);
361  // If element found in the map
362  if(pConfigSettings != inConfigSettingToValues.end()) {
363  ConfigValuesToBits::const_iterator pConfigValues = pConfigSettings->second.find(inConfigVal);
364  //If config value found in the config to bit map
365  if(pConfigValues != pConfigSettings->second.end()) {
366  // std::cout << " Setting: " << inElementName << " . Config: " << inConfigVal << std::endl;
367  mergeWithBaseBitstream(pConfigValues->second, 0);
368  } else {
369  mMissingConfigs++;
370  std::cout << "WARNING: Config value " << inConfigVal << " for setting " << inElementName
371  << " not found in library." << std::endl;
372  }
373  } else {
374  mMissingConfigs++;
375  std::cout << "WARNING: Config setting " << inElementName << " not found in library." << std::endl;
376  }
377 }
virtual void mergeWithBaseBitstream(const vector< uint32_t > &inBitAddresses, uint32_t inBlockIndex)=0
Merge micro-bitstream with base bitstream.
void torc::bitstream::Assembler::convertXdlToBitstream ( void  )
protected

Initiates Xdl to bitstream conversion.

Protected function to internally initiate micro-bitstream assembly process. This function should be called after design ptr, base bitstream, and library have be initialized.

Definition at line 104 of file Assembler.cpp.

104  {
106 
107  assembleNets();
108 
109  std::cout << "Unsupported tile type count " << mUnsupportedTileTypeSet.size() << std::endl;
110  for(std::set<std::string>::iterator iter = mUnsupportedTileTypeSet.begin(); iter != mUnsupportedTileTypeSet.end(); iter++) {
111  std::cout << " " << *iter << std::endl;
112  }
113  std::cout << "Unsupported tile count : " << mUnsupportedTileCount << std::endl;
114  std::cout << "Unsupported pip count : " << mUnsupportedPipCount << std::endl;
115  std::cout << "Missing configs of supported tiles : " << mMissingConfigs << std::endl;
116 
117 }
std::set< std::string > mUnsupportedTileTypeSet
Definition: Assembler.hpp:334
void assembleNets(void)
Assemble bitstream for nets.
Definition: Assembler.cpp:210
void assembleInstances(void)
Assemble bitstream for instances.
Definition: Assembler.cpp:123

+ Here is the call graph for this function:

bool torc::bitstream::Assembler::elementAndConfigExistInLibrary ( const string inElementName,
const string configValue,
ConfigSettingsToValues inConfigSettingToValues 
)
protected

Is configuration present in given map.

Returns true if configuration is preseRnt in library.

Definition at line 379 of file Assembler.cpp.

380  {
381  // Check if element exists
382  ConfigSettingsToValues::iterator pConfigSettings = inConfigSettingToValues.find(inElementName);
383  if(pConfigSettings != inConfigSettingToValues.end()) {
384 
385  // Check if config exists
386  ConfigValuesToBits::iterator pConfigValues = pConfigSettings->second.find(inConfigValue);
387  if(pConfigValues != pConfigSettings->second.end())
388  return true;
389  }
390  std::cout << "WARNING: Config setting " << inElementName << " with value " << inConfigValue
391  << " not found in library" << std::endl;
392  return false;
393 }
void torc::bitstream::Assembler::error ( const location l,
const string m 
)

Lut parse error handling.

Definition at line 849 of file Assembler.cpp.

849  {
850  failure();
851  cerr << l << ": " << m << std::endl;
852 }
void failure(void)
Signals a parsing failure by deasserting the success flag.
Definition: Assembler.hpp:135

+ Here is the caller graph for this function:

void torc::bitstream::Assembler::error ( const string m)

Lut general error handling.

Definition at line 854 of file Assembler.cpp.

854  {
855  failure();
856  cerr << m << std::endl;
857 }
void failure(void)
Signals a parsing failure by deasserting the success flag.
Definition: Assembler.hpp:135
void torc::bitstream::Assembler::failure ( void  )
inline

Signals a parsing failure by deasserting the success flag.

Definition at line 135 of file Assembler.hpp.

135 { mSuccess = false; }
bool mSuccess
Flag signaling parsing success.
Definition: Assembler.hpp:319
int torc::bitstream::Assembler::generateBitstream ( DesignSharedPtr  inDesignPtr,
const path  inTargetBitstreamPath,
EMergeMode  inMergeMode = eSet,
path  baseBitstreamPath = path() 
)
virtual

Function to generate bitstream, takes target bitstream path and optional base bitstream path.

Reimplemented in torc::bitstream::VirtexAssembler.

Definition at line 64 of file Assembler.cpp.

67  {
68 
69  mDesignPtr = inDesignPtr;
70  mMergeMode = inMergeMode;
71  mTargetBitstreamPath = inTargetBitstreamPath;
72 
73  if(mDesignPtr->getDevice() != mDB.getDeviceName()) {
74  std::cout << "Xdl device differs from database device" << std::endl;
75  return -1;
76  }
77  // User hasn't specified base bitstream path
78  if(baseBitstreamPath.empty()) {
79  // Null bitstreams are stored in library folder
80 
81  const string partNumber = mDesignPtr->getDevice();
82  string nullBitFileName = partNumber + ".bit";
83  baseBitstreamPath = mLibraryPath / "null_bitstreams" / nullBitFileName;
84  }
85  if(!boost::filesystem::exists(baseBitstreamPath)) {
86  std::cout << "Base bitstream file - " << baseBitstreamPath.string()
87  << " - does not exist." << std::endl;
88  return -1;
89  }
90  // Load the base bitstream file
91  std::cout << "Loading base bitstream " << baseBitstreamPath << std::endl;
92  std::ifstream baseBitstream;
93  baseBitstream.open(baseBitstreamPath.string().c_str());
95  // Initialize different settings of bitstream object.
96  mBitstreamPtr->setDesignName(mDesignPtr->getName());
97  mBitstreamPtr->initializeDeviceInfo(mBitstreamPtr->getDeviceName());
98  mBitstreamPtr->initializeFrameMaps();
99  return 0;
100 }
const string & getDeviceName(void) const
Returns the device name.
Definition: DDB.hpp:132
torc::bitstream::BitstreamSharedPtr mBitstreamPtr
Definition: Assembler.hpp:316
path mTargetBitstreamPath
Target bitstream path.
Definition: Assembler.hpp:309
EMergeMode mMergeMode
Merge mode - set bits or clear bits.
Definition: Assembler.hpp:310
const torc::architecture::DDB & mDB
Torc database of architecutre on which design is implemented.
Definition: Assembler.hpp:312
static BitstreamSharedPtr newBitstreamPtr(const boost::filesystem::path &inPath)
boost::filesystem::path mLibraryPath
Pointer to bitstream object to which micro bitstreams are merged.
Definition: Assembler.hpp:317
torc::physical::DesignSharedPtr mDesignPtr
Xdl design pointer.
Definition: Assembler.hpp:308

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::bitstream::Assembler::getAnnotatedSiteTypeForSlicel ( string inOutSiteType,
const string siteLocation 
)
protectedvirtual

If slice site type, annotate type as per even or odd column.

Definition at line 396 of file Assembler.cpp.

396  {
397 
398  if(boost::regex_search(inOutSiteType.begin(), inOutSiteType.end(), boost::regex("SLICEL"))){
399  // Get the column number of site location
400  boost::smatch matchResults;
401  boost::regex columnExpr("_X(\\d+)Y");
402  if(boost::regex_search(siteLocation, matchResults, columnExpr)) {
403  // First match is the whole string
404  int column = boost::lexical_cast<int>(matchResults[1]);
405  if(column % 2 == 0)
406  inOutSiteType = inOutSiteType + "E";
407  else
408  inOutSiteType = inOutSiteType + "O";
409  }
410  }
411 }
virtual vector<string> torc::bitstream::Assembler::getDependantConfigs ( string  inElement1Name)
protectedpure virtual

Returs vector of related configurations.

Implemented in torc::bitstream::Virtex5Assembler, torc::bitstream::Virtex7Assembler, and torc::bitstream::VirtexAssembler.

string torc::bitstream::Assembler::getTiletypeFromSitename ( const string inSiteName)
protected

Get tile type from site type.

Get tile type from site location(name) ToDo: A lot of this code is present in initializeFrameDataForSite()

Definition at line 345 of file Assembler.cpp.

345  {
346  SiteIndex siteIndex = mSites.findSiteIndex(inSiteName);
347  const Site& site = mSites.getSite(siteIndex);
348  TileIndex tileIndex = site.getTileIndex();
349  const TileInfo& tileInfo = mTiles.getTileInfo(tileIndex);
350  string tileType = mTiles.getTileTypeName(tileInfo.getTypeIndex());
351  return tileType;
352 
353 }
Encapsulation of a tile index in an unsigned 32-bit integer.
const TileInfo & getTileInfo(TileIndex inTileIndex) const
Returns the TileInfo object for the specified tile.
Definition: Tiles.hpp:137
Encapsulation of a device logic site.
Definition: Site.hpp:30
Encapsulation of a tile within a device tile map.
Definition: TileInfo.hpp:33
const char * getTileTypeName(TileTypeIndex inTileTypeIndex) const
Returns the tile type name for the given tile type index.
Definition: Tiles.hpp:164
SiteIndex findSiteIndex(const string &inName) const
Returns the site index for the given site name.
Definition: Sites.hpp:134
TileIndex getTileIndex(void) const
Returns the index of the containing tile.
Definition: Site.hpp:83
const TileTypeIndex & getTypeIndex(void) const
Returns the tile type index for this tile.
Definition: TileInfo.hpp:92
const torc::architecture::Sites & mSites
Sites from the architecture database.
Definition: Assembler.hpp:313
const Site & getSite(SiteIndex inSiteIndex) const
Returns the site for the specified index.
Definition: Sites.hpp:129
Encapsulation of a site index in an unsigned 32-bit integer.
const torc::architecture::Tiles & mTiles
Tiles from architecture database.
Definition: Assembler.hpp:314

+ Here is the call graph for this function:

static int torc::bitstream::Assembler::hexCharacterToDec ( char  inDigit)
inlinestatic

Convert a hex ASCII character to a decimal value.

Returns
The equivalent decimal value, or -1 if the input is not a valid hex digit.

Definition at line 139 of file Assembler.hpp.

139  {
140  // handle numeric hex digits
141  if(inDigit >= '0' && inDigit <= '9') return inDigit - '0';
142  // force lower case to upper case
143  inDigit &= 0xdf;
144  // handle alphabetic hex digits
145  if(inDigit >= 'A' && inDigit <= 'F') return inDigit - 'A' + 10;
146  // reject non-hex digits
147  return -1;
148  }

+ Here is the caller graph for this function:

void torc::bitstream::Assembler::initialize ( void  )
protected

Initializations done in constructor.

Called from constructor to initialize the object. Populates mirco-bitstream data from library in a map.

Definition at line 46 of file Assembler.cpp.

46  {
47 
51  mMissingConfigs = 0;
53  if(!boost::filesystem::exists(mLibraryPath)) {
54  std::cerr << "ERROR: Library folder " << mLibraryPath << " does not exist." << std::endl;
55  throw 1;
56  }
57 
59 }
static const string sLibraryRelativePath
Path to library folder containing mirco-bitstream database.
Definition: Assembler.hpp:336
boost::filesystem::path mLibraryPath
Pointer to bitstream object to which micro bitstreams are merged.
Definition: Assembler.hpp:317
bool isBigEndianMachine()
Check if processor is big endian.
Definition: Assembler.hpp:268
static const boost::filesystem::path & getExecutablePath(void)
Returns the absolute path to the executable directory.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void torc::bitstream::Assembler::initializeFrameDataForSite ( const string inSiteName)
protectedpure virtual

Store frame blocks and bit offset for given site.

Implemented in torc::bitstream::VirtexAssembler.

virtual void torc::bitstream::Assembler::initializeFrameDataForTile ( TileIndex  inTileIndex)
protectedpure virtual

Store frame blocks and bit offset for given tile index.

Implemented in torc::bitstream::Virtex5Assembler, torc::bitstream::Virtex7Assembler, and torc::bitstream::VirtexAssembler.

bool torc::bitstream::Assembler::isBigEndianMachine ( )
inlineprotected

Check if processor is big endian.

Definition at line 268 of file Assembler.hpp.

268  {
269  uint32_t check = 0x01020304;
270  char *p = (char *)&check;
271  return (p[0] == 0x01);
272  }
virtual bool torc::bitstream::Assembler::isCompoundSetting ( string  inElementName)
protectedpure virtual
virtual bool torc::bitstream::Assembler::isConfigValHexString ( const string inSiteType,
const string inElementName 
)
inlineprotectedvirtual

Does the configuration have hex string in config value.

Definition at line 200 of file Assembler.hpp.

201  {
202 
203  if (inSiteType.compare("DSP48E") == 0) {
204  if (inElementName.compare("PATTERN") == 0 || inElementName.compare(
205  "MASK") == 0) {
206  return true;
207  }
208  }
209  return false;
210  }
virtual bool torc::bitstream::Assembler::isLutEquationSetting ( const string inConfigValue)
inlineprotectedvirtual

Is config value a LUT equation.

Definition at line 179 of file Assembler.hpp.

179  {
180  return boost::regex_match(inConfigValue, sLutConfigRegEx);
181  }
static const boost::regex sLutConfigRegEx
Regex to identify Lut configuration.
Definition: Assembler.hpp:340
virtual bool torc::bitstream::Assembler::isLutRamOrRomSetting ( const string inConfigVal)
inlineprotectedvirtual

Is config value a LUT ram setting.

Definition at line 187 of file Assembler.hpp.

187  {
188  return boost::regex_match(inConfigVal, sLutRamOrRomConfigRegEx);
189  }
static const boost::regex sLutRamOrRomConfigRegEx
Regex to identify Luts configured as ram/rom.
Definition: Assembler.hpp:339
bool torc::bitstream::Assembler::isMemoryInitSetting ( const string inConfigName)
inlineprotected

Is ramb memory init setting.

Definition at line 212 of file Assembler.hpp.

212  {
213  return inConfigName.length() == 7 && inConfigName.substr(0, 5).compare(
214  "INIT_") == 0;
215  }
bool torc::bitstream::Assembler::isMemoryParityInitSetting ( const string inConfigName)
inlineprotected

Is ramb parity init setting.

Definition at line 217 of file Assembler.hpp.

217  {
218  return inConfigName.substr(0, 6).compare("INITP_") == 0;
219  }
virtual bool torc::bitstream::Assembler::isRambSite ( const string inSiteType)
inlineprotectedvirtual

Returns true if the site is some form of RAMB site.

This function might have to be reimplemented in different architectures as name of RAMB site might change.

Definition at line 193 of file Assembler.hpp.

193  {
194  if (inSiteType.length() > 3) {
195  return inSiteType.substr(0, 4).compare("RAMB") == 0;
196  }
197  return false;
198  }
virtual bool torc::bitstream::Assembler::isRoutethrough ( const string inSetting)
inlineprotectedvirtual

Is config a _ROUTETHROUGH.

Definition at line 183 of file Assembler.hpp.

183  {
184  return boost::regex_match(inSetting, sRoutethroughRegEx);
185  }
static const boost::regex sRoutethroughRegEx
Regex to indentify ROUTETHROUGH configuration in instances.
Definition: Assembler.hpp:341
bool torc::bitstream::Assembler::isSiteTypeSupported ( const string inSiteType)
protectedpure virtual

Is site supporeted for Xdl to bitstream conversion.

Different architectures will have different sites supported. Derived classes should override this function.

Implemented in torc::bitstream::VirtexAssembler, torc::bitstream::Virtex5Assembler, and torc::bitstream::Virtex7Assembler.

Definition at line 253 of file Assembler.cpp.

253  {
254  return false;
255 }
void torc::bitstream::Assembler::mergeCompoundSettingBits ( string  inElement1Name,
string  inConfig1Val,
InstanceSharedPtr  inInstancePtr,
const ConfigSettingsToValues inConfigSettingToValues 
)
protected

Merge micro-bitstream for compound setting.

Merge micro-bitstream for compound setting. There are some settings which together affect the bitstream.

Definition at line 550 of file Assembler.cpp.

551  {
552 
553  std::vector<string> compoundElements = getDependantConfigs(inElement1Name);
554  // For now assume there is only on element in the vector, i.e. there is a compound
555  // setting with only two elements.
556  if(compoundElements.size() != 1) {
557  std::cout
558  << "WARNING: Compound setting with more than two configurations not handled currently"
559  << std::endl;
560  } else {
561 
562  // The two element names will be concatenated to form a compound element name Element1Element2.
563  // Similarly two config settings will be concatenated to form a compound config name.
564  std::string element2Name = compoundElements[0];
565  std::string compoundElementName = inElement1Name + element2Name;
566 
567  // Find the 2nd element config in the instance
568  std::string config2Val, config2Name;
569  inInstancePtr->getConfig(element2Name, config2Name, config2Val);
570 
571  // Element 2 config not set
572  if(config2Val.compare(sConfigOff) == 0) {
573  std::cout << "Illegal configuration. Element " << element2Name << " must be set "
574  << " along with element " << inElement1Name << std::endl;
575  return;
576  }
577 
578  // Get compound config val
579  std::string compoundConfigVal = inConfig1Val + config2Val;
580 
581  // Verify setting and merge bits
582  checkValidityAndMergeBitstream(compoundElementName, compoundConfigVal, inConfigSettingToValues);
583  }
584 
585 }
virtual void checkValidityAndMergeBitstream(string inElementName, string inConfigValue, const ConfigSettingsToValues &inConfigMap)
Verify the configuratino and merge with base bitstream.
Definition: Assembler.cpp:357
std::string string
virtual vector< string > getDependantConfigs(string inElement1Name)=0
Returs vector of related configurations.
static const string sConfigOff
String used when an element is explicity configured off.
Definition: Assembler.hpp:338

+ Here is the call graph for this function:

void torc::bitstream::Assembler::mergeHexConfigBits ( string  inElementName,
string  inConfigVal,
const ConfigSettingsToValues inConfigSettingToValues 
)
protected

Merge micro-bitstream for configuration with Hex values.

Merge micro-bitstream for configurations with hex values. The hex string is parsed character by character and micro-bitstream for every set bit is retrived from library and merged with base bitstream.

Definition at line 590 of file Assembler.cpp.

591  {
592  std::vector<uint32_t> inBitAddresses;
593 
594  // Go over all the characters of the config val string
595  for(uint32_t charIndex = 0; charIndex < inConfigVal.length(); charIndex++) {
596  stringstream sshexChar;
597  sshexChar << std::hex << inConfigVal[inConfigVal.length() - charIndex - 1];
598  uint32_t hexDigit;
599  sshexChar >> hexDigit;
600  // Go over all the bits of the hex digit
601  for(int bitIndex = 0; hexDigit != 0; bitIndex++) {
602  if(hexDigit & 1) {
603  int configBitIndex = (charIndex << 2) + bitIndex;
604  stringstream ssConfigBitIndex;
605  ssConfigBitIndex << configBitIndex;
606  checkValidityAndMergeBitstream(inElementName, ssConfigBitIndex.str(), inConfigSettingToValues);
607  }
608  hexDigit = hexDigit >> 1;
609  }
610  }
611 }
virtual void checkValidityAndMergeBitstream(string inElementName, string inConfigValue, const ConfigSettingsToValues &inConfigMap)
Verify the configuratino and merge with base bitstream.
Definition: Assembler.cpp:357

+ Here is the call graph for this function:

void torc::bitstream::Assembler::mergeLutEquationBits ( const string inElementName,
const string inConfigValue,
ConfigSettingsToValues inConfigSettingToValues 
)
protected

Merge micro-bitstream for Lut equation.

Merge micro-bitstream for Lut equation. The bit operations (AND, OR, etc.) are performed on the micro-bitstreams corresponding to every literal. Bit operation NOT is performed by XORing with micro-bitstream for LUT output assigned to 1. The lut equation is parsed using bison and flex. When a literal is encountered, the set of frames corresponding to literal is pushed on to a stack. When a bit operator is encountered, two set of frames is poped from the stack and the bit operations is performed on the two set of frames and result is pushed back to stack.

Todo:
Do we really want to abort here just because the user has an incorrect expression?

Definition at line 420 of file Assembler.cpp.

421  {
422 
423  // Get the right hand side and lefthand side of the LUT equation.
424  std::vector<string> splitVector;
425  boost::algorithm::split(splitVector, inConfigValue, boost::algorithm::is_any_of("="));
426 
427  // The left side tell which output (O5 or O6) is being affected. Store it in a global
428  // so that it can be used by functions called from bison
429  mLutCurrentEquationLhs = splitVector[0];
430  string equationRight = splitVector[1];
431 
432  // Store the frames for LUT setting constant 1. XOR with these frames give NOT functionality.
433  string lutEquationForOne = mLutCurrentEquationLhs + "=1";
434 
435  // Currently all the frames of a LUT setting are not stored. We know only 4 words get affected by LUT setting -
436  // 4 frames and a word in each frame. So instead we store only 4 words and the frame index and word index.
437  if(elementAndConfigExistInLibrary(inElementName, lutEquationForOne, inConfigSettingToValues)) {
438  mCurrentConfigToBitMap = inConfigSettingToValues[inElementName];
439  std::vector<uint32_t> bitAddressesForOne = mCurrentConfigToBitMap[lutEquationForOne];
440 
441  mLutCurrentReferenceFrameIndex = bitAddressesForOne[0] >> 16;
442  mCurrentReferenceWordIndex = (bitAddressesForOne[0] & 0x0000FF00) >> 8;
443 
444  mLutFrameSetForOne.clear();
445  mLutFrameSetForOne.resize(4, uint32_t(0));
446  for(std::vector<uint32_t>::const_iterator bitIter = bitAddressesForOne.begin(); bitIter
447  != bitAddressesForOne.end(); bitIter++) {
448  int32_t bitIndex = (*bitIter) & 0x000000FF;
449  int32_t frameIndex = (*bitIter) >> 16;
450  uint32_t frameWord = 1 << (bitIndex - 1);
451 
453  = mLutFrameSetForOne[frameIndex - mLutCurrentReferenceFrameIndex] | frameWord;
454  }
455 
456  if(!processLut(equationRight.c_str(), inConfigValue)) {
457  std::cout << "ERROR: Error in parsing LUT equation " << inConfigValue << std::endl;
458  /// \todo Do we really want to abort here just because the user has an incorrect expression?
459  exit(-1);
460  }
461 
462  // Build bit addresses out of the last frame in gStackOfFrames
463  std::vector<uint32_t> combinedLUTWords = mLutFrameSetStack[0];
464  std::vector<uint32_t> bitAddresses;
465  uint32_t frameOffset = 0;
466  for(std::vector<uint32_t>::const_iterator wordIter = combinedLUTWords.begin(); wordIter
467  != combinedLUTWords.end(); wordIter++, frameOffset++) {
468 
469  uint32_t tempWord = *wordIter;
470  uint32_t bitIndex = 1;
471  while(tempWord != 0) {
472 
473  // check if the LSB is 1
474  if(tempWord & 1) {
475  // store the combined address
476  bitAddresses.push_back(((mLutCurrentReferenceFrameIndex + frameOffset) << 16)
477  | (mCurrentReferenceWordIndex << 8) | bitIndex);
478  }
479  tempWord = tempWord >> 1;
480  bitIndex++;
481  }
482  }
483 
484  mergeWithBaseBitstream(bitAddresses, 0);
485  mLutFrameSetStack.clear();
486  }
487 }
string mLutCurrentEquationLhs
LHS of Lut equation currently being processed.
Definition: Assembler.hpp:327
bool processLut(const string &input, const string &name="string stream")
Import Lut expression from a string.
Definition: Assembler.cpp:835
std::vector< uint32_t > mLutFrameSetForOne
Frame set for Lut output assigned to 1.
Definition: Assembler.hpp:325
ConfigValuesToBits mCurrentConfigToBitMap
Map from Lut config value to micro-bitstreams.
Definition: Assembler.hpp:326
vector< vector< uint32_t > > mLutFrameSetStack
Frame set for literals are pushed to this stack.
Definition: Assembler.hpp:322
uint32_t mLutCurrentReferenceFrameIndex
Address of 1st frame being affected by Lut equation.
Definition: Assembler.hpp:323
virtual void mergeWithBaseBitstream(const vector< uint32_t > &inBitAddresses, uint32_t inBlockIndex)=0
Merge micro-bitstream with base bitstream.
uint32_t mCurrentReferenceWordIndex
Address of 1st work within frame affected by Lut equation.
Definition: Assembler.hpp:324
bool elementAndConfigExistInLibrary(const string &inElementName, const string &configValue, ConfigSettingsToValues &inConfigSettingToValues)
Is configuration present in given map.
Definition: Assembler.cpp:379

+ Here is the call graph for this function:

void torc::bitstream::Assembler::mergeLutRamOrRomBits ( const string inElementName,
const string inConfigVal,
ConfigSettingsToValues inConfigSettingToValues 
)
protected

Merge micro-bitsram for Lut in ram/rom mode.

Merge micro-bitstream for lut in ram/rom mode. The lut ram/rom memory address to bit address map is obtained from ll files.

Definition at line 491 of file Assembler.cpp.

492  {
493 
494  // Since memory content are similar for SLICEL and SLICEM,
495  // they are stored in library under element name SLICE
496  // ConfigSettingsToValues &configSettingToValuesMap = mLibrary["CLBLM"]["SLICE"];
497 
498  // Get the right hand side and lefthand side of the LUT equation.
499  std::vector<string> splitVector;
500  boost::algorithm::split(splitVector, inConfigVal, boost::algorithm::is_any_of("="));
501  // Remove the first two characters - 0x - from the hex value
502  string memoryValue = splitVector[1].substr(2);
503 
504  if(memoryValue.length() != 8 && memoryValue.length() != 16) {
505  std::cout << "WARNING: Illegal configuration of element " << inElementName << std::endl;
506  return;
507  }
508 
509  // When output O5 of LUT is configured, it has only 8 hex characters in the memory string,
510  // and they belong to the higher memory address of 16 hex characters.
511  if(memoryValue.length() == 8) {
512  memoryValue = "00000000" + memoryValue;
513  }
514 
515  // Get the bit address vector
516  // Since X5LUT and X6LUT use the same memory address to bit address map,
517  // element name is changed to use only 1st letter of the name, viz X (A, B, C or D)
518  // and config name is changed to ROM
519  string elementNameForMemoryMode = inElementName.substr(0, 1);
520  std::vector<uint32_t> bitAddressesForROM;
521 
522  if(!elementAndConfigExistInLibrary(elementNameForMemoryMode, "ROM", inConfigSettingToValues))
523  return;
524 
525  bitAddressesForROM = inConfigSettingToValues[elementNameForMemoryMode]["ROM"];
526  std::vector<uint32_t> bitAddresses;
527  // Iterate over the memory string from left to right
528  for(uint32_t charIndex = 0; charIndex < memoryValue.length(); charIndex++) {
529 
530  stringstream sshexChar;
531  sshexChar << std::hex << memoryValue[charIndex];
532  uint32_t hexDigit;
533  sshexChar >> hexDigit;
534  // Go over the bits of the hex digit from left to right
535  for(int bitIndex = 0; hexDigit != 0; bitIndex++) {
536  if(hexDigit & 8) {
537  uint32_t memoryAddress = (charIndex << 2) + bitIndex;
538  stringstream ssConfigBitIndex;
539  ssConfigBitIndex << memoryAddress;
540  bitAddresses.push_back(bitAddressesForROM[memoryAddress]);
541  }
542  hexDigit = hexDigit << 1;
543  }
544  }
545  mergeWithBaseBitstream(bitAddresses, 0);
546 }
virtual void mergeWithBaseBitstream(const vector< uint32_t > &inBitAddresses, uint32_t inBlockIndex)=0
Merge micro-bitstream with base bitstream.
bool elementAndConfigExistInLibrary(const string &inElementName, const string &configValue, ConfigSettingsToValues &inConfigSettingToValues)
Is configuration present in given map.
Definition: Assembler.cpp:379

+ Here is the call graph for this function:

void torc::bitstream::Assembler::mergeRambInitBits ( const string inConfigVal,
uint32_t  inMemoryInitRow,
const vector< uint32_t > &  inRamBitAddress,
uint32_t  inBlock 
)
protected

Merge micro-bitstreams for ramb memory init values.

Merges micro-bitstream for ramb init (both memory and parity) values.

Definition at line 614 of file Assembler.cpp.

615  {
616 
617  vector<uint32_t> bitAddresses; // vector to hold bit addresses of set memory bits
618 
619  uint32_t configValLength = inConfigVal.length();
620  uint32_t numBitsPerConfig = configValLength << 2; // 4 bits every hex character
621 
622  // Go over the memory string from right to left
623  for(uint32_t charIndex = 0; charIndex < configValLength; charIndex++) {
624  //stringstream sshexChar;
625  //sshexChar << std::hex << configVal[configValLength - charIndex - 1];
626  int hexDigit;
627  hexDigit = hexCharacterToDec(inConfigVal[configValLength - charIndex - 1]);
628  //sshexChar >> hexDigit;
629  // Go over the bits of hex digit from right to left
630  for(int bitIndex = 0; hexDigit != 0; bitIndex++) {
631  if(hexDigit & 1) {
632  // Get memory address of set bit taking into account which row of memory is being processed
633  uint32_t configBitIndex = (charIndex << 2) + bitIndex;
634  uint32_t memoryAddress = inMemoryInitRow * numBitsPerConfig + configBitIndex;
635 
636  bitAddresses.push_back(inRamBitAddress[memoryAddress]);
637  }
638  hexDigit = hexDigit >> 1;
639  }
640  }
641  mergeWithBaseBitstream(bitAddresses, inBlock);
642 }
static int hexCharacterToDec(char inDigit)
Convert a hex ASCII character to a decimal value.
Definition: Assembler.hpp:139
virtual void mergeWithBaseBitstream(const vector< uint32_t > &inBitAddresses, uint32_t inBlockIndex)=0
Merge micro-bitstream with base bitstream.
virtual void torc::bitstream::Assembler::mergeWithBaseBitstream ( const vector< uint32_t > &  inBitAddresses,
uint32_t  inBlockIndex 
)
protectedpure virtual

Merge micro-bitstream with base bitstream.

Implemented in torc::bitstream::VirtexAssembler.

void torc::bitstream::Assembler::populateLibraryMap ( path  inLibDBPath)
protected

Read micro-bitstream library file and populate it in a map.

Loads micro-bitstream library from given path and populates the data in a map.

Definition at line 646 of file Assembler.cpp.

646  {
647 
648  std::ifstream libDB(inLibDBPath.string().c_str(), std::ios::binary);
649  if(!libDB.good()) {
650  std::cout << "Could not open micro-bitstream DB file " << inLibDBPath.string() << std::endl;
651  libDB.exceptions(std::ios::failbit);
652  exit(-1);
653  }
654  std::cout << "Opened micro-bitstream DB file " << inLibDBPath.string() << std::endl;
655  char buffer[1024];
656  libDB.read(buffer, 16);
657  buffer[16] = '\0';
658  string libDBSanity(buffer);
659  std::cout << "Sanity string " << libDBSanity << std::endl;
660  if(libDBSanity != "<<<<BITLIBDB>>>>") {
661  std::cout << "This file seems to be currupt- " << inLibDBPath.string() << std::endl;
662  exit(-1);
663  }
664  uint32_t tileTypeCount = 0;
665  readWord(libDB, tileTypeCount);
666  std::cout << "Tile type count " << tileTypeCount << std::endl;
667 
668  for(uint32_t tileIndex = 0; tileIndex < tileTypeCount; tileIndex++) {
669  uint32_t tileNameCharCount = 0;
670  readWord(libDB, tileNameCharCount);
671  libDB.read(buffer, tileNameCharCount);
672  buffer[tileNameCharCount] = '\0';
673  string tileType(buffer);
674  uint32_t sitetypeCount = 0;
675  readWord(libDB, sitetypeCount);
676  std::cout << "Tile type: " << tileType << ". Site count: " << sitetypeCount << std::endl;
677 
678  SiteTypeToConfigSettings sitetypeToSettingsMap;
679 
680  // Iterate over the elements
681  for(uint32_t sitetypeIndex = 0; sitetypeIndex < sitetypeCount; sitetypeIndex++) {
682  // Get element name char count
683  uint32_t sitetypeCharCount = 0;
684  readWord(libDB, sitetypeCharCount);
685  libDB.read(buffer, sitetypeCharCount);
686  buffer[sitetypeCharCount] = '\0';
687  string sitetype(buffer);
688 
689  uint32_t configSettingCount = 0;
690  readWord(libDB, configSettingCount);
691  //std::cout << " Site " << sitetype << ". Config setting count " << configSettingCount << std::endl;
692 
693  ConfigSettingsToValues configSettingToValues;
694 
695  // Iterate over configs
696  for(uint32_t configSettingIndex = 0; configSettingIndex < configSettingCount; configSettingIndex++) {
697  uint32_t configSettingCharCount = 0;
698  readWord(libDB, configSettingCharCount);
699  // std::cout << "\tConfig char count " << configSettingCharCount;
700  libDB.read(buffer, configSettingCharCount);
701  buffer[configSettingCharCount] = '\0';
702  string configSetting(buffer);
703  //std::cout << "\t" << configSetting << std::endl;
704 
705  uint32_t configValuesCount = 0;
706  readWord(libDB, configValuesCount);
707 
708  ConfigValuesToBits configMap;
709 
710  for(uint32_t configValueIndex = 0; configValueIndex < configValuesCount; configValueIndex++) {
711  uint32_t configValueCharCount = 0;
712  readWord(libDB, configValueCharCount);
713  libDB.read(buffer, configValueCharCount);
714  buffer[configValueCharCount] = 0;
715  string configValue(buffer);
716  // Read the compressed word count
717  uint32_t wordCount = 0;
718  readWord(libDB, wordCount);
719  std::vector<uint32_t> addresses;
720  uint32_t word;
721  for(uint32_t i = 0; i < wordCount; i++) {
722  readWord(libDB, word);
723  addresses.push_back(word);
724  }
725  configMap[configValue] = addresses;
726  }
727 
728  configSettingToValues[configSetting] = configMap;
729  }
730  sitetypeToSettingsMap[sitetype] = configSettingToValues;
731  }
732  mLibrary[tileType] = sitetypeToSettingsMap;
733  }
734 }
std::map< const string, ConfigValuesToBits > ConfigSettingsToValues
Map from config setting to config values. ConfigSettingsToValues.
Definition: Assembler.hpp:75
void readWord(std::ifstream &fileStream, uint32_t &outWord)
Read word from stream and convert endianness if required.
Definition: Assembler.hpp:274
std::map< const string, ConfigSettingsToValues > SiteTypeToConfigSettings
Map from site type to config settings. SiteTypeToConfigSettings.
Definition: Assembler.hpp:77
TileTypeToSiteType mLibrary
Micro-bitstream library in map datastructure.
Definition: Assembler.hpp:311
std::map< const string, std::vector< uint32_t > > ConfigValuesToBits
Map from config value to vector of config bits. ConfigValuesToBits.
Definition: Assembler.hpp:73

+ Here is the caller graph for this function:

bool torc::bitstream::Assembler::processLut ( const string input,
const string name = "string stream" 
)

Import Lut expression from a string.

Parameters
inputInput stream.
nameStream name to use for error messages.
Returns
true if successfully parsed.

Definition at line 835 of file Assembler.cpp.

835  {
836  mStreamName = name;
837  istringstream iss(in);
838  mSuccess = true;
839 
840  LutScanner scanner(&iss);
841  scanner.set_debug(mTraceScanning);
842  this->lexer = &scanner;
843  LutParser parser(*this);
844  parser.set_debug_level(mTraceParsing);
845  bool result = parser.parse() == 0;
846  return mSuccess && result;
847 }
bool mTraceParsing
Enable debug output in the bison parser.
Definition: Assembler.hpp:110
string mStreamName
Name of file or input stream for error messages.
Definition: Assembler.hpp:112
A Bison parser.
Definition: LutParser.hpp:144
bool mSuccess
Flag signaling parsing success.
Definition: Assembler.hpp:319
bool mTraceScanning
Enable debug output in the flex scanner.
Definition: Assembler.hpp:108
class torc::LutScanner * lexer
Pointer to the current lexer instance.
Definition: Assembler.hpp:116

+ Here is the call graph for this function:

void torc::bitstream::Assembler::pushLutFrame ( string  inLiteral)

Function called from parser when it encounters a literal.

Push set of frames corresponding to literal passed for current lut equation.

Todo:
May need to find a more general to access and push passthrough frame sets

Definition at line 803 of file Assembler.cpp.

803  {
804  bool debug = false;
805 
806  if(debug) {
807  std::cout << "In PushFrameToStack " << inLiteral << std::endl;
808  }
809 
810  std::vector<uint32_t> bitAddresses = mCurrentConfigToBitMap[mLutCurrentEquationLhs + "="
811  + inLiteral];
812 
813  /// \todo May need to find a more general to access and push passthrough frame sets
814  // We know LUT bits go across 4 frames and effect the same word in each frame
815  std::vector<uint32_t> lutWords(4, 0);
816  for(std::vector<uint32_t>::const_iterator bitIter = bitAddresses.begin(); bitIter
817  != bitAddresses.end(); bitIter++) {
818  int32_t bitIndex = (*bitIter) & 0x000000FF;
819  int32_t frameIndex = (*bitIter) >> 16;
820  uint32_t frameWord = 1 << (bitIndex - 1);
821 
822  lutWords[frameIndex - mLutCurrentReferenceFrameIndex] |= frameWord;
823  }
824 
825  if(debug) {
826  for(std::vector<uint32_t>::const_iterator iter = lutWords.begin(); iter != lutWords.end(); iter++) {
827  std::cout << " " << Hex32(*iter);
828  }
829  std::cout << std::endl;
830  }
831 
832  mLutFrameSetStack.push_back(lutWords);
833 }
string mLutCurrentEquationLhs
LHS of Lut equation currently being processed.
Definition: Assembler.hpp:327
ConfigValuesToBits mCurrentConfigToBitMap
Map from Lut config value to micro-bitstreams.
Definition: Assembler.hpp:326
vector< vector< uint32_t > > mLutFrameSetStack
Frame set for literals are pushed to this stack.
Definition: Assembler.hpp:322
uint32_t mLutCurrentReferenceFrameIndex
Address of 1st frame being affected by Lut equation.
Definition: Assembler.hpp:323

+ Here is the caller graph for this function:

void torc::bitstream::Assembler::readWord ( std::ifstream &  fileStream,
uint32_t &  outWord 
)
inlineprotected

Read word from stream and convert endianness if required.

Definition at line 274 of file Assembler.hpp.

274  {
275  fileStream.read((char *) &outWord, sizeof(uint32_t));
276  if(mBigEndian)
277  outWord = reverseEndianness(outWord);
278  }
uint32_t reverseEndianness(uint32_t inWord)
Reverse endianness of input word.
Definition: Assembler.hpp:280

+ Here is the call graph for this function:

uint32_t torc::bitstream::Assembler::reverseEndianness ( uint32_t  inWord)
inlineprotected

Reverse endianness of input word.

Definition at line 280 of file Assembler.hpp.

280  {
281  uint32_t outWord = 0;
282  char *in = (char *)&inWord;
283  char *out = (char *)&outWord;
284  uint wordSize = sizeof(inWord);
285  for(uint i = 0; i< wordSize; i++) {
286  out[i] = in[wordSize-i-1];
287  }
288  return outWord;
289  }

+ Here is the caller graph for this function:

void torc::bitstream::Assembler::saveBitstream ( void  )
protected

Save bitstream.

Save the assembled bitstream.

Definition at line 737 of file Assembler.cpp.

737  {
738 
739  std::ofstream customBitstreamFile(mTargetBitstreamPath.string().c_str(), std::ios::binary);
740  std::cout << "Writing custom bitstream file " << mTargetBitstreamPath << std::endl;
741  mBitstreamPtr->write(customBitstreamFile);
742 
743  customBitstreamFile.close();
744 }
torc::bitstream::BitstreamSharedPtr mBitstreamPtr
Definition: Assembler.hpp:316
path mTargetBitstreamPath
Target bitstream path.
Definition: Assembler.hpp:309
bool torc::bitstream::Assembler::tileAndSiteExistInLibrary ( const string inTileType,
const string inSiteType 
)
inlineprotected

Is site present in library database ToDo: This function will need tile type also.

Definition at line 222 of file Assembler.hpp.

222  {
223 
224  //unused(inSiteType);
225  TileTypeToSiteType::iterator pTiles = mLibrary.find(inTileType);
226  if(pTiles == mLibrary.end()) {
228  mUnsupportedTileTypeSet.insert(inTileType+"-"+inSiteType);
229  return false;
230  } else {
231  SiteTypeToConfigSettings::iterator pSites = pTiles->second.find(inSiteType);
232  if(pSites == pTiles->second.end()) {
234  mUnsupportedTileTypeSet.insert(inTileType+"-"+inSiteType);
235  return false;
236  }
237  }
238  return true;
239  }
std::set< std::string > mUnsupportedTileTypeSet
Definition: Assembler.hpp:334
TileTypeToSiteType mLibrary
Micro-bitstream library in map datastructure.
Definition: Assembler.hpp:311

Friends And Related Function Documentation

friend class torc::LutParser
friend

The LutParse has access to our members.

Definition at line 158 of file Assembler.hpp.

Field Documentation

class torc::LutScanner* torc::bitstream::Assembler::lexer

Pointer to the current lexer instance.

This serves to connect the parser to the scanner, and is used by the yylex macro.

Definition at line 116 of file Assembler.hpp.

bool torc::bitstream::Assembler::mBigEndian
protected

Definition at line 320 of file Assembler.hpp.

torc::bitstream::BitstreamSharedPtr torc::bitstream::Assembler::mBitstreamPtr
protected

Definition at line 316 of file Assembler.hpp.

ConfigValuesToBits torc::bitstream::Assembler::mCurrentConfigToBitMap
protected

Map from Lut config value to micro-bitstreams.

Definition at line 326 of file Assembler.hpp.

uint32_t torc::bitstream::Assembler::mCurrentReferenceWordIndex
protected

Address of 1st work within frame affected by Lut equation.

Definition at line 324 of file Assembler.hpp.

const torc::architecture::DDB& torc::bitstream::Assembler::mDB
protected

Torc database of architecutre on which design is implemented.

Definition at line 312 of file Assembler.hpp.

torc::physical::DesignSharedPtr torc::bitstream::Assembler::mDesignPtr
protected

Xdl design pointer.

Definition at line 308 of file Assembler.hpp.

bool torc::bitstream::Assembler::mFreeDB
protected

To track if DB object was allocated in constructor.

Definition at line 315 of file Assembler.hpp.

TileTypeToSiteType torc::bitstream::Assembler::mLibrary
protected

Micro-bitstream library in map datastructure.

Definition at line 311 of file Assembler.hpp.

boost::filesystem::path torc::bitstream::Assembler::mLibraryPath
protected

Pointer to bitstream object to which micro bitstreams are merged.

Definition at line 317 of file Assembler.hpp.

string torc::bitstream::Assembler::mLutCurrentEquationLhs
protected

LHS of Lut equation currently being processed.

Definition at line 327 of file Assembler.hpp.

uint32_t torc::bitstream::Assembler::mLutCurrentReferenceFrameIndex
protected

Address of 1st frame being affected by Lut equation.

Definition at line 323 of file Assembler.hpp.

std::vector<uint32_t> torc::bitstream::Assembler::mLutFrameSetForOne
protected

Frame set for Lut output assigned to 1.

Definition at line 325 of file Assembler.hpp.

vector<vector<uint32_t> > torc::bitstream::Assembler::mLutFrameSetStack
protected

Frame set for literals are pushed to this stack.

Definition at line 322 of file Assembler.hpp.

EMergeMode torc::bitstream::Assembler::mMergeMode
protected

Merge mode - set bits or clear bits.

Definition at line 310 of file Assembler.hpp.

int torc::bitstream::Assembler::mMissingConfigs
protected

Definition at line 333 of file Assembler.hpp.

string torc::bitstream::Assembler::mParentFamilyName
protected

Definition at line 318 of file Assembler.hpp.

const torc::architecture::Sites& torc::bitstream::Assembler::mSites
protected

Sites from the architecture database.

Definition at line 313 of file Assembler.hpp.

string torc::bitstream::Assembler::mStreamName

Name of file or input stream for error messages.

Definition at line 112 of file Assembler.hpp.

bool torc::bitstream::Assembler::mSuccess
protected

Flag signaling parsing success.

Definition at line 319 of file Assembler.hpp.

path torc::bitstream::Assembler::mTargetBitstreamPath
protected

Target bitstream path.

Definition at line 309 of file Assembler.hpp.

const torc::architecture::Tiles& torc::bitstream::Assembler::mTiles
protected

Tiles from architecture database.

Definition at line 314 of file Assembler.hpp.

bool torc::bitstream::Assembler::mTraceParsing

Enable debug output in the bison parser.

Definition at line 110 of file Assembler.hpp.

bool torc::bitstream::Assembler::mTraceScanning

Enable debug output in the flex scanner.

Definition at line 108 of file Assembler.hpp.

int torc::bitstream::Assembler::mUnsupportedInstCount
protected

Definition at line 332 of file Assembler.hpp.

int torc::bitstream::Assembler::mUnsupportedPipCount
protected

Definition at line 331 of file Assembler.hpp.

int torc::bitstream::Assembler::mUnsupportedTileCount
protected

Definition at line 330 of file Assembler.hpp.

int torc::bitstream::Assembler::mUnsupportedTileTypeCount
protected

Definition at line 329 of file Assembler.hpp.

std::set<std::string> torc::bitstream::Assembler::mUnsupportedTileTypeSet
protected

Definition at line 334 of file Assembler.hpp.

const string torc::bitstream::Assembler::sConfigOff = "#OFF"
staticprotected

String used when an element is explicity configured off.

Definition at line 338 of file Assembler.hpp.

const string torc::bitstream::Assembler::sLibraryExtension = ".ldb"
staticprotected

Extension used for micro-bitstream libraries.

Definition at line 337 of file Assembler.hpp.

const string torc::bitstream::Assembler::sLibraryRelativePath = "torc/bitstream/assembler/libraries"
staticprotected

Path to library folder containing mirco-bitstream database.

Definition at line 336 of file Assembler.hpp.

const boost::regex torc::bitstream::Assembler::sLutConfigRegEx
staticprotected

Regex to identify Lut configuration.

Definition at line 340 of file Assembler.hpp.

const boost::regex torc::bitstream::Assembler::sLutRamOrRomConfigRegEx
staticprotected

Regex to identify Luts configured as ram/rom.

Definition at line 339 of file Assembler.hpp.

const boost::regex torc::bitstream::Assembler::sRoutethroughRegEx
staticprotected

Regex to indentify ROUTETHROUGH configuration in instances.

Definition at line 341 of file Assembler.hpp.


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