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

#include <Virtex7LibGen.hpp>

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

Public Types

typedef std::string string
 Imported type name. More...
 
typedef boost::filesystem::path path
 Imported type name. More...
 
typedef torc::architecture::DDB DDB
 Imported type name. More...
 
typedef torc::architecture::Sites Sites
 Imported type name. More...
 
typedef torc::architecture::Site Site
 Imported type name. More...
 
typedef torc::architecture::Tiles Tiles
 Imported type name. More...
 
typedef
torc::architecture::TileInfo 
TileInfo
 Imported type name. More...
 
typedef
torc::architecture::xilinx::TileIndex 
TileIndex
 Imported type name. More...
 
typedef
torc::architecture::Tilewire 
Tilewire
 Imported type name. More...
 
typedef
torc::architecture::ExtendedWireInfo 
ExtendedWireInfo
 Imported type name. More...
 
typedef
torc::architecture::PrimitiveElement 
PrimitiveElement
 Imported type name. More...
 
typedef
torc::architecture::PrimitiveElementArray 
PrimitiveElementArray
 Imported type name. More...
 
typedef
torc::physical::DesignSharedPtr 
DesignSharedPtr
 Imported type name. More...
 
typedef
torc::physical::InstanceSharedPtr 
InstanceSharedPtr
 Imported type name. More...
 
typedef
torc::physical::NetSharedPtr 
NetSharedPtr
 Imported type name. More...
 
typedef
torc::packer::PrimitiveStructureSharedPtr 
PrimitiveStructureSharedPtr
 Imported type name. More...
 
typedef
torc::bitstream::BitstreamSharedPtr 
BitstreamSharedPtr
 Imported type name. More...
 
typedef
torc::bitstream::Assembler::ConfigValuesToBits 
ConfigValuesToBits
 
typedef
torc::bitstream::Assembler::ConfigSettingsToValues 
ConfigSettingsToValues
 
typedef
torc::bitstream::Assembler::SiteTypeToConfigSettings 
SiteTypeToConfigSettings
 
typedef
torc::bitstream::Assembler::TileTypeToSiteType 
TileTypeToSiteType
 
typedef
torc::bitstream::Assembler::CompoundSettingMap 
CompoundSettingMap
 Map from one setting to vector of related setings. More...
 
typedef std::map< std::string,
std::set< std::string > > 
TileTypeToSiteTypeSet
 Typedef of map from tile type to set of site type. More...
 
typedef std::map< std::string,
PrimitiveStructureSharedPtr
PrimitiveStructuresSharedPtrMap
 Typedef of map from primitive name to primitive structure shared pointer. More...
 

Public Member Functions

 Virtex7LibGen (string inDevice, path inHarnessFolder, path inXdlGenerationFolder)
 Constructor. More...
 
virtual ~Virtex7LibGen ()
 Destructor. More...
 
void generateLogicXdls ()
 Generrate Xdls for logic sites. More...
 
void generateWireXdls ()
 Generate Xdls for routing pips. More...
 
void generateLogicAndWireXdl ()
 Generate Xdls for both logic sites and routing pips. More...
 
void generateBitstreams ()
 Generate bitstream for all Xdls in mXdlGenerationFolder and mXdlGenerationReferenceFolder. More...
 
void compressBitFiles ()
 Compress all Xilinx bitfiles in mXdlGenerationFolder. More...
 
void stitchMicroBitstreams ()
 Stitch micro-bitstreams in mXdlGenerationFolder. More...
 
TileTypeToSiteTypeSet getTileTypeToSiteTypeMap (void)
 Populate map of tile type to set of include site types. More...
 
void printTileTypeToSiteTypeMapInfo (TileTypeToSiteTypeSet tileTypeToSiteType)
 Print the tile type to site type information. More...
 

Static Public Member Functions

static CompoundSettingMap getCompoundSettingsMap ()
 Returns map of coumpound settings. More...
 

Protected Member Functions

virtual bool isSiteTypeSupported (const string &inSiteType)
 Returns true if site type is supported. More...
 
virtual std::vector< std::string > getTilesSupportedForPips ()
 Returns list of supported tiles. Assumes last tile is "LAST_TILE". More...
 
virtual std::string getRambPrimaryPrimitive ()
 Returns primary primitive for Ramb site type. More...
 
void initialize ()
 Do architecture specific part of initialization. More...
 
std::map< string, stringgetReferenceConfigMap ()
 Get a map from config setting to reference value. More...
 
virtual string getParentFamilyName ()
 Get parent family name. More...
 
virtual void compressBitFile (path primaryFile, path referenceFile)
 Compress given bitstream file against reference bitstream file. More...
 
virtual uint32_t getWordOffsetFromTileLocation (TileRow tileRow, TileCol tileCol, BitstreamSharedPtr inBitstreamPtr)
 Get word offset from tile row and col. More...
 
virtual
PrimitiveStructuresSharedPtrMap 
getPrimitiveNameToStructreMap ()
 Populate primitive name to primitive structure map. More...
 
virtual void generateMemoryMicroBitstream ()
 Generate micro-bitstreams for memory elements like LUT in RAM mode. More...
 
void exportTileSinks (TileIndex inTileIndex)
 Export all pips within the specified tile. More...
 
void exportSink (Tilewire &inSource, Tilewire &inSink)
 Export a single pip. More...
 
bool isSlicelType (const string &inSiteType)
 Return true if site type is SLICEL. More...
 
DesignSharedPtr getHarnessDesignForSiteType (const string &inSiteType)
 Returns harness design pointer for the given site type. More...
 
string getReferenceConfigValue (const string &inConfigSetting)
 Return config value which results in off bit in bitstream. More...
 
DesignSharedPtr createEmptyDesignWithSameMetadata (DesignSharedPtr inDesignPtr)
 Create an empty design with same metadata. Does not copy configurations. More...
 
bool isRambSite (const string &inSiteType)
 Returns true if input is a RAMB site. More...
 
bool isDspSite (const string &inSiteType)
 Returns true is input is a DSP site. More...
 
bool isCompoundSettingHead (const string &inSetting)
 Is given setting head of compound setting group. More...
 
void createXdlsForConfigSetting (const torc::architecture::PrimitiveElement &inElement, PrimitiveStructureSharedPtr const inPrimitiveStructurePtr, const string &inSiteType, DesignSharedPtr inHarnessDesignPtr)
 Create Xdls for each config value of the config setting More...
 
void createXdlForGeneralConfigSetting (const string &inConfigSetting, const string &inConfigVal, const string &inXdlFileNamePartial, DesignSharedPtr inHarnessDesignPtr)
 Set config value and create Xdl. More...
 
void createRambBaseXdl (const string &inSiteType, DesignSharedPtr inHarnessDesignPtr)
 Create Xdl with a Ramb instane and no configuration. More...
 
void createHexConfigXdl (const string &inConfigSetting, const string &inSiteType, int numHexChars, DesignSharedPtr inHarnessDesignPtr)
 Create Xdl for configurations which hex string values. More...
 
void createXdlForCompoundSettings (const PrimitiveElement &inElement, const string &inSiteType, PrimitiveStructureSharedPtr inPrimitiveStructurePtr, DesignSharedPtr inHarnessDesignPtr)
 Create Xdls for compound settings. More...
 
void createXdlForOrphanElements (const torc::architecture::PrimitiveElement &inElement, const string &inXdlFileNamePartial, DesignSharedPtr inHarnessDesignPtr)
 Create Xdls for orphan elements with empty reference Xdl. More...
 
void createXdlForLut (const torc::architecture::PrimitiveElement &inElement, const string &inXdlFileNamePartial, DesignSharedPtr inHarnessDesignPtr)
 Create Xdl for Lut. More...
 
void createReferenceXdlForConfigSetting (const string &inConfigSetting, DesignSharedPtr outHarnessDesignPtr, const string &inXdlFileNamePartial)
 Create reference Xdl for given config setting. More...
 
void setConfigAndGenerateXdl (const string &inConfigSetting, const string &inConfigValue, const string &inXdlFileName, DesignSharedPtr inOutDesignPtr)
 Set given config and generate Xdl. More...
 
uint32_t getWordOffsetFromXdlFile (path inBitstreamPath, BitstreamSharedPtr inBitstreamPtr)
 Get word offset in frame for the site/pip in corresponding Xdl. More...
 
int getElementIndexFromName (const string inElementName, PrimitiveStructureSharedPtr inPrimitiveStructurePtr)
 Get index in Element array. More...
 
void saveLibraryMapToFile (TileTypeToSiteType &inLibrary)
 Save library map to file. More...
 
std::map< string, stringgetDeviceToPackageMap ()
 Get a map from device to default package. More...
 

Protected Attributes

DDBmDB
 Database object. More...
 
const SitesmSites
 Sites from the database object. More...
 
const TilesmTiles
 Tiles from the database object. More...
 
path mHarnessFolder
 Harness folder. More...
 
path mXdlGenerationFolder
 Folder in which Xdls will be generated. More...
 
path mXdlGenerationReferenceFolder
 Folder in which reference Xdls will be genered. More...
 
path mLibraryFolder
 Path to library folder. More...
 
CompoundSettingMap mCompoundSettingMap
 Map from one compound setting to vector of other related settings. More...
 
std::map< string, stringmDeviceToPackageMap
 Map from device to pakcage. More...
 
std::map< string, stringmReferenceConfigMap
 Map from config setting to reference config value. More...
 
string mCurTileType
 Tile type for which Xdl are being generated currently. More...
 

Static Protected Attributes

static const int sCrcWordIndex = 50
 This have to be changed for different Family. More...
 
static const string sTilesSupportedForPips []
 Array of supported routing tiles. More...
 
static const char * sNameSeparator = "-"
 Symbol to separate out parts of file name. More...
 
static const char * sConfigValueOff = "#OFF"
 Config value to switch off element (#OFF) More...
 
static const char * sXdlExtension = ".xdl"
 .xdl More...
 
static const char * sLibExtension = ".ldb"
 .ldb More...
 

Detailed Description

Definition at line 27 of file Virtex7LibGen.hpp.

Member Typedef Documentation

Map from one setting to vector of related setings.

Definition at line 80 of file AssemblerLibGen.hpp.

Imported type name.

Definition at line 45 of file AssemblerLibGen.hpp.

Imported type name.

Definition at line 65 of file AssemblerLibGen.hpp.

Imported type name.

Definition at line 67 of file AssemblerLibGen.hpp.

Imported type name.

Definition at line 69 of file AssemblerLibGen.hpp.

typedef boost::filesystem::path torc::bitstream::AssemblerLibGen::path
inherited

Imported type name.

Definition at line 43 of file AssemblerLibGen.hpp.

Typedef of map from primitive name to primitive structure shared pointer.

Definition at line 86 of file AssemblerLibGen.hpp.

Imported type name.

Definition at line 49 of file AssemblerLibGen.hpp.

Imported type name.

Definition at line 47 of file AssemblerLibGen.hpp.

typedef std::string torc::bitstream::AssemblerLibGen::string
inherited

Imported type name.

Definition at line 41 of file AssemblerLibGen.hpp.

Imported type name.

Definition at line 55 of file AssemblerLibGen.hpp.

Imported type name.

Definition at line 53 of file AssemblerLibGen.hpp.

Imported type name.

Definition at line 51 of file AssemblerLibGen.hpp.

typedef std::map<std::string,std::set<std::string> > torc::bitstream::AssemblerLibGen::TileTypeToSiteTypeSet
inherited

Typedef of map from tile type to set of site type.

Definition at line 84 of file AssemblerLibGen.hpp.

Imported type name.

Definition at line 57 of file AssemblerLibGen.hpp.

Constructor & Destructor Documentation

torc::bitstream::Virtex7LibGen::Virtex7LibGen ( string  inDevice,
path  inHarnessFolder,
path  inXdlGenerationFolder 
)
inline

Constructor.

Definition at line 30 of file Virtex7LibGen.hpp.

31  : AssemblerLibGen(inDevice, inHarnessFolder, inXdlGenerationFolder) {
32  initialize();
33  }
void initialize()
Do architecture specific part of initialization.
AssemblerLibGen(string inDevice, path inHarnessFolder, path inXdlGenerationFolder)
Constructor.

+ Here is the call graph for this function:

virtual torc::bitstream::Virtex7LibGen::~Virtex7LibGen ( )
inlinevirtual

Destructor.

Definition at line 35 of file Virtex7LibGen.hpp.

35 { }

Member Function Documentation

void torc::bitstream::Virtex7LibGen::compressBitFile ( path  primaryFile,
path  referenceFile 
)
protectedvirtual

Compress given bitstream file against reference bitstream file.

Implements torc::bitstream::AssemblerLibGen.

Definition at line 79 of file Virtex7LibGen.cpp.

79  {
80 
81  bool debug = false;
82 
83  // Read the bitstream files
84  torc::bitstream::BitstreamSharedPtr referenceBitstreamPtr = Factory::newBitstreamPtr(referenceFile);
85  torc::bitstream::BitstreamSharedPtr primBitstreamPtr = Factory::newBitstreamPtr(primaryFile);
86 
87  // Check if both the bitstreams were read successfully.
88  if(referenceBitstreamPtr && primBitstreamPtr) {
89  std::cout << "Read the two bit files - " << primaryFile.filename() << " and " << referenceFile.filename() << " successfully" << std::endl;
90  } else {
91  std::cout << "Could not read the bit files " << primaryFile << " " << referenceFile << std::endl;
92  return;
93  }
94 
95  // dynamically cast the bitstream pointer into a Virtex7 bitstream pointer
96 
97  boost::shared_ptr<torc::bitstream::Virtex7> primVirtexBitstreamPtr = boost::dynamic_pointer_cast<torc::bitstream::Virtex7>(
98  primBitstreamPtr);
99  boost::shared_ptr<torc::bitstream::Virtex7> refVirtex7BitstreamPtr = boost::dynamic_pointer_cast<torc::bitstream::Virtex7>(
100  referenceBitstreamPtr);
101 
102  // initalize frame map
103  refVirtex7BitstreamPtr->initializeDeviceInfo(referenceBitstreamPtr->getDesignName());
104  refVirtex7BitstreamPtr->initializeFrameMaps();
105  refVirtex7BitstreamPtr->readFramePackets();
106 
107  primVirtexBitstreamPtr->initializeDeviceInfo(primBitstreamPtr->getDesignName());
108  primVirtexBitstreamPtr->initializeFrameMaps();
109  primVirtexBitstreamPtr->readFramePackets();
110 
111  uint32_t wordOffset = getWordOffsetFromXdlFile(primaryFile, primVirtexBitstreamPtr);
112 
113  // look up the frame blocks
114  torc::bitstream::VirtexFrameBlocks& refFrameBlocks = refVirtex7BitstreamPtr->getFrameBlocks();
115  torc::bitstream::VirtexFrameBlocks& primFrameBlocks = primVirtexBitstreamPtr->getFrameBlocks();
116  std::vector<boost::int32_t> combinedAddressVector;
117 
118 
119  // iterate over the block types
120  for(int blockIndex = 0; blockIndex < Bitstream::eBlockTypeCount; blockIndex++) {
121  // look up the frame set for this block
122  torc::bitstream::VirtexFrameSet& nullFrameSet = refFrameBlocks.mBlock[blockIndex];
123  torc::bitstream::VirtexFrameSet& primFrameSet = primFrameBlocks.mBlock[blockIndex];
124 
125  if(nullFrameSet.size() != primFrameSet.size()) {
126  std::cout << "Frame set sizes do not match" << std::endl;
127  return;
128  }
129 
130  // We expect the majorIndex to remain same for all the mismatching part of the bitstream.
131  uint32_t relativeFrameIndex = 0, currentMajorIndex = 0, previousMajorIndex = 0;
132  bool firstMismatch = true;
133 
134  // iterate over the frames
135  for(uint32_t frameIndex = 0; frameIndex < nullFrameSet.size(); frameIndex++) {
136  // look up the frame for this set
137  VirtexFrameSharedPtr nullFramePtr = nullFrameSet[frameIndex];
138  VirtexFrameSharedPtr primFramePtr = primFrameSet[frameIndex];
139 
140  const VirtexFrame::word_t* wordsReference = nullFramePtr->getWords();
141  const VirtexFrame::word_t* wordsPrim = primFramePtr->getWords();
142 
143  const VirtexFrame::word_t* pReferenceWords = wordsReference;
144  const VirtexFrame::word_t* pPrimWords = wordsPrim;
145  const VirtexFrame::word_t* eReferenceWords = pReferenceWords
146  + nullFramePtr->getLength();
147  const VirtexFrame::word_t* ePrimWords = pPrimWords + primFramePtr->getLength();
148 
149  if(nullFramePtr->getLength() != primFramePtr->getLength()) {
150  std::cout << "WARNING: Frames of different sizes " << nullFramePtr->getLength() << " "
151  << primFramePtr->getLength() << std::endl;
152  }
153 
154  // iterate over the frame words
155  bool found = false;
156  int wordIndex = 0;
157 
158  // Iterate over the frame words
159  while(pReferenceWords < eReferenceWords) {
160  // If the word is not zero and not same as that of reference bitstream and not crc word
161  if(*pPrimWords != 0 && *pReferenceWords != *pPrimWords && wordIndex != sCrcWordIndex) {
162 
163  boost::int32_t bitIndex = 0;
164  // ToDo: Uncomment after support is introduced
165  primVirtexBitstreamPtr->splitFrameIndex(frameIndex, currentMajorIndex, relativeFrameIndex);
166 
167  // If this is not the first mismatch, compare the major index with previous mismatching word's major index.
168  if(!firstMismatch) {
169  if(currentMajorIndex != previousMajorIndex) {
170  std::cout << "WARNING: Bitstream mismatch across major indices: " << currentMajorIndex << " and " << previousMajorIndex << std::endl;
171  //exit (-1);
172  return;
173  }
174  } else {
175  firstMismatch = false;
176  previousMajorIndex = currentMajorIndex;
177  }
178 
179  // Get the 1 bits in primary design which are zero in reference design
180  VirtexFrame::word_t tempWord = (*pPrimWords ^ *pReferenceWords) & *pPrimWords;
181  // Find all the 1s in the word
182  while(tempWord != 0) {
183  // check if the LSB is 1
184  if(tempWord & 1) {
185  // store the combined address
186  combinedAddressVector.push_back((relativeFrameIndex << 16) | ((wordIndex - wordOffset)
187  << 8) | bitIndex);
188 
189  }
190  tempWord = tempWord >> 1;
191  bitIndex++;
192  }
193  found = true;
194  }
195  pReferenceWords++;
196  pPrimWords++;
197  wordIndex++;
198  }
199  // if we found any non-zero words, display them. This if for debugging purpose only.
200  if(found) {
201  std::cout << "Found unmatching frame: block " << blockIndex << ", relative index "
202  << Hex32(relativeFrameIndex) << ", global index: " << Hex32(frameIndex)
203  << ", major index: " << Hex32(currentMajorIndex) << std::endl;
204  pReferenceWords = wordsReference;
205  if(debug) {
206  std::cout << " Referen: ";
207  while(pReferenceWords < eReferenceWords) {
208  std::cout << Hex32(*pReferenceWords++) << " ";
209  }
210  std::cout << std::endl;
211  pPrimWords = wordsPrim;
212  std::cout << " Primary: ";
213  while(pPrimWords < ePrimWords) {
214  std::cout << Hex32(*pPrimWords++) << " ";
215  }
216  std::cout << std::endl;
217  }
218  }
219  }
220  }
221 
222  // Store all the combined addresses in the sparse bit file.
223  boost::filesystem::path sparceBitstreamPath = primaryFile.replace_extension().string()
224  + ".cbit";
225 
226  std::ofstream sparceBitstreamFile;
227  sparceBitstreamFile.open(sparceBitstreamPath.string().c_str(), std::ios::binary | std::ios::out);
228  if(sparceBitstreamFile.good()) {
229  std::cout << " Opened library file to write " << sparceBitstreamPath.string().c_str()
230  << std::endl;
231  } else {
232  std::cerr << " Could not open library file to write - "
233  << sparceBitstreamPath.string().c_str() << std::endl;
234  exit(-1);
235  }
236 
237  boost::int32_t vectorSize = combinedAddressVector.size();
238  sparceBitstreamFile.write((char *) &vectorSize, 4);
239  std::cout << "Different words -" << std::endl;
240  std::cout << " ";
241  for(std::vector<boost::int32_t>::const_iterator iter = combinedAddressVector.begin(); iter
242  != combinedAddressVector.end(); iter++) {
243  sparceBitstreamFile.write((char *) (&*iter), 4);
244  std::cout << Hex32((*iter)) << " ";
245  }
246  std::cout << std::endl;
247 
248  std::cout << "Wrote data to the library file." << std::endl;
249 
250  sparceBitstreamFile.close();
251 
252 }
uint32_t getWordOffsetFromXdlFile(path inBitstreamPath, BitstreamSharedPtr inBitstreamPtr)
Get word offset in frame for the site/pip in corresponding Xdl.
static const int sCrcWordIndex
This have to be changed for different Family.
FrameSet< FRAME_TYPE > mBlock[Bitstream::eBlockTypeCount]
FrameSets for each of the eight block types.
Definition: FrameSet.hpp:88
boost::filesystem::path path
static BitstreamSharedPtr newBitstreamPtr(const boost::filesystem::path &inPath)
Virtex7 bitstream.
Definition: Virtex7.hpp:40
boost::shared_ptr< VirtexFrame > VirtexFrameSharedPtr
Virtex frame type.
Definition: Frame.hpp:108
boost::shared_ptr< Bitstream > BitstreamSharedPtr
WORD_TYPE word_t
Frame word type.
Definition: Frame.hpp:48
virtual void initializeDeviceInfo(const std::string &inDeviceName)
Initialize the Device Information.
Definition: Virtex7.cpp:416

+ Here is the call graph for this function:

void torc::bitstream::AssemblerLibGen::compressBitFiles ( )
inherited

Compress all Xilinx bitfiles in mXdlGenerationFolder.

Definition at line 736 of file AssemblerLibGen.cpp.

736  {
737  // Go over all the .bit files
738  // Go over all the files in the directory
739  boost::filesystem::directory_iterator eFiles;
740  boost::filesystem::directory_iterator pFiles(mXdlGenerationFolder);
741  while(pFiles != eFiles) {
742  // If it is a Xilinx bit file (.bit extension)
743  path filePath = pFiles->path();
744  pFiles++;
745  if(filePath.extension() == ".bit") {
746 
747  // Check if bit file in newer then compressed bit file
748  path cBitPath = filePath;
749  cBitPath.replace_extension(".cbit");
750  if(boost::filesystem::exists(cBitPath)) {
751  std::time_t bitFileModTime = boost::filesystem::last_write_time(filePath);
752  std::time_t cBitFileModTime = boost::filesystem::last_write_time(cBitPath);
753  // If compressed bit file modification time later than bitgen bit, continue
754  if(cBitFileModTime > bitFileModTime)
755  continue;
756  }
757 
758  // Check for reference file
759  // (Note: Wrapping filename() as a path for compatibility with Boost.Filesystem V2)
760  string referenceBitFileName
761  = boost::filesystem::path(filePath.filename()).string();
762  path referenceBitFilePath = mXdlGenerationReferenceFolder / referenceBitFileName;
763  if(!boost::filesystem::exists(referenceBitFilePath)) {
764  // Remove last part of Xdl file name (config value)
765  unsigned position = referenceBitFileName.find_last_of('-');
766  referenceBitFileName.replace(position, string::npos, ".bit");
767  referenceBitFilePath = mXdlGenerationReferenceFolder / referenceBitFileName;
768  if(!boost::filesystem::exists(referenceBitFilePath)) {
769  // Get null bitstream path
770  referenceBitFilePath = mLibraryFolder / "null_bitstreams" / mDB.getDeviceName();
771  referenceBitFilePath.replace_extension(".bit");
772 
773  }
774 
775  }
776  compressBitFile(filePath, referenceBitFilePath);
777  // std::cout << "Bitfile: " << filePath.filename() << ". Reference: " << referenceBitFilePath.filename() << std::endl;
778  }
779  }
780 
782 }
path mXdlGenerationFolder
Folder in which Xdls will be generated.
const string & getDeviceName(void) const
Returns the device name.
Definition: DDB.hpp:132
path mXdlGenerationReferenceFolder
Folder in which reference Xdls will be genered.
virtual void generateMemoryMicroBitstream()=0
Generate micro-bitstreams for memory elements like LUT in RAM mode.
virtual void compressBitFile(path primaryFile, path referenceFile)=0
Compress the diff of primary bitstream and reference bitstream.
boost::filesystem::path path
path mLibraryFolder
Path to library folder.
boost::filesystem::path path
Imported type name.

+ Here is the call graph for this function:

AssemblerLibGen::DesignSharedPtr torc::bitstream::AssemblerLibGen::createEmptyDesignWithSameMetadata ( DesignSharedPtr  inDesignPtr)
protectedinherited

Create an empty design with same metadata. Does not copy configurations.

Return empty design with same metadata

Definition at line 383 of file AssemblerLibGen.cpp.

383  {
384  DesignSharedPtr emptyDesign = torc::physical::Factory::newDesignPtr(inDesignPtr->getName(),
385  inDesignPtr->getDevice(), inDesignPtr->getPackage(), inDesignPtr->getSpeedGrade(),
386  inDesignPtr->getXdlVersion());
387 
388  return emptyDesign;
389 }
static DesignSharedPtr newDesignPtr(const string &inName, const string &inDevice, const string &inPackage, const string &inSpeedGrade, const string &inXdlVersion)
Create and return a new Design shared pointer.
torc::physical::DesignSharedPtr DesignSharedPtr
Imported type name.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::bitstream::AssemblerLibGen::createHexConfigXdl ( const string inConfigSetting,
const string inSiteType,
int  numHexChars,
DesignSharedPtr  inHarnessDesignPtr 
)
protectedinherited

Create Xdl for configurations which hex string values.

Create Xdl for configurations with values as hex string.

Definition at line 461 of file AssemblerLibGen.cpp.

462  {
463  // We know for Virtex 5 DSP's mask and pattern have 12 hex characters as config value.
464  long long configValNumber = 1;
465 
466  std::string siteTypeAndElement = inXdlFileNamePartial + sNameSeparator + inConfigSetting;
467 
468  std::stringstream xdlReferenceFileName;
469  xdlReferenceFileName << siteTypeAndElement << sXdlExtension;
470  createReferenceXdlForConfigSetting(inConfigSetting, inHarnessDesignPtr, inXdlFileNamePartial);
471 
472  for(int bitPosition = 0; bitPosition < inNumHexChars*4; bitPosition++) {
473  std::stringstream ssConfigVal;
474  ssConfigVal << std::setfill('0') << std::setw(inNumHexChars) << std::hex << configValNumber;
475 
476  std::stringstream xdlFileName;
477  xdlFileName << siteTypeAndElement << sNameSeparator << bitPosition << sXdlExtension;
478 
479  setConfigAndGenerateXdl(inConfigSetting, ssConfigVal.str(), xdlFileName.str(), inHarnessDesignPtr);
480 
481  configValNumber = configValNumber << 1;
482 
483  }
484 
485  // Set the config to default again
486  InstanceSharedPtr instancePtr = *(inHarnessDesignPtr->instancesBegin());
487  instancePtr->setConfig(inConfigSetting, "", getReferenceConfigValue(inConfigSetting));
488 }
torc::physical::InstanceSharedPtr InstanceSharedPtr
Imported type name.
static const char * sNameSeparator
Symbol to separate out parts of file name.
void setConfigAndGenerateXdl(const string &inConfigSetting, const string &inConfigValue, const string &inXdlFileName, DesignSharedPtr inOutDesignPtr)
Set given config and generate Xdl.
std::string string
string getReferenceConfigValue(const string &inConfigSetting)
Return config value which results in off bit in bitstream.
void createReferenceXdlForConfigSetting(const string &inConfigSetting, DesignSharedPtr outHarnessDesignPtr, const string &inXdlFileNamePartial)
Create reference Xdl for given config setting.
static const char * sXdlExtension
.xdl

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::bitstream::AssemblerLibGen::createRambBaseXdl ( const string inSiteType,
DesignSharedPtr  inHarnessDesignPtr 
)
protectedinherited

Create Xdl with a Ramb instane and no configuration.

Create Xdl with just Ramb site instantiated.

Definition at line 436 of file AssemblerLibGen.cpp.

436  {
437  // Create XDL file name of the pattern <Family>-<TileType>-<SiteType>-<Element>-<Config>.xdl
438  std::stringstream ssXDLFileName;
439  ssXDLFileName << mDB.getFamilyName() << sNameSeparator << mCurTileType << sNameSeparator << inSiteType << sNameSeparator
440  << inSiteType << sNameSeparator << "BASE.xdl";
441  boost::filesystem::path xdlFilePath = mXdlGenerationFolder / ssXDLFileName.str();
442  std::fstream xdlExport(xdlFilePath.string().c_str(), std::ios::out);
443  torc::physical::XdlExporter fileExporter(xdlExport);
444  DesignSharedPtr emptyDesignPtr = createEmptyDesignWithSameMetadata(inHarnessDesignPtr);
445  // add a bram instance
446  // Add an empty instance of same site type and location
447  InstanceSharedPtr instancePtr = *(inHarnessDesignPtr->instancesBegin());
448 
449  InstanceSharedPtr emptyInstance = torc::physical::Factory::newInstancePtr(instancePtr->getName(),
450  instancePtr->getType(), instancePtr->getTile(), instancePtr->getSite(),
451  instancePtr->getBonding());
452 
453  emptyDesignPtr->addInstance(emptyInstance);
454 
455  fileExporter(emptyDesignPtr);
456  xdlExport.close();
457 
458 }
torc::physical::InstanceSharedPtr InstanceSharedPtr
Imported type name.
path mXdlGenerationFolder
Folder in which Xdls will be generated.
const string & getFamilyName(void) const
Returns the family name.
Definition: DDB.hpp:134
static const char * sNameSeparator
Symbol to separate out parts of file name.
string mCurTileType
Tile type for which Xdl are being generated currently.
static InstanceSharedPtr newInstancePtr(const string &inName, const string &inType, const string &inTile, const string &inSite, EInstanceBonding inBonding=eInstanceBondingUnknown, InstanceReferenceSharedPtr inInstanceReferencePtr=InstanceReferenceSharedPtr())
Construct and return a new Instance shared pointer.
boost::filesystem::path path
DesignSharedPtr createEmptyDesignWithSameMetadata(DesignSharedPtr inDesignPtr)
Create an empty design with same metadata. Does not copy configurations.
Physical design exporter for XDL.
Definition: XdlExporter.hpp:31
torc::physical::DesignSharedPtr DesignSharedPtr
Imported type name.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::bitstream::AssemblerLibGen::createReferenceXdlForConfigSetting ( const string inConfigSetting,
DesignSharedPtr  outHarnessDesignPtr,
const string inXdlFileNamePartial 
)
protectedinherited

Create reference Xdl for given config setting.

Definition at line 669 of file AssemblerLibGen.cpp.

670  {
671 
672  InstanceSharedPtr instancePtr = *(inHarnessDesignPtr->instancesBegin());
673  // If no instance found, just return
674  if(!instancePtr) {
675  std::cerr << "No instance found in the harness " << inHarnessDesignPtr->getName()
676  << std::endl;
677  return;
678  }
679 
680  // Set config value to #OFF for the given element
681  std::string referenceConfigValue = getReferenceConfigValue(inConfigSetting);
682  instancePtr->setConfig(inConfigSetting, "", referenceConfigValue);
683 
684  // Generate an reference XDL file for this element's custom harness
685  std::stringstream ssReferenceXdlFileName;
686  ssReferenceXdlFileName << inXdlFileNamePartial << sNameSeparator
687  << inConfigSetting << sXdlExtension;
688  boost::filesystem::path referenceXDLFilePath = mXdlGenerationReferenceFolder / ssReferenceXdlFileName.str();
689 
690  std::ofstream fileStream(referenceXDLFilePath.string().c_str());
691  if(!fileStream.good()) {
692  std::cerr << "Could not open file " << referenceXDLFilePath.string() << std::endl;
693  return;
694  }
695 
696  // Export design as XDL
697  torc::physical::XdlExporter exporter(fileStream);
698  exporter(inHarnessDesignPtr);
699  fileStream.close();
700 }
torc::physical::InstanceSharedPtr InstanceSharedPtr
Imported type name.
path mXdlGenerationReferenceFolder
Folder in which reference Xdls will be genered.
static const char * sNameSeparator
Symbol to separate out parts of file name.
std::string string
string getReferenceConfigValue(const string &inConfigSetting)
Return config value which results in off bit in bitstream.
boost::filesystem::path path
static const char * sXdlExtension
.xdl
Physical design exporter for XDL.
Definition: XdlExporter.hpp:31

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::bitstream::AssemblerLibGen::createXdlForCompoundSettings ( const PrimitiveElement inElement,
const string inSiteType,
PrimitiveStructureSharedPtr  inPrimitiveStructurePtr,
DesignSharedPtr  inHarnessDesignPtr 
)
protectedinherited

Create Xdls for compound settings.

Definition at line 491 of file AssemblerLibGen.cpp.

491  {
492  std::vector<std::string> compoundElements = mCompoundSettingMap[inElement1.getName()];
493  // For now assume there is only on element in the vector, i.e. there is a compound
494  // setting with only two elements.
495  if(compoundElements.size() != 1) {
496  std::cerr << "WARNING: Compound setting with more than two elements not handled currently"
497  << std::endl;
498  } else {
499 
500  // Generate XDLs with all permutations of configs of the two elements
501  // The two element names will be concatenated to form a compound element name Element1Element2.
502  // Similarly two config settings will be concatenated to form a compound config name.
503  std::string element1Name = inElement1.getName();
504  std::string element2Name = compoundElements[0];
505  std::string compoundElementName = element1Name + element2Name;
506 
507  // Get the other element
508  int elementIndex = getElementIndexFromName(element2Name, inPrimitiveStructurePtr);
509 
510  if(elementIndex == -1) {
511  std::cerr << "WARNING: Compound setting " << element2Name << " not found" << std::endl;
512  return;
513  }
514 
515  const PrimitiveElement &element2 = inPrimitiveStructurePtr->getPrimitiveDefPtr()->getElements()[elementIndex];
516 
517  // Get the first instance
518  InstanceSharedPtr instancePtr = *(inHarnessDesignPtr->instancesBegin());
519 
520  // Store the 2nd elements harness config
521  std::string harnessConfig2Val, harnessConfig2Name;
522  instancePtr->getConfig(element2Name, harnessConfig2Name, harnessConfig2Val);
523 
524  // Set element1 OFF and generate harness
525  std::string referenceXdlFileName = inSiteType + sNameSeparator + compoundElementName + sXdlExtension;
526  instancePtr->setConfig(element1Name, "", getReferenceConfigValue(element1Name));
527  instancePtr->setConfig(element2Name, "", getReferenceConfigValue(element2Name));
528 
529  boost::filesystem::path referenceXDLFilePath = mXdlGenerationReferenceFolder / referenceXdlFileName;
530 
531  std::ofstream fileStream(referenceXDLFilePath.string().c_str());
532  if(!fileStream.good()) {
533  std::cerr << "Could not open file " << referenceXDLFilePath.string() << std::endl;
534  return;
535  }
536 
537  // Export design as XDL (create referene Xdl)
538  torc::physical::XdlExporter exporter(fileStream);
539  exporter(inHarnessDesignPtr);
540  fileStream.close();
541 
542  // Iterate over configs of 1st element
543  const PrimitiveElement::StringSet &configs1 = inElement1.getCfgs();
544  PrimitiveElement::StringSet::const_iterator pConfigs1 = configs1.begin();
545  PrimitiveElement::StringSet::const_iterator eConfigs1 = configs1.end();
546 
547  while(pConfigs1 != eConfigs1) {
548 
549  // Iterate over configs of 2nd element.
550  const PrimitiveElement::StringSet &configs2 = element2.getCfgs();
551  PrimitiveElement::StringSet::const_iterator pConfigs2 = configs2.begin();
552  PrimitiveElement::StringSet::const_iterator eConfigs2 = configs2.end();
553 
554  while(pConfigs2 != eConfigs2) {
555 
556  // Form the XDL file name
557  std::string compoundConfigName = *pConfigs1 + *pConfigs2;
558  std::string xdlFileName = inSiteType + sNameSeparator + compoundElementName
559  + sNameSeparator + compoundConfigName + sXdlExtension;
560 
561  // Set element1 config and generate primary XDL
562  instancePtr->setConfig(element1Name, "", *pConfigs1);
563  setConfigAndGenerateXdl(element2Name, *pConfigs2, xdlFileName, inHarnessDesignPtr);
564  pConfigs2++;
565  }
566 
567  pConfigs1++;
568  }
569 
570  // Set original value of element2
571  instancePtr->setConfig(element2Name, harnessConfig2Name, harnessConfig2Val);
572  }
573 }
torc::physical::InstanceSharedPtr InstanceSharedPtr
Imported type name.
path mXdlGenerationReferenceFolder
Folder in which reference Xdls will be genered.
static const char * sNameSeparator
Symbol to separate out parts of file name.
void setConfigAndGenerateXdl(const string &inConfigSetting, const string &inConfigValue, const string &inXdlFileName, DesignSharedPtr inOutDesignPtr)
Set given config and generate Xdl.
int getElementIndexFromName(const string inElementName, PrimitiveStructureSharedPtr inPrimitiveStructurePtr)
Get index in Element array.
std::string string
string getReferenceConfigValue(const string &inConfigSetting)
Return config value which results in off bit in bitstream.
CompoundSettingMap mCompoundSettingMap
Map from one compound setting to vector of other related settings.
boost::filesystem::path path
static const char * sXdlExtension
.xdl
Encapsulation of a primitive site element. Primitive elements are subcomponents of logic primitive s...
std::set< std::string > StringSet
A set of configuration values.
const StringSet & getCfgs(void) const
Returns the set of allowable configuration values.
Physical design exporter for XDL.
Definition: XdlExporter.hpp:31

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::bitstream::AssemblerLibGen::createXdlForGeneralConfigSetting ( const string inConfigSetting,
const string inConfigVal,
const string inXdlFileNamePartial,
DesignSharedPtr  inHarnessDesignPtr 
)
protectedinherited

Set config value and create Xdl.

Definition at line 392 of file AssemblerLibGen.cpp.

393  {
394 
395  std::string xdlFileName = inXdlFileNamePartial + sNameSeparator + inConfigVal + sXdlExtension;
396 
397  setConfigAndGenerateXdl(inConfigSetting, inConfigVal, xdlFileName, inHarnessDesignPtr);
398 }
static const char * sNameSeparator
Symbol to separate out parts of file name.
void setConfigAndGenerateXdl(const string &inConfigSetting, const string &inConfigValue, const string &inXdlFileName, DesignSharedPtr inOutDesignPtr)
Set given config and generate Xdl.
std::string string
static const char * sXdlExtension
.xdl

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::bitstream::AssemblerLibGen::createXdlForLut ( const torc::architecture::PrimitiveElement inElement,
const string inXdlFileNamePartial,
DesignSharedPtr  inHarnessDesignPtr 
)
protectedinherited

Create Xdl for Lut.

Definition at line 614 of file AssemblerLibGen.cpp.

615  {
616  std::string configSetting = inElement.getName();
617 
618 // std::cout << "Found a LUT " << configSetting << std::endl;
619 
620  DesignSharedPtr emptyDesign = createEmptyDesignWithSameMetadata(inHarnessDesignPtr);
621  InstanceSharedPtr instancePtr = *(inHarnessDesignPtr->instancesBegin());
622  InstanceSharedPtr emptyInstance = torc::physical::Factory::newInstancePtr(instancePtr->getName(),
623  instancePtr->getType(), instancePtr->getTile(), instancePtr->getSite(),
624  instancePtr->getBonding());
625  emptyDesign->addInstance(emptyInstance);
626 
627  // Generate reference XDL for LUT
628  createReferenceXdlForConfigSetting(configSetting, emptyDesign, inXdlFileNameSitetype);
629  string xdlFileNameSetting = inXdlFileNameSitetype + sNameSeparator + configSetting;
630 
631  const PrimitiveElementPinArray &pins = inElement.getPins();
634  //For every output-input pin combination
635  while(pPinsOut != ePinsOut) {
636 
637  // Handly only input Ax assigned to output O5/O6
638  if(pPinsOut->isOutput() && boost::iequals(pPinsOut->getName().substr(0, 1), "O")) {
639 
642 
643  while(pPinsIn != ePinsIn && boost::iequals(pPinsIn->getName().substr(0, 1), "A")) {
644  if(pPinsIn->isInput()) {
645 
646  std::string configVal = "#LUT:" + pPinsOut->getName() + "=" + pPinsIn->getName();
647  std::string xdlFileName = xdlFileNameSetting + sNameSeparator + configVal + sXdlExtension;
648  setConfigAndGenerateXdl(configSetting, configVal, xdlFileName, emptyDesign);
649  }
650  pPinsIn++;
651  }
652 
653  // Generate XDLs for output 1 also
654  std::string configVal = "#LUT:" + pPinsOut->getName() + "=" + "1";
655  std::stringstream xdlFileName1;
656  xdlFileName1 << xdlFileNameSetting << sNameSeparator << configVal << sXdlExtension;
657  setConfigAndGenerateXdl(configSetting, configVal, xdlFileName1.str(), emptyDesign);
658 
659  configVal = "#LUT:" + pPinsOut->getName() + "=" + "0";
660  std::stringstream xdlFileName0;
661  xdlFileName0 << xdlFileNameSetting << sNameSeparator << configVal << sXdlExtension;
662  setConfigAndGenerateXdl(configSetting, configVal, xdlFileName0.str(), emptyDesign);
663  }
664  pPinsOut++;
665  }
666 }
torc::physical::InstanceSharedPtr InstanceSharedPtr
Imported type name.
const const PrimitiveElementPin * const_iterator
Constant T iterator type.
Definition: Array.hpp:83
T * end(void)
Returns the non-constant end iterator.
Definition: Array.hpp:97
static const char * sNameSeparator
Symbol to separate out parts of file name.
void setConfigAndGenerateXdl(const string &inConfigSetting, const string &inConfigValue, const string &inXdlFileName, DesignSharedPtr inOutDesignPtr)
Set given config and generate Xdl.
std::string string
const string & getName(void) const
Returns the name of the element.
PrimitiveElementPinArray & getPins(void)
Returns a non-constant array of element pins. This function should only be used by the Sites class d...
static InstanceSharedPtr newInstancePtr(const string &inName, const string &inType, const string &inTile, const string &inSite, EInstanceBonding inBonding=eInstanceBondingUnknown, InstanceReferenceSharedPtr inInstanceReferencePtr=InstanceReferenceSharedPtr())
Construct and return a new Instance shared pointer.
void createReferenceXdlForConfigSetting(const string &inConfigSetting, DesignSharedPtr outHarnessDesignPtr, const string &inXdlFileNamePartial)
Create reference Xdl for given config setting.
static const char * sXdlExtension
.xdl
T * begin(void)
Returns the non-constant begin iterator.
Definition: Array.hpp:95
DesignSharedPtr createEmptyDesignWithSameMetadata(DesignSharedPtr inDesignPtr)
Create an empty design with same metadata. Does not copy configurations.
torc::physical::DesignSharedPtr DesignSharedPtr
Imported type name.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::bitstream::AssemblerLibGen::createXdlForOrphanElements ( const torc::architecture::PrimitiveElement inElement,
const string inXdlFileNamePartial,
DesignSharedPtr  inHarnessDesignPtr 
)
protectedinherited

Create Xdls for orphan elements with empty reference Xdl.

Definition at line 576 of file AssemblerLibGen.cpp.

578  {
579 
580  std::string elementName = inElement.getName();
581  std::string siteTypeAndElem;
582  std::cout << "Found Orphan Element " << elementName << std::endl;
583  // Get and empty design with same metadata
584  DesignSharedPtr emptyDesign = createEmptyDesignWithSameMetadata(inHarnessDesignPtr);
585 
586  // Add an empty instance of same site type and location
587  InstanceSharedPtr instancePtr = *(inHarnessDesignPtr->instancesBegin());
588 
589  InstanceSharedPtr emptyInstance = torc::physical::Factory::newInstancePtr(instancePtr->getName(),
590  instancePtr->getType(), instancePtr->getTile(), instancePtr->getSite(),
591  instancePtr->getBonding());
592 
593  emptyDesign->addInstance(emptyInstance);
594 
595  createReferenceXdlForConfigSetting(elementName, emptyDesign, inXdlFileNamePartial);
596 
597  // Go over all the configs
598  const PrimitiveElement::StringSet &configs = inElement.getCfgs();
599  PrimitiveElement::StringSet::const_iterator pConfigs = configs.begin();
600  PrimitiveElement::StringSet::const_iterator eConfigs = configs.end();
601 
602  std::string xdlFileNameSetting = inXdlFileNamePartial + sNameSeparator + elementName;
603  // Iterate over configs of the primitive
604  while(pConfigs != eConfigs) {
605  std::string xdlFileName = xdlFileNameSetting + sNameSeparator + *pConfigs + sXdlExtension;
606  //std::cout << "\t\tConfig " << *pConfigs << ". File " << xdlFileName << std::endl;
607  setConfigAndGenerateXdl(elementName, *pConfigs, xdlFileName, emptyDesign);
608  pConfigs++;
609  }
610 
611 }
torc::physical::InstanceSharedPtr InstanceSharedPtr
Imported type name.
static const char * sNameSeparator
Symbol to separate out parts of file name.
void setConfigAndGenerateXdl(const string &inConfigSetting, const string &inConfigValue, const string &inXdlFileName, DesignSharedPtr inOutDesignPtr)
Set given config and generate Xdl.
std::string string
const string & getName(void) const
Returns the name of the element.
static InstanceSharedPtr newInstancePtr(const string &inName, const string &inType, const string &inTile, const string &inSite, EInstanceBonding inBonding=eInstanceBondingUnknown, InstanceReferenceSharedPtr inInstanceReferencePtr=InstanceReferenceSharedPtr())
Construct and return a new Instance shared pointer.
void createReferenceXdlForConfigSetting(const string &inConfigSetting, DesignSharedPtr outHarnessDesignPtr, const string &inXdlFileNamePartial)
Create reference Xdl for given config setting.
static const char * sXdlExtension
.xdl
std::set< std::string > StringSet
A set of configuration values.
const StringSet & getCfgs(void) const
Returns the set of allowable configuration values.
DesignSharedPtr createEmptyDesignWithSameMetadata(DesignSharedPtr inDesignPtr)
Create an empty design with same metadata. Does not copy configurations.
torc::physical::DesignSharedPtr DesignSharedPtr
Imported type name.

+ Here is the call graph for this function:

void torc::bitstream::AssemblerLibGen::createXdlsForConfigSetting ( const torc::architecture::PrimitiveElement inElement,
PrimitiveStructureSharedPtr const  inPrimitiveStructurePtr,
const string inSiteType,
DesignSharedPtr  inHarnessDesignPtr 
)
protectedinherited

Create Xdls for each config value of the config setting

Definition at line 401 of file AssemblerLibGen.cpp.

403  {
404 
405  std::string configSetting = inElement.getName();
406 
407  if(isCompoundSettingHead(inElement.getName())) {
408  createXdlForCompoundSettings(inElement, inXdlFileNamePartial, inPrimitiveStructurePtr, inHarnessDesignPtr);
409 // } // The use of orphan elements is still debatable
410 // else if(inPrimitiveStructurePtr->isOrphan(inElement) && inElement.getName() != "SYNC_ATTR" &&
411 // inElement.getName().substr(1) != "5FFSR") {
412 // createXdlForOrphanElements(inElement, inXdlFileNamePartial, inHarnessDesignPtr);
413  } else {
414 
415  std::string xdlFileNameConfig = inXdlFileNamePartial + sNameSeparator + configSetting;
416 
417  const torc::architecture::PrimitiveElement::StringSet &configs = inElement.getCfgs();
418  torc::architecture::PrimitiveElement::StringSet::const_iterator pConfigs = configs.begin();
419  torc::architecture::PrimitiveElement::StringSet::const_iterator eConfigs = configs.end();
420 
421  // Iterate over configs of the primitive
422  while(pConfigs != eConfigs) {
423 
424  if(inPrimitiveStructurePtr->isLUT(inElement, *pConfigs)) {
425  createXdlForLut(inElement, inXdlFileNamePartial, inHarnessDesignPtr);
426  } else {
427  createXdlForGeneralConfigSetting(inElement.getName(), *pConfigs, xdlFileNameConfig, inHarnessDesignPtr);
428  }
429 
430  pConfigs++;
431  }
432  }
433 }
void createXdlForGeneralConfigSetting(const string &inConfigSetting, const string &inConfigVal, const string &inXdlFileNamePartial, DesignSharedPtr inHarnessDesignPtr)
Set config value and create Xdl.
static const char * sNameSeparator
Symbol to separate out parts of file name.
std::string string
const string & getName(void) const
Returns the name of the element.
void createXdlForCompoundSettings(const PrimitiveElement &inElement, const string &inSiteType, PrimitiveStructureSharedPtr inPrimitiveStructurePtr, DesignSharedPtr inHarnessDesignPtr)
Create Xdls for compound settings.
bool isCompoundSettingHead(const string &inSetting)
Is given setting head of compound setting group.
std::set< std::string > StringSet
A set of configuration values.
const StringSet & getCfgs(void) const
Returns the set of allowable configuration values.
void createXdlForLut(const torc::architecture::PrimitiveElement &inElement, const string &inXdlFileNamePartial, DesignSharedPtr inHarnessDesignPtr)
Create Xdl for Lut.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::bitstream::AssemblerLibGen::exportSink ( Tilewire inSource,
Tilewire inSink 
)
protectedinherited

Export a single pip.

Definition at line 231 of file AssemblerLibGen.cpp.

231  {
232 
233  ExtendedWireInfo source(mDB, inSource);
234  ExtendedWireInfo sink(mDB, inSink);
235 
236  std::stringstream ss;
237  ss << mDB.getFamilyName() << sNameSeparator << source.mTileTypeName << sNameSeparator << "routing" << sNameSeparator << source.mWireName << sNameSeparator << sink.mWireName;
238  std::string designName(ss.str());
239 
240  // ToDo: Should load a design for routing from harness folder
243 
244  string dummyInstName = "dummyInst";
245  string dummyInstSiteType = "SLICEL";
246  string dummyInstSiteLocation = "SLICE_X1Y1";
248  dummyInstName, dummyInstSiteType, "DUMMY", dummyInstSiteLocation);
249 
250  designPtr->addInstance(instancePtr);
251 
253  torc::physical::Pip pip = torc::physical::Factory::newPip(source.mTileName, source.mWireName, sink.mWireName,
255  net->addPip(pip);
256 
258  "BQ");
260  "B4");
261  net->addSource(sourcePin);
262  net->addSink(sinkPin);
263 
264  designPtr->addNet(net);
265 
266  // export the created design
267  boost::filesystem::path xdlFilePath = mXdlGenerationFolder / designName.append(sXdlExtension);
268  std::fstream xdlExport(xdlFilePath.string().c_str(), std::ios_base::out);
269  torc::physical::XdlExporter fileExporter(xdlExport);
270  fileExporter(designPtr);
271  xdlExport.close();
272 }
const std::string dummyInstName
path mXdlGenerationFolder
Folder in which Xdls will be generated.
const string & getDeviceName(void) const
Returns the device name.
Definition: DDB.hpp:132
const string & getFamilyName(void) const
Returns the family name.
Definition: DDB.hpp:134
const std::string dummyInstSiteType
static NetSharedPtr newNetPtr(const string &inName, ENetType inNetType=eNetTypeNormal)
Create and return a new Net share pointer.
static const char * sNameSeparator
Symbol to separate out parts of file name.
boost::shared_ptr< class InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.
std::string string
static torc::physical::Pip newPip(const string &inTileName, const string &inSourceWireName, const string &inSinkWireName, EPipDirection inPipDirection, RoutethroughSharedPtr inRoutethroughPtr=RoutethroughSharedPtr())
Construct a pip and return it.
Verbose encapsulation of a wire's information.
static InstanceSharedPtr newInstancePtr(const string &inName, const string &inType, const string &inTile, const string &inSite, EInstanceBonding inBonding=eInstanceBondingUnknown, InstanceReferenceSharedPtr inInstanceReferencePtr=InstanceReferenceSharedPtr())
Construct and return a new Instance shared pointer.
boost::filesystem::path path
boost::shared_ptr< Instance > InstanceSharedPtr
Shared pointer encapsulation of an Instance.
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
Physical design programmable interconnect point.
Definition: Pip.hpp:34
torc::physical::NetSharedPtr NetSharedPtr
Imported type name.
static const char * sXdlExtension
.xdl
static InstancePinSharedPtr newInstancePinPtr(InstanceSharedPtr inInstancePtr, const string &inPinName)
Construct and return a new InstancePin shared pointer.
static DesignSharedPtr newDesignPtr(const string &inName, const string &inDevice, const string &inPackage, const string &inSpeedGrade, const string &inXdlVersion)
Create and return a new Design shared pointer.
std::map< string, string > mDeviceToPackageMap
Map from device to pakcage.
Physical design exporter for XDL.
Definition: XdlExporter.hpp:31

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::bitstream::AssemblerLibGen::exportTileSinks ( TileIndex  inTileIndex)
protectedinherited

Export all pips within the specified tile.

Definition at line 199 of file AssemblerLibGen.cpp.

199  {
200 
201  const TileInfo& tileInfo = mTiles.getTileInfo(inTileIndex);
202 
203  torc::architecture::xilinx::TileTypeIndex tileTypeIndex = tileInfo.getTypeIndex();
204 
205  std::cout << " Tile name: " << tileInfo.getName() << ", Tile type: "
206  << mTiles.getTileTypeName(tileTypeIndex) << std::endl;
207 
208  torc::architecture::xilinx::WireCount wireCount = mTiles.getWireCount(tileTypeIndex);
209 
210  // iterate through all the wires in the tile
211  for(torc::architecture::xilinx::WireIndex wireIndex /* implicitly initialized to 0 */; wireIndex < wireCount; wireIndex++) {
212  // join the tile index and the wire index into a "tilewire"
213  Tilewire source(inTileIndex, wireIndex);
214  // expand all of the sinks of interest in this tile
216  mDB.expandTilewireSinks(source, sinks, false, true, true, true);
217  if(sinks.empty())
218  continue;
219  // iterate over all of the pips that we have found
220  torc::architecture::TilewireVector::iterator p = sinks.begin();
221  torc::architecture::TilewireVector::iterator e = sinks.end();
222  while(p < e) {
223  // look up the sink tilewire
224  Tilewire sink = *p++;
225  exportSink(source, sink);
226  }
227  }
228 }
std::vector< Tilewire > TilewireVector
Vector of Tilewire objects.
Definition: Tilewire.hpp:101
const TileInfo & getTileInfo(TileIndex inTileIndex) const
Returns the TileInfo object for the specified tile.
Definition: Tiles.hpp:137
Encapsulation of a wire index in an unsigned 16-bit integer.
void expandTilewireSinks(const Tilewire &inTilewire, TilewireVector &outSinks, bool inUseTied=true, bool inUseRegular=true, bool inUseIrregular=true, bool inUseRoutethrough=true)
Expands the given tilewire's arc sinks.
Definition: DDB.cpp:214
void exportSink(Tilewire &inSource, Tilewire &inSink)
Export a single pip.
Encapsulation of a device tile and wire pair.
Definition: Tilewire.hpp:39
const Tiles & mTiles
Tiles from the database object.
Encapsulation of a wire count in an unsigned 16-bit integer.
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
const TileTypeIndex & getTypeIndex(void) const
Returns the tile type index for this tile.
Definition: TileInfo.hpp:92
Encapsulation of a tile type index in an unsigned 16-bit integer.
const char * getName(void) const
Returns the name for this tile.
Definition: TileInfo.hpp:98
WireCount getWireCount(TileTypeIndex inTileTypeIndex) const
Returns the wire count for the specified tile type.
Definition: Tiles.hpp:157

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::bitstream::AssemblerLibGen::generateBitstreams ( )
inherited

Generate bitstream for all Xdls in mXdlGenerationFolder and mXdlGenerationReferenceFolder.

Generates bitstream for all Xdls be calling a perl script which iterates over Xdls and calls Xilinxs tools to create bitstream

Definition at line 720 of file AssemblerLibGen.cpp.

720  {
721  // Call perl script to convert Xdl to Bitstream.
722  path buildFolder = torc::common::DirectoryTree::getExecutablePath() / "torc/bitstream/assembler/build";
723  string systemCommand = "perl " + buildFolder.string() + "/xdl2bit.pl " + mXdlGenerationFolder.string();
724  int systemReturn = system(systemCommand.c_str());
725  if(systemReturn != 0) {
726  std::cerr << "Error calling perl script xdl2bit.pl " << std::endl;
727  }
728  systemCommand = "perl " + buildFolder.string() + "/xdl2bit.pl " + mXdlGenerationReferenceFolder.string();
729  systemReturn = system(systemCommand.c_str());
730  if(systemReturn != 0) {
731  std::cerr << "Error calling perl script xdl2bit.pl " << std::endl;
732  }
733 }
path mXdlGenerationFolder
Folder in which Xdls will be generated.
path mXdlGenerationReferenceFolder
Folder in which reference Xdls will be genered.
static const boost::filesystem::path & getExecutablePath(void)
Returns the absolute path to the executable directory.
boost::filesystem::path path
Imported type name.

+ Here is the call graph for this function:

void torc::bitstream::AssemblerLibGen::generateLogicAndWireXdl ( )
inherited

Generate Xdls for both logic sites and routing pips.

void torc::bitstream::AssemblerLibGen::generateLogicXdls ( )
inherited

Generrate Xdls for logic sites.

Generate micro-Xdl for logic sites.

Definition at line 62 of file AssemblerLibGen.cpp.

62  {
63  std::cout << "Generating micro Xdls for Logic element..." << std::endl;
64  // Poplulate tile type to site types map
65  TileTypeToSiteTypeSet tileTypeToSiteType = getTileTypeToSiteTypeMap();
66  // Populate primitive name to structure map
68 
69  // Iterate through tile types and then site types
70  TileTypeToSiteTypeSet::const_iterator pTileTypes = tileTypeToSiteType.begin();
71  TileTypeToSiteTypeSet::const_iterator eTileTypes = tileTypeToSiteType.end();
72 
73  // For every tile type
74  while(pTileTypes != eTileTypes) {
75  //std::cout << " Tile type: " << pTileTypes->first << std::endl;
76  mCurTileType = pTileTypes->first;
77  std::set<std::string>::iterator pSites = pTileTypes->second.begin();
78  std::set<std::string>::iterator eSites = pTileTypes->second.end();
79  pTileTypes++;
80  while(pSites != eSites) {
81 
82  // look up the PrimitiveDef name and the PrimitiveStructureSharedPtr
83  std::string primitiveDefName = *pSites;
84  PrimitiveStructureSharedPtr primitiveStructurePtr =
85  primitiveStructures[primitiveDefName];
86  pSites++;
87  //std::cout << " Site type: " << primitiveDefName << std::endl;
88  // If the site type is to be supported
89  if(isSiteTypeSupported(primitiveDefName)) {
90 
91  // Get the designPtr for test harness for this site type
93  primitiveDefName);
94 
95  if(!harnessDesignPtr) {
96  std::cout << "WARNING: No harness design for site type " << primitiveDefName << std::endl;
97  continue;
98  }
99 
100  std::cout << "Tile: " << mCurTileType << " Site: " << primitiveDefName << std::endl;
101 
102  // Create the XDL file name (partial)
103  // XDL file is in the form <Family>-<TileType>-<SiteType>-<Config>-<Value>.xdl
104  std::stringstream ssXdlFileNamePartial;
105  ssXdlFileNamePartial << mDB.getFamilyName() << sNameSeparator << mCurTileType << sNameSeparator << primitiveDefName;
106 
107  if(isRambSite(primitiveDefName)) {
108  createRambBaseXdl(primitiveDefName, harnessDesignPtr);
109  }
110 
111  // For Dsp site, MASK and PATTER config have hex config value.
112  // The allowed values of these hex cofig are not present in Xdlrc and have to be created
113  if(isDspSite(primitiveDefName)) {
114  createHexConfigXdl("MASK", ssXdlFileNamePartial.str(), 12, harnessDesignPtr);
115  createHexConfigXdl("PATTERN", ssXdlFileNamePartial.str(), 12, harnessDesignPtr);
116  }
117 
118  // We know the design has only one instance. So, get the first one in the iterator.
119  torc::physical::InstanceSharedPtr harnessInstancePtr = *(harnessDesignPtr->instancesBegin());
120 
121  const torc::architecture::PrimitiveDef* primitiveDefPtr =
122  primitiveStructurePtr->getPrimitiveDefPtr();
123 
124  const PrimitiveElementArray& elements = primitiveDefPtr->getElements();
125  PrimitiveElementArray::const_iterator pElements = elements.begin();
126  PrimitiveElementArray::const_iterator eElements = elements.end();
127 
128  // Iterate over config settings/elements of the site
129  while(pElements != eElements) {
130  const torc::architecture::PrimitiveElement &element = *pElements++;
131  //std::cout << " " << element.getName() << std::endl << " " ;
132  // Cache the current setting of the element in harness design
133  std::string harnessConfigName;
134  std::string harnessConfigVal;
135  // We know harness XDL design has only one instance
136  harnessInstancePtr = *(harnessDesignPtr->instancesBegin());
137  harnessInstancePtr->getConfig(element.getName(), harnessConfigName, harnessConfigVal);
138 
139  // Ignore the route through elements
140  if(!primitiveStructurePtr->isRoutethrough(element)) {
141 
142  // Generate XDLs only if the element has a config to be set.
143  if(element.getCfgs().size() > 0) {
144 
145  // ToDo: Not all config setting require reference Xdl with harness as base. E.g. LUT configs.
146  // These configs can retain their setting and Xdls for them are not built up on harness.
147  createReferenceXdlForConfigSetting(element.getName(), harnessDesignPtr,
148  ssXdlFileNamePartial.str());
149 
150  // Generate XDL for each config of the element.
151  createXdlsForConfigSetting(element, primitiveStructurePtr, ssXdlFileNamePartial.str(),
152  harnessDesignPtr);
153  }
154  }
155 
156  // Store back the previous setting of the element in harness Design
157  harnessInstancePtr->setConfig(element.getName(), harnessConfigName, harnessConfigVal);
158 
159  }
160  }
161  }
162  }
163 
164 }
const const PrimitiveElement * const_iterator
Constant T iterator type.
Definition: Array.hpp:83
bool isRambSite(const string &inSiteType)
Returns true if input is a RAMB site.
const string & getFamilyName(void) const
Returns the family name.
Definition: DDB.hpp:134
Encapsulation of primitive site definition, with associated connections, elements, and pins.
T * end(void)
Returns the non-constant end iterator.
Definition: Array.hpp:97
static const char * sNameSeparator
Symbol to separate out parts of file name.
std::string string
const string & getName(void) const
Returns the name of the element.
std::map< std::string, std::set< std::string > > TileTypeToSiteTypeSet
Typedef of map from tile type to set of site type.
void createRambBaseXdl(const string &inSiteType, DesignSharedPtr inHarnessDesignPtr)
Create Xdl with a Ramb instane and no configuration.
string mCurTileType
Tile type for which Xdl are being generated currently.
virtual bool isSiteTypeSupported(const string &inSiteType)=0
Returns true if site type is supported.
void createXdlsForConfigSetting(const torc::architecture::PrimitiveElement &inElement, PrimitiveStructureSharedPtr const inPrimitiveStructurePtr, const string &inSiteType, DesignSharedPtr inHarnessDesignPtr)
Create Xdls for each config value of the config setting
boost::shared_ptr< Instance > InstanceSharedPtr
Shared pointer encapsulation of an Instance.
TileTypeToSiteTypeSet getTileTypeToSiteTypeMap(void)
Populate map of tile type to set of include site types.
std::map< std::string, PrimitiveStructureSharedPtr > PrimitiveStructuresSharedPtrMap
Typedef of map from primitive name to primitive structure shared pointer.
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
const PrimitiveElementArray & getElements(void) const
Returns a constant array of primitive elements.
DesignSharedPtr getHarnessDesignForSiteType(const string &inSiteType)
Returns harness design pointer for the given site type.
bool isDspSite(const string &inSiteType)
Returns true is input is a DSP site.
void createReferenceXdlForConfigSetting(const string &inConfigSetting, DesignSharedPtr outHarnessDesignPtr, const string &inXdlFileNamePartial)
Create reference Xdl for given config setting.
Encapsulation of a primitive site element. Primitive elements are subcomponents of logic primitive s...
void createHexConfigXdl(const string &inConfigSetting, const string &inSiteType, int numHexChars, DesignSharedPtr inHarnessDesignPtr)
Create Xdl for configurations which hex string values.
T * begin(void)
Returns the non-constant begin iterator.
Definition: Array.hpp:95
const StringSet & getCfgs(void) const
Returns the set of allowable configuration values.
torc::packer::PrimitiveStructureSharedPtr PrimitiveStructureSharedPtr
Imported type name.
virtual PrimitiveStructuresSharedPtrMap getPrimitiveNameToStructreMap()=0
Populate primitive name to primitive structure map.

+ Here is the call graph for this function:

void torc::bitstream::Virtex7LibGen::generateMemoryMicroBitstream ( )
protectedvirtual

Generate micro-bitstreams for memory elements like LUT in RAM mode.

Implements torc::bitstream::AssemblerLibGen.

Definition at line 307 of file Virtex7LibGen.cpp.

307  {
308  // Get compressed bit files for LUTs in RAM/ROM mode.
309  path libraryMemFolder = mLibraryFolder / "memory";
310  string perlScript = libraryMemFolder.string() + "/extract-bits-for-luts.pl";
311  string llFile = getParentFamilyName() + "-CLBLM_L-SLICEM-X-ROM.ll";
312  path llFilePath = libraryMemFolder / llFile;
313  string systemCommand = "perl " + perlScript + " " + llFilePath.string();
314  int systemReturn = system(systemCommand.c_str());
315 
316  llFile = getParentFamilyName() + "-CLBLM_R-SLICEM-X-ROM.ll";
317  llFilePath = libraryMemFolder / llFile;
318  systemCommand = "perl " + perlScript + " " + llFilePath.string();
319  systemReturn = system(systemCommand.c_str());
320  string cpyCmd = "mv " + libraryMemFolder.string() + "/*.cbit " + mXdlGenerationFolder.string();
321 // ToDo: Uncomment line below
322  systemReturn = system(cpyCmd.c_str());
323  (void) systemReturn;
324 }
path mXdlGenerationFolder
Folder in which Xdls will be generated.
virtual string getParentFamilyName()
Get parent family name.
path mLibraryFolder
Path to library folder.
boost::filesystem::path path
Imported type name.

+ Here is the call graph for this function:

void torc::bitstream::AssemblerLibGen::generateWireXdls ( )
inherited

Generate Xdls for routing pips.

Generate XDL files for tiles supported for PIPs.

Definition at line 167 of file AssemblerLibGen.cpp.

167  {
168  std::cout << "Generating micro XDLs for routing PIPs..." << std::endl;
169  TileCount tileCount = mTiles.getTileCount();
170 
171  // Go over tiles supported for PIPs
172  std::vector<std::string> tilesSupported = getTilesSupportedForPips();
173  std::vector<std::string>::const_iterator pTiles = tilesSupported.begin();
174  std::vector<std::string>::const_iterator eTiles = tilesSupported.end();
175  while(pTiles != eTiles) {
176 
177  std::string currTileName = *pTiles++;
178  bool firstTile = true; //Torc doesn't handle first tile well. So ignore it.
179  for(TileIndex i; i < tileCount; i++) {
180  const TileInfo& tileInfo = mTiles.getTileInfo(i);
181  TileTypeIndex tileTypeIndex = tileInfo.getTypeIndex();
182  std::string tileTypeName = mTiles.getTileTypeName(tileTypeIndex);
183  if(tileTypeName.compare(currTileName) == 0) {
184  if(firstTile) {
185  firstTile = false;
186  continue;
187  } else {
188  exportTileSinks(i);
189  break;
190  }
191  }
192  }
193  }
194 
195 }
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
void exportTileSinks(TileIndex inTileIndex)
Export all pips within the specified tile.
TileCount getTileCount(void) const
Returns the tile count for this device.
Definition: Tiles.hpp:149
std::string string
const Tiles & mTiles
Tiles from the database object.
Encapsulation of a tile count in an unsigned 32-bit integer.
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
const TileTypeIndex & getTypeIndex(void) const
Returns the tile type index for this tile.
Definition: TileInfo.hpp:92
Encapsulation of a tile type index in an unsigned 16-bit integer.
virtual std::vector< std::string > getTilesSupportedForPips()=0
Returns vector of supported tiles.

+ Here is the call graph for this function:

static CompoundSettingMap torc::bitstream::Virtex7LibGen::getCompoundSettingsMap ( )
inlinestatic

Returns map of coumpound settings.

Definition at line 37 of file Virtex7LibGen.hpp.

37  {
38  CompoundSettingMap compoundSettingMap;
39  std::vector<std::string> acascregCompound;
40  acascregCompound.push_back("AREG");
41  compoundSettingMap["ACASCREG"] = acascregCompound;
42 
43  std::vector<std::string> bcascregCompound;
44  bcascregCompound.push_back("BREG");
45  compoundSettingMap["BCASCREG"] = bcascregCompound;
46 
47  return compoundSettingMap;
48  }
std::map< const std::string, std::vector< std::string > > CompoundSettingMap

+ Here is the caller graph for this function:

std::map<string, string> torc::bitstream::AssemblerLibGen::getDeviceToPackageMap ( )
inlineprotectedinherited

Get a map from device to default package.

Definition at line 186 of file AssemblerLibGen.hpp.

186  {
187  std::map<string, string> deviceToPackageMap;
188  deviceToPackageMap["xc5vfx130t"] = "FF1738";
189  deviceToPackageMap["xc5vlx110t"] = "FF1136";
190  deviceToPackageMap["xc7a100t"] = "FGG484";
191  deviceToPackageMap["xc7z045"] = "FBG676";
192  return deviceToPackageMap;
193  }

+ Here is the caller graph for this function:

int torc::bitstream::AssemblerLibGen::getElementIndexFromName ( const string  inElementName,
PrimitiveStructureSharedPtr  inPrimitiveStructurePtr 
)
protectedinherited

Get index in Element array.

Definition at line 937 of file AssemblerLibGen.cpp.

937  {
938  int elementIndex = -1, index = 0;
939  const PrimitiveElementArray& elementsArray = inPrimitiveStructurePtr->getPrimitiveDefPtr()->getElements();
940  PrimitiveElementArray::const_iterator pElements = elementsArray.begin();
941  PrimitiveElementArray::const_iterator eElements = elementsArray.end();
942 
943  // For every primitive element (BEL) in the site
944  while(pElements != eElements) {
945  if(pElements->getName().compare(inElementName) == 0) {
946  elementIndex = index;
947  break;
948  }
949  pElements++; index++;
950  }
951  return elementIndex;
952 }
const const PrimitiveElement * const_iterator
Constant T iterator type.
Definition: Array.hpp:83
T * end(void)
Returns the non-constant end iterator.
Definition: Array.hpp:97
T * begin(void)
Returns the non-constant begin iterator.
Definition: Array.hpp:95

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

AssemblerLibGen::DesignSharedPtr torc::bitstream::AssemblerLibGen::getHarnessDesignForSiteType ( const string inSiteType)
protectedinherited

Returns harness design pointer for the given site type.

Every site type has a harness design which serves as base generating Xdl for all configurations of the site type

Definition at line 347 of file AssemblerLibGen.cpp.

347  {
348 
349  // Harness file name is of format <tile_type>-<site_type>.xdl
350  string harnessFileName = mCurTileType + sNameSeparator + inSiteType + sXdlExtension;
351  path harnessFilePath = mHarnessFolder / harnessFileName;
352 
353  DesignSharedPtr harnessDesignPtr;
354  std::ifstream fileStream(harnessFilePath.string().c_str());
355  if(!fileStream.good()) {
356  std::cerr << "Could not open file " << harnessFilePath.string() << std::endl;
357  return harnessDesignPtr;
358  }
360  importer(fileStream, harnessFilePath.string());
361 
362  fileStream.close();
363 
364  // Return the design pointer
365  harnessDesignPtr = importer.getDesignPtr();
366  return harnessDesignPtr;
367 }
DesignSharedPtr getDesignPtr(void)
Returns a shared pointer for the design.
static const char * sNameSeparator
Symbol to separate out parts of file name.
string mCurTileType
Tile type for which Xdl are being generated currently.
static const char * sXdlExtension
.xdl
Importer from XDL format into a physical design.
boost::filesystem::path path
Imported type name.
torc::physical::DesignSharedPtr DesignSharedPtr
Imported type name.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual string torc::bitstream::Virtex7LibGen::getParentFamilyName ( )
inlineprotectedvirtual

Get parent family name.

Virtual Functions

Reimplemented from torc::bitstream::AssemblerLibGen.

Definition at line 84 of file Virtex7LibGen.hpp.

84  {
85  return "Virtex7";
86  }

+ Here is the caller graph for this function:

AssemblerLibGen::PrimitiveStructuresSharedPtrMap torc::bitstream::Virtex7LibGen::getPrimitiveNameToStructreMap ( )
protectedvirtual

Populate primitive name to primitive structure map.

Creates map from primitive name to primitive structure object pointer

Implements torc::bitstream::AssemblerLibGen.

Definition at line 278 of file Virtex7LibGen.cpp.

278  {
279  PrimitiveStructuresSharedPtrMap primitiveStructures;
280  // look up the primitive def types
282  PrimitiveDefArray;
283  PrimitiveDefArray & primitiveDefs = mSites.getSiteTypes();
284  PrimitiveDefArray::const_iterator pPrimitiveDefs = primitiveDefs.begin();
285  PrimitiveDefArray::const_iterator ePrimitiveDefs = primitiveDefs.end();
286  // Store the corresponding primitive structures in a map.
287  while(pPrimitiveDefs < ePrimitiveDefs) {
288  // create a PrimitiveStructure object for this PrimitiveDef
289  torc::packer::PrimitiveStructureSharedPtr primitiveStructurePtr(
290  new torc::packer::Virtex7PrimitiveStructure(&*pPrimitiveDefs++));
291  const torc::architecture::PrimitiveDef *primitiveDefPtr =
292  primitiveStructurePtr->getPrimitiveDefPtr();
293  const std::string & primitiveDefName = primitiveDefPtr->getName();
294  // insert the PrimitiveStructure into the map
295  if(!isSlicelType(primitiveDefName)) {
296  primitiveStructures[primitiveDefName] = primitiveStructurePtr;
297  } else {
298  string sliceEven = primitiveDefName + "E";
299  string sliceOdd = primitiveDefName + "O";
300  primitiveStructures[sliceEven] = primitiveStructurePtr;
301  primitiveStructures[sliceOdd] = primitiveStructurePtr;
302  }
303  }
304  return primitiveStructures;
305 }
const Sites & mSites
Sites from the database object.
Encapsulation of primitive site definition, with associated connections, elements, and pins.
bool isSlicelType(const string &inSiteType)
Return true if site type is SLICEL.
std::string string
const Array< const PrimitiveDef > & getSiteTypes(void) const
Returns the site types for this family.
Definition: Sites.hpp:125
Subclass of PrimitiveStructure for Virtex7.
std::map< std::string, PrimitiveStructureSharedPtr > PrimitiveStructuresSharedPtrMap
Typedef of map from primitive name to primitive structure shared pointer.
boost::shared_ptr< PrimitiveStructure > PrimitiveStructureSharedPtr
Shared pointer encapsulation of a PrimitiveStructure.
const string & getName(void) const
Returns the name of the primitive.

+ Here is the call graph for this function:

virtual std::string torc::bitstream::Virtex7LibGen::getRambPrimaryPrimitive ( )
inlineprotectedvirtual

Returns primary primitive for Ramb site type.

Implements torc::bitstream::AssemblerLibGen.

Definition at line 57 of file Virtex7LibGen.hpp.

57  {
58  return "RAMB36E1";
59  }
std::map<string, string> torc::bitstream::Virtex7LibGen::getReferenceConfigMap ( )
inlineprotected

Get a map from config setting to reference value.

Definition at line 63 of file Virtex7LibGen.hpp.

63  {
64  std::map<string, string> referenceConfigMap;
65  referenceConfigMap["A5FFINIT"] = "INIT1";
66  referenceConfigMap["B5FFINIT"] = "INIT1";
67  referenceConfigMap["C5FFINIT"] = "INIT1";
68  referenceConfigMap["D5FFINIT"] = "INIT1";
69  referenceConfigMap["AFFINIT"] = "INIT1";
70  referenceConfigMap["BFFINIT"] = "INIT1";
71  referenceConfigMap["CFFINIT"] = "INIT1";
72  referenceConfigMap["DFFINIT"] = "INIT1";
73  referenceConfigMap["RAM_MODE"] = "TDP";
74  referenceConfigMap["LFSR_EN_SET"] = "SET";
75  referenceConfigMap["TEST_SET_P"] = "SET";
76  referenceConfigMap["MASK"] = "000000000000";
77  referenceConfigMap["PATTERN"] = "000000000000";
78 
79  return referenceConfigMap;
80  }

+ Here is the caller graph for this function:

AssemblerLibGen::string torc::bitstream::AssemblerLibGen::getReferenceConfigValue ( const string inConfigSetting)
protectedinherited

Return config value which results in off bit in bitstream.

Returns reference config value for give config setting.

Definition at line 370 of file AssemblerLibGen.cpp.

370  {
371  // if element present in the map of Element->ReferenceConfig, return it.
372  std::map<std::string, std::string>::const_iterator pElementConfigMap;
373  std::map<std::string, std::string>::const_iterator eElementConfigMap =
374  mReferenceConfigMap.end();
375  pElementConfigMap = mReferenceConfigMap.find(inConfigSetting);
376  if(pElementConfigMap != eElementConfigMap) {
377  return pElementConfigMap->second;
378  }
379  return string(sConfigValueOff);
380 }
std::string string
Imported type name.
std::map< string, string > mReferenceConfigMap
Map from config setting to reference config value.
static const char * sConfigValueOff
Config value to switch off element (#OFF)

+ Here is the caller graph for this function:

std::vector< std::string > torc::bitstream::Virtex7LibGen::getTilesSupportedForPips ( )
protectedvirtual

Returns list of supported tiles. Assumes last tile is "LAST_TILE".

Returns list of supported tiles.

Implements torc::bitstream::AssemblerLibGen.

Definition at line 69 of file Virtex7LibGen.cpp.

69  {
70  uint32_t supportedTileIndex = 0;
71  std::vector<std::string> tilesSupported;
72  while(sTilesSupportedForPips[supportedTileIndex].compare("LAST_TILE") != 0) {
73  tilesSupported.push_back(sTilesSupportedForPips[supportedTileIndex++]);
74  }
75  return tilesSupported;
76 }
static const string sTilesSupportedForPips[]
Array of supported routing tiles.
AssemblerLibGen::TileTypeToSiteTypeSet torc::bitstream::AssemblerLibGen::getTileTypeToSiteTypeMap ( void  )
inherited

Populate map of tile type to set of include site types.

A tile can contain more than one site. This functions returns a map from tile type to set of contained site types

Definition at line 277 of file AssemblerLibGen.cpp.

277  {
278 
279  TileTypeToSiteTypeSet tileTypeToSiteTypeMap;
281 
282  for(uint i = 0; i < allSites.getSize(); i++) {
283 
284  const torc::architecture::Site& site = allSites[i];
285  std::string siteType = site.getPrimitiveDefPtr()->getName();
286 
287  // Some sites can be instantiated via multiple primitives
288  // We are interested in one particular primitive only.
289  if(isRambSite(siteType))
290  siteType = getRambPrimaryPrimitive();
291 
292  TileIndex tileIndex = site.getTileIndex();
293  const TileInfo& tileInfo = mTiles.getTileInfo(tileIndex);
294  const std::string &tileType = mTiles.getTileTypeName(tileInfo.getTypeIndex());
295 
296  // There is no entry in map corresponding to this tile type
297  if(tileTypeToSiteTypeMap.find(tileType) == tileTypeToSiteTypeMap.end()) {
298  std::set<std::string> siteTypeSet;
299  // There are two slices contained in a tile. Micro bitstream for both the slices should be
300  // stored in library.
301  if(!isSlicelType(siteType)) {
302  siteTypeSet.insert(siteType);
303  } else {
304  string sliceEven = siteType + "E";
305  string sliceOdd = siteType + "O";
306  siteTypeSet.insert(sliceEven);
307  siteTypeSet.insert(sliceOdd);
308  }
309  tileTypeToSiteTypeMap.insert(std::pair<std::string, std::set<std::string> >(tileType,
310  siteTypeSet));
311  } else {
312  // There are 2 slices in a tile. The two sites should be treated differently.
313  if(!isSlicelType(siteType)) {
314  tileTypeToSiteTypeMap[tileType].insert(siteType);
315  } else {
316  string sliceEven = siteType + "E";
317  string sliceOdd = siteType + "O";
318  tileTypeToSiteTypeMap[tileType].insert(sliceEven);
319  tileTypeToSiteTypeMap[tileType].insert(sliceOdd);
320  }
321  }
322  }
323  return tileTypeToSiteTypeMap;
324 }
Encapsulation of a tile index in an unsigned 32-bit integer.
const PrimitiveDef * getPrimitiveDefPtr(void) const
Returns a pointer to the associated primitive definition.
Definition: Site.hpp:81
bool isRambSite(const string &inSiteType)
Returns true if input is a RAMB site.
const Sites & mSites
Sites from the database object.
const TileInfo & getTileInfo(TileIndex inTileIndex) const
Returns the TileInfo object for the specified tile.
Definition: Tiles.hpp:137
bool isSlicelType(const string &inSiteType)
Return true if site type is SLICEL.
std::string string
std::map< std::string, std::set< std::string > > TileTypeToSiteTypeSet
Typedef of map from tile type to set of site type.
Encapsulation of a device logic site.
Definition: Site.hpp:30
const Tiles & mTiles
Tiles from the database object.
const Array< const Site > & getSites(void) const
Returns the sites for this family.
Definition: Sites.hpp:127
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
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
virtual std::string getRambPrimaryPrimitive()=0
Returns primary primitivie for RAMB site type
Encapsulation of a static array.
Definition: Array.hpp:39
uint32_t getSize(void) const
Returns the array size.
Definition: Array.hpp:104
const string & getName(void) const
Returns the name of the primitive.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t torc::bitstream::Virtex7LibGen::getWordOffsetFromTileLocation ( TileRow  tileRow,
TileCol  tileCol,
BitstreamSharedPtr  inBitstreamPtr 
)
protectedvirtual

Get word offset from tile row and col.

Implements torc::bitstream::AssemblerLibGen.

Definition at line 254 of file Virtex7LibGen.cpp.

254  {
255  uint32_t bitIndexBegin = 0, bitIndexEnd = 0;
256  boost::shared_ptr<Virtex7> virtex7Ptr = boost::dynamic_pointer_cast<Virtex7>(inBitstreamPtr);
257  // ToDo: Uncomment after support is introduced
258  uint32_t primaryXdlCol = virtex7Ptr->getPrimaryXdlColumn(tileRow, tileCol);
259  virtex7Ptr->getXdlFrames(tileRow, primaryXdlCol, bitIndexBegin,
261 
262  // Each frame covers the full height of clock region which contains many rows of tiles.
263  // The library contains configuration bits only for the first row. So the word index has to
264  // be offset to reach the correct row. The bit index remains same across rows.
265  uint32_t outWordOffset = 0;
266  if(bitIndexBegin != bitIndexEnd) {
267  outWordOffset = Virtex7::eFrameLength - (bitIndexEnd >> 5); // eFrameLength is number of words in a frame
268 // outWordOffset = bitIndexBegin >> 5;
269  }
270 
271  std::cout << "*******Word offset " << outWordOffset << std::endl;
272 
273  return outWordOffset;
274 
275 }

+ Here is the call graph for this function:

uint32_t torc::bitstream::AssemblerLibGen::getWordOffsetFromXdlFile ( path  inBitstreamPath,
BitstreamSharedPtr  inBitstreamPtr 
)
protectedinherited

Get word offset in frame for the site/pip in corresponding Xdl.

Get word offset from Xdl.

Definition at line 883 of file AssemblerLibGen.cpp.

883  {
884 
885  path xdlFilePath = inBitstreamPath.replace_extension(".xdl");
886  std::ifstream xdlStream(xdlFilePath.string().c_str());
887  if(!xdlStream.good()) {
888  std::cout << "File " << xdlFilePath.string() << " not found" << std::endl;
889  return 0;
890  }
891  torc::physical::XdlImporter xdlImporter;
892  xdlImporter(xdlFilePath);
893 
894  // Get design pointer and related data base
895  torc::physical::DesignSharedPtr designPtr = xdlImporter.getDesignPtr();
896 
897  torc::architecture::DDB ddb(designPtr->getDevice());
898  const Tiles &tiles = ddb.getTiles();
899 
902 
903  bool pipDesign = false;
904  // We know this XDL has only one NET and one PIP
905  if(designPtr->netsBegin() != designPtr->netsEnd()) {
906  torc::physical::NetSharedPtr netPtr = *(designPtr->netsBegin());
907  if(netPtr->pipsBegin() != netPtr->pipsEnd()) {
908  std::cout << "\tProcessing NET" << std::endl;
909  pipDesign = true;
910  torc::physical::Pip pip = *(netPtr->pipsBegin());
911  torc::architecture::xilinx::TileIndex tileIndex = tiles.findTileIndex(pip.getTileName());
912  const torc::architecture::TileInfo& tileInfo = tiles.getTileInfo(tileIndex);
913  tileRow = tileInfo.getRow();
914  tileCol = tileInfo.getCol();
915  }
916  }
917 
918  // If there is no pip, it is an XDL for logic element.
919  if(pipDesign == false) {
920  const Sites &sites = ddb.getSites();
921  torc::physical::InstanceSharedPtr instancePtr = *(designPtr->instancesBegin());
922  SiteIndex siteIndex = sites.findSiteIndex(instancePtr->getSite());
923  const Site& site = sites.getSite(siteIndex);
924 
925  // look up the site tile index
926  TileIndex tileIndex = site.getTileIndex();
927  const TileInfo& tileInfo = tiles.getTileInfo(tileIndex);
928  tileRow = tileInfo.getRow();
929  tileCol = tileInfo.getCol();
930  }
931 
932  return getWordOffsetFromTileLocation(tileRow, tileCol, inBitstreamPtr);
933 
934 }
Encapsulation of a tile index in an unsigned 32-bit integer.
const TileCol & getCol(void) const
Returns the column for this tile.
Definition: TileInfo.hpp:96
Encapsulation of a tile row in an unsigned 16-bit integer.
const TileRow & getRow(void) const
Returns the row for this tile.
Definition: TileInfo.hpp:94
Encapsulation of a tile column in an unsigned 16-bit integer.
Device database, including complete wiring and logic support.
Definition: DDB.hpp:42
DesignSharedPtr getDesignPtr(void)
Returns a shared pointer for the design.
virtual uint32_t getWordOffsetFromTileLocation(TileRow tileRow, TileCol tileCol, BitstreamSharedPtr inBitstreamPtr)=0
Get word offset from tile location.
Encapsulation of a device logic site.
Definition: Site.hpp:30
Site type and population data for the family and the device.
Definition: Sites.hpp:45
Tile map, tile type, and wire information for the family and device.
Definition: Tiles.hpp:36
const Array< const Site > & getSites(void) const
Returns the sites for this family.
Definition: Sites.hpp:127
Encapsulation of a tile within a device tile map.
Definition: TileInfo.hpp:33
boost::shared_ptr< Net > NetSharedPtr
Shared pointer encapsulation of a Net.
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
boost::shared_ptr< Instance > InstanceSharedPtr
Shared pointer encapsulation of an Instance.
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
const Site & getSite(SiteIndex inSiteIndex) const
Returns the site for the specified index.
Definition: Sites.hpp:129
const TileName & getTileName(void) const
Returns the pip tile.
Definition: Pip.hpp:73
Physical design programmable interconnect point.
Definition: Pip.hpp:34
Encapsulation of a site index in an unsigned 32-bit integer.
Importer from XDL format into a physical design.
boost::filesystem::path path
Imported type name.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Do architecture specific part of initialization.

Architecture specific part of initializing the object

Definition at line 52 of file Virtex7LibGen.cpp.

52  {
53 
56 }
std::map< string, string > mReferenceConfigMap
Map from config setting to reference config value.
CompoundSettingMap mCompoundSettingMap
Map from one compound setting to vector of other related settings.
std::map< string, string > getReferenceConfigMap()
Get a map from config setting to reference value.
static CompoundSettingMap getCompoundSettingsMap()
Returns map of coumpound settings.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool torc::bitstream::AssemblerLibGen::isCompoundSettingHead ( const string inSetting)
inlineprotectedinherited

Is given setting head of compound setting group.

Definition at line 144 of file AssemblerLibGen.hpp.

144  {
145  CompoundSettingMap::const_iterator pElement = mCompoundSettingMap.find(inSetting);
146  // If element found in the compound settings map
147  if(pElement != mCompoundSettingMap.end()) {
148  return true;
149  }
150  return false;
151  }
CompoundSettingMap mCompoundSettingMap
Map from one compound setting to vector of other related settings.

+ Here is the caller graph for this function:

bool torc::bitstream::AssemblerLibGen::isDspSite ( const string inSiteType)
inlineprotectedinherited

Returns true is input is a DSP site.

Definition at line 140 of file AssemblerLibGen.hpp.

140  {
141  return boost::regex_search(inSiteType, boost::regex("DSP"));
142  }

+ Here is the caller graph for this function:

bool torc::bitstream::AssemblerLibGen::isRambSite ( const string inSiteType)
inlineprotectedinherited

Returns true if input is a RAMB site.

Definition at line 136 of file AssemblerLibGen.hpp.

136  {
137  return boost::regex_search(inSiteType, boost::regex("RAMB"));
138  }

+ Here is the caller graph for this function:

bool torc::bitstream::Virtex7LibGen::isSiteTypeSupported ( const string siteType)
protectedvirtual

Returns true if site type is supported.

Returns true for the sites which are supported by library generation process

Implements torc::bitstream::AssemblerLibGen.

Definition at line 59 of file Virtex7LibGen.cpp.

59  {
60  return (siteType.compare("SLICEM") == 0 ||
61  siteType.compare("SLICELO") == 0 || siteType.compare("SLICELE") == 0 ||
62  siteType.compare("*RAMB36E1") == 0 || siteType.compare("*DSP48E1") == 0 ||
63 // siteType.compare("BUFGCTRL") == 0 || siteType.compare("BUFDS") == 0 ||
64  siteType.compare("*BUFR") == 0 || siteType.compare("*BUFG") == 0)
65  ;
66 }
bool torc::bitstream::AssemblerLibGen::isSlicelType ( const string inSiteType)
inlineprotectedinherited

Return true if site type is SLICEL.

Definition at line 126 of file AssemblerLibGen.hpp.

126  {
127  return boost::regex_search(inSiteType.begin(), inSiteType.end(), boost::regex("SLICEL"));
128  }

+ Here is the caller graph for this function:

void torc::bitstream::AssemblerLibGen::printTileTypeToSiteTypeMapInfo ( TileTypeToSiteTypeSet  tileTypeToSiteType)
inherited

Print the tile type to site type information.

Prints list of tile types and the site types in each of the tile types

Definition at line 327 of file AssemblerLibGen.cpp.

327  {
328  TileTypeToSiteTypeSet::const_iterator p = tileTypeToSiteType.begin();
329  TileTypeToSiteTypeSet::const_iterator e = tileTypeToSiteType.end();
330  std::cout << "Tile type to Site type info:" << std::endl;
331  while(p != e) {
332  std::cout << " Tile: " << p->first << std::endl;
333  std::set<std::string>::iterator pSites = p->second.begin();
334  std::set<std::string>::iterator eSites = p->second.end();
335  while(pSites != eSites) {
336  std::cout << "\t" << *pSites;
337  pSites++;
338  }
339  std::cout << std::endl;
340  p++;
341  }
342 }
void torc::bitstream::AssemblerLibGen::saveLibraryMapToFile ( TileTypeToSiteType inLibrary)
protectedinherited

Save library map to file.

Saves the library map structure in database format

Definition at line 955 of file AssemblerLibGen.cpp.

955  {
956 
958  path dbFilePath = mLibraryFolder / dbFileName;
959  std::ofstream dbFile(dbFilePath.string().c_str(), std::ofstream::binary);
960  if(!dbFile.is_open()) {
961  std::cout << "Could not open file " << dbFilePath.string() << " to write" << std::endl;
962  return;
963  }
964 
965  std::cout << "Storing combined micro-bitstream in " << dbFilePath.string() << std::endl;
966  dbFile.write("<<<<BITLIBDB>>>>", 16);
967 // std::cout << "Tile map size " << sizeof(tileMap.size()) << std::endl;
968  uint32_t dataSize;
969  dataSize = inLibrary.size();
970  dbFile.write((char *) (&dataSize), sizeof(dataSize));
971  std::cout << "Total tiles " << dataSize << std::endl;
972 
973  // Now go over the map data structure and write it to a file
974  // File format is given at the top of this file
975  TileTypeToSiteType::const_iterator pTiletypes = inLibrary.begin();
976  TileTypeToSiteType::const_iterator eTiletypes = inLibrary.end();
977  while(pTiletypes != eTiletypes) {
978  // Write the tile name char count, name string and element count
979  dataSize = pTiletypes->first.size();
980  dbFile.write((const char *) &dataSize, sizeof(dataSize));
981  dbFile.write((const char *) pTiletypes->first.c_str(), pTiletypes->first.size());
982  dataSize = pTiletypes->second.size();
983  dbFile.write((const char*) &dataSize, sizeof(dataSize));
984  std::cout << "Tile type " << pTiletypes->first << " has " << pTiletypes->second.size()
985  << " sites." << std::endl;
986 
987  // Iterate over elements
988  SiteTypeToConfigSettings::const_iterator pSiteTypes = pTiletypes->second.begin();
989  SiteTypeToConfigSettings::const_iterator eSiteTypes = pTiletypes->second.end();
990  while(pSiteTypes != eSiteTypes) {
991 
992  // Write site type name char count, name string and config setting count
993  dataSize = pSiteTypes->first.size();
994  dbFile.write((const char *) &dataSize, sizeof(dataSize));
995  dbFile.write((const char *) pSiteTypes->first.c_str(), pSiteTypes->first.size());
996  dataSize = pSiteTypes->second.size();
997  dbFile.write((const char *) &dataSize, sizeof(dataSize));
998 // std::cout << " Element type " << pSiteTypes->first << " has "
999 // << pSiteTypes->second.size() << " configs." << std::endl;
1000 
1001  // Itereate over configs
1002  ConfigSettingsToValues::const_iterator pConfigSettings = pSiteTypes->second.begin();
1003  ConfigSettingsToValues::const_iterator eConfigSettings = pSiteTypes->second.end();
1004  while(pConfigSettings != eConfigSettings) {
1005  // Write config namem char count, name string and count of bit addresses
1006  dataSize = pConfigSettings->first.size();
1007  dbFile.write((const char *) &dataSize, sizeof(dataSize));
1008  dbFile.write(pConfigSettings->first.c_str(), pConfigSettings->first.size());
1009  dataSize = pConfigSettings->second.size();
1010  dbFile.write((const char *) &dataSize, sizeof(dataSize));
1011 
1012  ConfigValuesToBits::const_iterator pConfigValues = pConfigSettings->second.begin();
1013  ConfigValuesToBits::const_iterator eConfigValues = pConfigSettings->second.end();
1014 
1015  while(pConfigValues != eConfigValues) {
1016 
1017  dataSize = pConfigValues->first.size();
1018  dbFile.write((const char *) &dataSize, sizeof(dataSize));
1019  dbFile.write(pConfigValues->first.c_str(), pConfigValues->first.size());
1020  dataSize = pConfigValues->second.size();
1021  dbFile.write((const char *) &dataSize, sizeof(dataSize));
1022  // Write the bit addresses
1023  for(std::vector<uint32_t>::const_iterator iter = pConfigValues->second.begin(); iter
1024  != pConfigValues->second.end(); iter++) {
1025  dbFile.write((char *) &*iter, sizeof(uint32_t));
1026  }
1027 // std::cout << "\t" << pConfigSettings->first << " " << pConfigSettings->second.size();
1028  pConfigValues++;
1029  }
1030  pConfigSettings++;
1031  }
1032 // std::cout << std::endl;
1033  pSiteTypes++;
1034  }
1035  pTiletypes++;
1036  }
1037 
1038  // Close file
1039  dbFile.close();
1040 
1041 }
static const char * sLibExtension
.ldb
std::string string
path mLibraryFolder
Path to library folder.
virtual string getParentFamilyName()
Returns parent family name.
boost::filesystem::path path
Imported type name.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::bitstream::AssemblerLibGen::setConfigAndGenerateXdl ( const string inConfigSetting,
const string inConfigValue,
const string inXdlFileName,
DesignSharedPtr  inOutDesignPtr 
)
protectedinherited

Set given config and generate Xdl.

Definition at line 703 of file AssemblerLibGen.cpp.

704  {
705 
706  InstanceSharedPtr instancePtr = *(inOutDesignPtr->instancesBegin());
707 
708  instancePtr->setConfig(inConfigSetting, "", inConfigValue);
709  // create the appropriate file paths
710  path xdlFilePath = mXdlGenerationFolder / inXdlFileName;
711 
712  // Export the design as XDL
713  std::fstream xdlExport(xdlFilePath.string().c_str(), std::ios_base::out);
714  torc::physical::XdlExporter fileExporter(xdlExport);
715  fileExporter(inOutDesignPtr);
716 }
torc::physical::InstanceSharedPtr InstanceSharedPtr
Imported type name.
path mXdlGenerationFolder
Folder in which Xdls will be generated.
boost::filesystem::path path
Imported type name.
Physical design exporter for XDL.
Definition: XdlExporter.hpp:31

+ Here is the caller graph for this function:

void torc::bitstream::AssemblerLibGen::stitchMicroBitstreams ( )
inherited

Stitch micro-bitstreams in mXdlGenerationFolder.

Stitch micro-bitstreams in folder mXdlGenerationFolder Go over all files with extension .cbit, split file name on '-' to get family, tile type, site type, config setting, and config value. The vector of address and names are stored in map data structure and then stored in a file. File format is - <<<<BITLIBDB>>>> Number of tile types Tile type name char count Tile type Number of sites Site type name char count Site type Config seting name char count Config setting Config value name char count Config value Number of 32bit words in compressed bitstream words

Definition at line 802 of file AssemblerLibGen.cpp.

802  {
803  std::cout << "Stitching micro bitstream files..." << std::endl;
804  // Maps to store the information on tile type, elements and configs
805  std::vector<ConfigValuesToBits> configMapVector;
806  std::vector<ConfigSettingsToValues> settingsToValuesMap;
807  std::vector<SiteTypeToConfigSettings> siteToSettingsMap;
808  TileTypeToSiteType library;
809 
810  // Go over all the files in the directory
811  boost::filesystem::directory_iterator eFiles;
812  boost::filesystem::directory_iterator pFiles(mXdlGenerationFolder);
813  while(pFiles != eFiles) {
814 
815  // If it is a compressed bit file (.cbit extension)
816  if(pFiles->path().extension() == ".cbit") {
817 
818  std::ifstream libBitFile(pFiles->path().string().c_str(), std::ios::binary);
819  if(!libBitFile.good()) {
820  std::cerr << "ERROR: Could not open micro-bitstream file " << pFiles->path().string() << std::endl;
821  return;
822  }
823 
824  // Get number of bits set and put the bit addresses in a vector
825  int32_t numSetBits, bitAddr;
826  libBitFile.read((char *) &numSetBits, 4);
827  std::cout << "\t" << pFiles->path().filename() << " opened. Bit count " << numSetBits << std::endl;
828  std::vector<uint32_t> bitAddresses;
829  for(int i = 0; i < numSetBits && !libBitFile.eof(); i++) {
830  libBitFile.read((char *) &bitAddr, 4);
831  bitAddresses.push_back(bitAddr);
832  }
833 
834  // Get the file name without extension and split the name to get tile type, site type element/source wire and config/sink wire.
835  boost::filesystem::path filePath(pFiles->path());
836  // (Note: Wrapping filename() as a path for compatibility with Boost.Filesystem V2)
837  std::string fileName(boost::filesystem::path(filePath.replace_extension().filename()).string());
838 
839  std::vector<std::string> splitVector;
840  boost::algorithm::split(splitVector, fileName, boost::algorithm::is_any_of(sNameSeparator));
841 
842  // Get the tile type, element(source wire) and config (sink wire)from the split string
843  string tileType(splitVector[1]);
844  string siteType(splitVector[2]);
845  string configSetting(splitVector[3]);
846  string configValue(splitVector[4]);
847 
848  // if tile not found in map, a new tile type has come up. Add it to the map.
849  // Create another map for Element-config and push it in vector so that it is not destroyed.
850  if(library.find(tileType) == library.end()) {
851  SiteTypeToConfigSettings siteToSettings;
852  siteToSettingsMap.push_back(siteToSettings);
853  library[tileType] = siteToSettingsMap.back();
854  }
855 
856  // Check if site type is present in map
857  if(library[tileType].find(siteType) == library[tileType].end()) {
858  ConfigSettingsToValues settingToValues;
859  settingsToValuesMap.push_back(settingToValues);
860  library[tileType][siteType] = settingsToValuesMap.back();
861  }
862 
863  // Check if config setting is present in library
864  if(library[tileType][siteType].find(configSetting) == library[tileType][siteType].end()) {
865  ConfigValuesToBits valuesToBits;
866  configMapVector.push_back(valuesToBits);
867  library[tileType][siteType][configSetting] = configMapVector.back();
868  }
869 
870  // Mapping the config to bit addresses
871  library[tileType][siteType][configSetting][configValue] = bitAddresses;
872 
873  }
874 
875  pFiles++;
876  }
877 
878  saveLibraryMapToFile(library);
879 
880 }
path mXdlGenerationFolder
Folder in which Xdls will be generated.
torc::bitstream::Assembler::ConfigValuesToBits ConfigValuesToBits
static const char * sNameSeparator
Symbol to separate out parts of file name.
std::string string
void saveLibraryMapToFile(TileTypeToSiteType &inLibrary)
Save library map to file.
boost::filesystem::path path
torc::bitstream::Assembler::ConfigSettingsToValues ConfigSettingsToValues
torc::bitstream::Assembler::SiteTypeToConfigSettings SiteTypeToConfigSettings
torc::bitstream::Assembler::TileTypeToSiteType TileTypeToSiteType

+ Here is the call graph for this function:

Field Documentation

CompoundSettingMap torc::bitstream::AssemblerLibGen::mCompoundSettingMap
protectedinherited

Map from one compound setting to vector of other related settings.

Definition at line 224 of file AssemblerLibGen.hpp.

string torc::bitstream::AssemblerLibGen::mCurTileType
protectedinherited

Tile type for which Xdl are being generated currently.

Definition at line 228 of file AssemblerLibGen.hpp.

DDB& torc::bitstream::AssemblerLibGen::mDB
protectedinherited

Database object.

Definition at line 217 of file AssemblerLibGen.hpp.

std::map<string, string> torc::bitstream::AssemblerLibGen::mDeviceToPackageMap
protectedinherited

Map from device to pakcage.

Definition at line 225 of file AssemblerLibGen.hpp.

path torc::bitstream::AssemblerLibGen::mHarnessFolder
protectedinherited

Harness folder.

Definition at line 220 of file AssemblerLibGen.hpp.

path torc::bitstream::AssemblerLibGen::mLibraryFolder
protectedinherited

Path to library folder.

Definition at line 223 of file AssemblerLibGen.hpp.

std::map<string, string> torc::bitstream::AssemblerLibGen::mReferenceConfigMap
protectedinherited

Map from config setting to reference config value.

Definition at line 226 of file AssemblerLibGen.hpp.

const Sites& torc::bitstream::AssemblerLibGen::mSites
protectedinherited

Sites from the database object.

Definition at line 218 of file AssemblerLibGen.hpp.

const Tiles& torc::bitstream::AssemblerLibGen::mTiles
protectedinherited

Tiles from the database object.

Definition at line 219 of file AssemblerLibGen.hpp.

path torc::bitstream::AssemblerLibGen::mXdlGenerationFolder
protectedinherited

Folder in which Xdls will be generated.

Definition at line 221 of file AssemblerLibGen.hpp.

path torc::bitstream::AssemblerLibGen::mXdlGenerationReferenceFolder
protectedinherited

Folder in which reference Xdls will be genered.

Definition at line 222 of file AssemblerLibGen.hpp.

const char * torc::bitstream::AssemblerLibGen::sConfigValueOff = "#OFF"
staticprotectedinherited

Config value to switch off element (#OFF)

Definition at line 230 of file AssemblerLibGen.hpp.

const int torc::bitstream::Virtex7LibGen::sCrcWordIndex = 50
staticprotected

This have to be changed for different Family.

Definition at line 98 of file Virtex7LibGen.hpp.

const char * torc::bitstream::AssemblerLibGen::sLibExtension = ".ldb"
staticprotectedinherited

.ldb

Definition at line 232 of file AssemblerLibGen.hpp.

const char * torc::bitstream::AssemblerLibGen::sNameSeparator = "-"
staticprotectedinherited

Symbol to separate out parts of file name.

static const initialization

Definition at line 229 of file AssemblerLibGen.hpp.

const string torc::bitstream::Virtex7LibGen::sTilesSupportedForPips
staticprotected
Initial value:
= {
"INT_R",
"INT_L",
"CLBLM_L",
"CLBLM_R",
"CLK_BUFG_BOT_R",
"CLK_BUFG_REBUF",
"CLK_BUFG_TOP_R",
"CLK_HROW_BOT_R",
"CLK_HROW_TOP_R",
"CLK_MTBF2",
"CLK_PMV",
"CLK_PMV2",
"HCLK_CMT",
"HCLK_IOI",
"HCLK_IOI3",
"HCLK_BRAM",
"HCLK_CLB",
"HCLK_GTX",
"HCLK_IOB",
"HCLK_VBRK",
"LAST_TILE"
}

Array of supported routing tiles.

Definition at line 99 of file Virtex7LibGen.hpp.

const char * torc::bitstream::AssemblerLibGen::sXdlExtension = ".xdl"
staticprotectedinherited

.xdl

Definition at line 231 of file AssemblerLibGen.hpp.


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