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

Site type and population data for the family and the device. More...

#include <Sites.hpp>

+ Inheritance diagram for torc::architecture::Sites:
+ Collaboration diagram for torc::architecture::Sites:

Public Member Functions

SiteCount getSiteCount (void) const
 Returns the site count for this device. More...
 
SiteTypeCount getSiteTypeCount (void) const
 Returns the site type count for this family. More...
 
const Array< const PrimitiveDef > & getSiteTypes (void) const
 Returns the site types for this family. More...
 
const Array< const Site > & getSites (void) const
 Returns the sites for this family. More...
 
const SitegetSite (SiteIndex inSiteIndex) const
 Returns the site for the specified index. More...
 
const Array< const Package > & getPackages (void) const
 Returns the packages for this family. More...
 
SiteIndex findSiteIndex (const string &inName) const
 Returns the site index for the given site name. More...
 
PackageIndex findPackageIndex (const string &inName) const
 Returns the package index for the given package name. More...
 

Protected Types

typedef std::string string
 Imported type name. More...
 
typedef xilinx::TileIndex TileIndex
 Imported type name. More...
 
typedef xilinx::WireIndex WireIndex
 Imported type name. More...
 
typedef xilinx::PinFlags PinFlags
 Imported type name. More...
 
typedef xilinx::PinCount PinCount
 Imported type name. More...
 
typedef xilinx::SiteCount SiteCount
 Imported type name. More...
 
typedef xilinx::SiteIndex SiteIndex
 Imported type name. More...
 
typedef xilinx::SiteFlags SiteFlags
 Imported type name. More...
 
typedef xilinx::SiteTypeCount SiteTypeCount
 Imported type name. More...
 
typedef xilinx::SiteTypeIndex SiteTypeIndex
 Imported type name. More...
 
typedef xilinx::PackageCount PackageCount
 Imported type name. More...
 
typedef xilinx::PackageIndex PackageIndex
 Imported type name. More...
 
typedef xilinx::PadCount PadCount
 Imported type name. More...
 
typedef xilinx::PadIndex PadIndex
 Imported type name. More...
 
typedef std::map< string,
SiteIndex
SiteNameToSiteIndexMap
 Map from site name to site index. More...
 
typedef std::map< string,
PackageIndex
PackageNameToPackageIndexMap
 Map from package name to package index. More...
 

Protected Member Functions

size_t readPrimitiveTypes (DigestStream &inStream)
 Read the primitive types for the family. More...
 
size_t readPrimitivePinMaps (DigestStream &inStream)
 Read the site pin mappings for the family. More...
 
size_t readSites (DigestStream &inStream)
 Read the sites for the device. More...
 
size_t readPackages (DigestStream &inStream)
 Read the packages for the device. More...
 
void activatePackage (const string &inName)
 Activate the specified device package. More...
 
void activatePackage (PackageIndex inPackageIndex)
 Activate the specified device package. More...
 

Protected Attributes

Array< const PrimitiveDefmSiteTypes
 The site types for this family. More...
 
Array2D< const WireIndexmPrimitivePinMaps
 The site pin maps for this family. More...
 
Array< const SitemSites
 The logic sites for this device. More...
 
SiteNameToSiteIndexMap mSiteNameToSiteIndex
 The mapping from site name to site index for this device. More...
 
Array< const PackagemPackages
 The packages for this device. More...
 
PackageNameToPackageIndexMap mPackageNameToPackageIndex
 The mapping from package name to package index for this device. More...
 

Private Types

typedef std::basic_istream< char > istream
 Internal typedef of istream;. More...
 
typedef std::basic_ostream< char > ostream
 Internal typedef of ostream;. More...
 

Private Member Functions

istreammIn (void)
 Returns the database console input stream. More...
 
ostreammOut (void)
 Returns the database console output stream. More...
 
ostreammErr (void)
 Returns the database console error stream. More...
 
ostreammLog (void)
 Returns the database console log stream. More...
 
istreamgetConsoleIn (void)
 Returns the database console input stream. More...
 
ostreamgetConsoleOut (void)
 Returns the database console output stream. More...
 
ostreamgetConsoleErr (void)
 Returns the database console error stream. More...
 
ostreamgetConsoleLog (void)
 Returns the database console log stream. More...
 
void setConsoleIn (istream &inStream)
 Sets the database console input stream. More...
 
void setConsoleOut (ostream &inStream)
 Sets the database console output stream. More...
 
void setConsoleErr (ostream &inStream)
 Sets the database console error stream. More...
 
void setConsoleLog (ostream &inStream)
 Sets the database console log stream. More...
 
virtual void setConsoleStreams (istream &inIn, ostream &inOut, ostream &inErr, ostream &inLog)
 Sets all of the database console streams. More...
 

Private Attributes

istreammInPtr
 Pointer to the database console input stream. More...
 
ostreammOutPtr
 
ostreammErrPtr
 
ostreammLogPtr
 

Static Private Attributes

static DDBConsoleStreams sDefaultConsoleStreams
 
static DDBConsoleStreams sNullConsoleStreams
 

Friends

class DDB
 The database has access to our protected functions. More...
 

Detailed Description

Site type and population data for the family and the device.

Each device has a collection of logic sites. Those sites are instantiations of family defined site types, with each instance also including a mapping from site pin to Tilewire.

Definition at line 45 of file Sites.hpp.

Member Typedef Documentation

Internal typedef of istream;.

Definition at line 41 of file DDBConsoleStreams.hpp.

Internal typedef of ostream;.

Definition at line 43 of file DDBConsoleStreams.hpp.

Imported type name.

Definition at line 61 of file Sites.hpp.

Imported type name.

Definition at line 62 of file Sites.hpp.

Map from package name to package index.

Definition at line 68 of file Sites.hpp.

Imported type name.

Definition at line 63 of file Sites.hpp.

Imported type name.

Definition at line 64 of file Sites.hpp.

Imported type name.

Definition at line 55 of file Sites.hpp.

Imported type name.

Definition at line 54 of file Sites.hpp.

Imported type name.

Definition at line 56 of file Sites.hpp.

Imported type name.

Definition at line 58 of file Sites.hpp.

Imported type name.

Definition at line 57 of file Sites.hpp.

Map from site name to site index.

Definition at line 66 of file Sites.hpp.

Imported type name.

Definition at line 59 of file Sites.hpp.

Imported type name.

Definition at line 60 of file Sites.hpp.

typedef std::string torc::architecture::Sites::string
protected

Imported type name.

Definition at line 51 of file Sites.hpp.

Imported type name.

Definition at line 52 of file Sites.hpp.

Imported type name.

Definition at line 53 of file Sites.hpp.

Member Function Documentation

void torc::architecture::Sites::activatePackage ( const string inName)
inlineprotected

Activate the specified device package.

Definition at line 92 of file Sites.hpp.

92  {
94  }
void activatePackage(const string &inName)
Activate the specified device package.
Definition: Sites.hpp:92
PackageIndex findPackageIndex(const string &inName) const
Returns the package index for the given package name.
Definition: Sites.hpp:140

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::architecture::Sites::activatePackage ( PackageIndex  inPackageIndex)
inlineprotected

Activate the specified device package.

Definition at line 96 of file Sites.hpp.

96  {
97  // look up the package
98  if(inPackageIndex >= mPackages.getSize()) return;
99  const Package& package = mPackages[inPackageIndex];
100  // iterate through the pads
101  const Array<const Pad>& pads = package.getPads();
102  Array<const Pad>::const_iterator p = pads.begin();
103  Array<const Pad>::const_iterator e = pads.end();
104  while(p < e) {
105  // update the site name and flags
106  Site& site = const_cast<Site&>(mSites[p->mSiteIndex]);
107  site.mName = p->mName;
108  site.mFlags = p->mFlags;
109  p++;
110  }
111  // update the name to index map
112  mSiteNameToSiteIndex.clear();
113  for(SiteIndex i; i < getSiteCount(); i++) {
114  Site& site = const_cast<Site&>(mSites[i]);
115  mSiteNameToSiteIndex[site.mName] = i;
116  }
117  }
SiteCount getSiteCount(void) const
Returns the site count for this device.
Definition: Sites.hpp:121
const const Pad * const_iterator
Constant T iterator type.
Definition: Array.hpp:83
string mName
The name of the pad in its physical package.
Definition: Pad.hpp:49
SiteNameToSiteIndexMap mSiteNameToSiteIndex
The mapping from site name to site index for this device.
Definition: Sites.hpp:77
Array< const Package > mPackages
The packages for this device.
Definition: Sites.hpp:79
Array< const Site > mSites
The logic sites for this device.
Definition: Sites.hpp:75
xilinx::SiteIndex SiteIndex
Imported type name.
Definition: Sites.hpp:57

+ Here is the call graph for this function:

PackageIndex torc::architecture::Sites::findPackageIndex ( const string inName) const
inline

Returns the package index for the given package name.

Definition at line 140 of file Sites.hpp.

140  {
141  PackageNameToPackageIndexMap::const_iterator p
142  = mPackageNameToPackageIndex.find(inName);
143  return (p == mPackageNameToPackageIndex.end())
144  ? PackageIndex(PackageIndex::undefined()) : p->second;
145  }
xilinx::PackageIndex PackageIndex
Imported type name.
Definition: Sites.hpp:62
PackageNameToPackageIndexMap mPackageNameToPackageIndex
The mapping from package name to package index for this device.
Definition: Sites.hpp:81

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SiteIndex torc::architecture::Sites::findSiteIndex ( const string inName) const
inline

Returns the site index for the given site name.

Definition at line 134 of file Sites.hpp.

134  {
135  SiteNameToSiteIndexMap::const_iterator p = mSiteNameToSiteIndex.find(inName);
136  return (p == mSiteNameToSiteIndex.end())
137  ? SiteIndex(SiteIndex::undefined()) : p->second;
138  }
SiteNameToSiteIndexMap mSiteNameToSiteIndex
The mapping from site name to site index for this device.
Definition: Sites.hpp:77
xilinx::SiteIndex SiteIndex
Imported type name.
Definition: Sites.hpp:57

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ostream& torc::architecture::DDBConsoleStreams::getConsoleErr ( void  )
inlineinherited

Returns the database console error stream.

Definition at line 69 of file DDBConsoleStreams.hpp.

69 { return mErr(); }
ostream & mErr(void)
Returns the database console error stream.

+ Here is the call graph for this function:

istream& torc::architecture::DDBConsoleStreams::getConsoleIn ( void  )
inlineinherited

Returns the database console input stream.

Definition at line 65 of file DDBConsoleStreams.hpp.

65 { return mIn(); }
istream & mIn(void)
Returns the database console input stream.

+ Here is the call graph for this function:

ostream& torc::architecture::DDBConsoleStreams::getConsoleLog ( void  )
inlineinherited

Returns the database console log stream.

Definition at line 71 of file DDBConsoleStreams.hpp.

71 { return mLog(); }
ostream & mLog(void)
Returns the database console log stream.

+ Here is the call graph for this function:

ostream& torc::architecture::DDBConsoleStreams::getConsoleOut ( void  )
inlineinherited

Returns the database console output stream.

Definition at line 67 of file DDBConsoleStreams.hpp.

67 { return mOut(); }
ostream & mOut(void)
Returns the database console output stream.

+ Here is the call graph for this function:

const Array<const Package>& torc::architecture::Sites::getPackages ( void  ) const
inline

Returns the packages for this family.

Definition at line 131 of file Sites.hpp.

131 { return mPackages; }
Array< const Package > mPackages
The packages for this device.
Definition: Sites.hpp:79
const Site& torc::architecture::Sites::getSite ( SiteIndex  inSiteIndex) const
inline

Returns the site for the specified index.

Definition at line 129 of file Sites.hpp.

129 { return mSites[inSiteIndex]; }
Array< const Site > mSites
The logic sites for this device.
Definition: Sites.hpp:75

+ Here is the caller graph for this function:

SiteCount torc::architecture::Sites::getSiteCount ( void  ) const
inline

Returns the site count for this device.

Definition at line 121 of file Sites.hpp.

121 { return SiteCount(mSites.getSize()); }
xilinx::SiteCount SiteCount
Imported type name.
Definition: Sites.hpp:56
Array< const Site > mSites
The logic sites for this device.
Definition: Sites.hpp:75

+ Here is the caller graph for this function:

const Array<const Site>& torc::architecture::Sites::getSites ( void  ) const
inline

Returns the sites for this family.

Definition at line 127 of file Sites.hpp.

127 { return mSites; }
Array< const Site > mSites
The logic sites for this device.
Definition: Sites.hpp:75

+ Here is the caller graph for this function:

SiteTypeCount torc::architecture::Sites::getSiteTypeCount ( void  ) const
inline

Returns the site type count for this family.

Definition at line 123 of file Sites.hpp.

123 { return SiteTypeCount(mSiteTypes.getSize()); }
xilinx::SiteTypeCount SiteTypeCount
Imported type name.
Definition: Sites.hpp:59
Array< const PrimitiveDef > mSiteTypes
The site types for this family.
Definition: Sites.hpp:71

+ Here is the caller graph for this function:

const Array<const PrimitiveDef>& torc::architecture::Sites::getSiteTypes ( void  ) const
inline

Returns the site types for this family.

Definition at line 125 of file Sites.hpp.

125 { return mSiteTypes; }
Array< const PrimitiveDef > mSiteTypes
The site types for this family.
Definition: Sites.hpp:71

+ Here is the caller graph for this function:

ostream& torc::architecture::DDBConsoleStreams::mErr ( void  )
inlineinherited

Returns the database console error stream.

Definition at line 61 of file DDBConsoleStreams.hpp.

+ Here is the caller graph for this function:

istream& torc::architecture::DDBConsoleStreams::mIn ( void  )
inlineinherited

Returns the database console input stream.

Definition at line 57 of file DDBConsoleStreams.hpp.

57 { return *mInPtr; }
istream * mInPtr
Pointer to the database console input stream.

+ Here is the caller graph for this function:

ostream& torc::architecture::DDBConsoleStreams::mLog ( void  )
inlineinherited

Returns the database console log stream.

Definition at line 63 of file DDBConsoleStreams.hpp.

+ Here is the caller graph for this function:

ostream& torc::architecture::DDBConsoleStreams::mOut ( void  )
inlineinherited

Returns the database console output stream.

Definition at line 59 of file DDBConsoleStreams.hpp.

+ Here is the caller graph for this function:

size_t torc::architecture::Sites::readPackages ( DigestStream inStream)
protected

Read the packages for the device.

Todo:
Throw a proper exception.
Todo:
Throw a proper exception.
Todo:
Throw a proper exception.

Definition at line 25 of file Sites.cpp.

25  {
26  // prepare to read from the stream
27  size_t bytesReadOffset = inStream.getBytesRead();
28  char scratch[1 << 10]; // scratch read buffer
29  uint16_t nameLength = 0; // length of tile type name
30  PackageCount packageCount; // number of packages
31  PadCount padCount; // number of pads
32  SiteFlags siteFlags; // site attribute flags
33  SiteIndex siteIndex; // pad site index
34 
35  // read the section header
36  string sectionName;
37  inStream.readSectionHeader(sectionName);
38  /// \todo Throw a proper exception.
39  if(sectionName != ">>>>Packages>>>>") throw -1;
40 
41  // initialize the package array
42  inStream.read(packageCount);
43  mPackages.setSize(packageCount);
44  mOut() << "\tReading " << packageCount << " package" << (packageCount != 1 ? "s" : "")
45  << " (";
46  // loop through each package
47  for(PackageIndex i; i < packageCount; i++) {
48  // look up the current package
49  Package& package = const_cast<Package&>(mPackages[i]);
50  // read the package name
51  inStream.read(nameLength);
52  /// \todo Throw a proper exception.
53  if(nameLength > sizeof(scratch)) throw -1;
54  inStream.read(scratch, nameLength);
55  scratch[nameLength] = 0;
56  // update the package
57  package.mName = scratch;
58  mPackageNameToPackageIndex[scratch] = i;
59  mOut() << scratch << (i + 1 < packageCount ? ", " : "");
60  // read the pad count
61  inStream.read(padCount);
62  package.mPads.setSize(padCount);
63  // loop through each pad
64  for(PadCount j; j < padCount; j++) {
65  // look up the current pad
66  Pad& pad = const_cast<Pad&>(package.mPads[j]);
67  // read the site index
68  inStream.read(siteIndex);
69  // read the site flags
70  inStream.read(siteFlags);
71  // read the pad name
72  inStream.read(nameLength);
73  /// \todo Throw a proper exception.
74  if(nameLength > sizeof(scratch)) throw -1;
75  inStream.read(scratch, nameLength);
76  scratch[nameLength] = 0;
77  // update the package pad
78  pad.mSiteIndex = siteIndex;
79  pad.mFlags = siteFlags;
80  pad.mName = scratch;
81  package.mPadNameToPadIndex[scratch] = xilinx::PadIndex(j);
82  }
83  }
84  mOut() << ") ..." << std::endl;
85 
86  // return the number of bytes read
87  return inStream.getBytesRead() - bytesReadOffset;
88  }
xilinx::PackageCount PackageCount
Imported type name.
Definition: Sites.hpp:61
xilinx::PackageIndex PackageIndex
Imported type name.
Definition: Sites.hpp:62
Array< const Package > mPackages
The packages for this device.
Definition: Sites.hpp:79
xilinx::SiteFlags SiteFlags
Imported type name.
Definition: Sites.hpp:58
xilinx::PadCount PadCount
Imported type name.
Definition: Sites.hpp:63
PackageNameToPackageIndexMap mPackageNameToPackageIndex
The mapping from package name to package index for this device.
Definition: Sites.hpp:81
xilinx::SiteIndex SiteIndex
Imported type name.
Definition: Sites.hpp:57
ostream & mOut(void)
Returns the database console output stream.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t torc::architecture::Sites::readPrimitivePinMaps ( DigestStream inStream)
protected

Read the site pin mappings for the family.

Todo:
Throw a proper exception.

Definition at line 267 of file Sites.cpp.

267  {
268  // prepare to read from the stream
269  size_t bytesReadOffset = inStream.getBytesRead();
270  uint16_t primitivePinMapCount = 0; // number of pin maps
271  PinCount pinCount; // number of pins
272  WireIndex wireIndex; // pin index
273 
274  // read the section header
275  string sectionName;
276  inStream.readSectionHeader(sectionName);
277  /// \todo Throw a proper exception.
278  if(sectionName != ">>>>Pin Maps>>>>") throw -1;
279 
280  // initialize the site pin map array
281  inStream.read(primitivePinMapCount);
282  mPrimitivePinMaps.setSize(primitivePinMapCount);
283  mOut() << "\tReading " << primitivePinMapCount << " primitive pin maps..." << std::endl;
284  // loop through each pin map
285  for(uint16_t i = 0; i < primitivePinMapCount; i++) {
286  // read the pin count
287  inStream.read(pinCount);
288  mPrimitivePinMaps[i].setSize(pinCount);
289  // get a reference to this map's pin array
290  Array<const WireIndex>& pins = mPrimitivePinMaps[i];
291  // loop through each pin
292  for(PinCount j; j < pinCount; j++) {
293  // look up a reference to the pin and discard the const trait
294  WireIndex& pin = const_cast<WireIndex&>(pins[j]);
295  // read the pin
296  inStream.read(wireIndex);
297  pin = wireIndex;
298  }
299  }
300 
301  // return the number of bytes read
302  return inStream.getBytesRead() - bytesReadOffset;
303  }
xilinx::PinCount PinCount
Imported type name.
Definition: Sites.hpp:55
ostream & mOut(void)
Returns the database console output stream.
Array2D< const WireIndex > mPrimitivePinMaps
The site pin maps for this family.
Definition: Sites.hpp:73
xilinx::WireIndex WireIndex
Imported type name.
Definition: Sites.hpp:53

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t torc::architecture::Sites::readPrimitiveTypes ( DigestStream inStream)
protected

Read the primitive types for the family.

Todo:
Throw a proper exception.
Todo:
Throw a proper exception.
Todo:
Throw a proper exception.
Todo:
Throw a proper exception.
Todo:
Throw a proper exception.
Todo:
Throw a proper exception.
Todo:
Throw a proper exception

Definition at line 90 of file Sites.cpp.

90  {
91  // prepare to read from the stream
92  size_t bytesReadOffset = inStream.getBytesRead();
93  char scratch[1 << 10]; // scratch read buffer
94  uint16_t nameLength = 0; // length of site type name
95  SiteTypeCount siteTypeCount; // number of site types
96  uint32_t elementCount; // number of site elements
97  PinCount pinCount; // number of pins
98  PinFlags pinFlags; // pin attribute flags
99  uint32_t elementIndex; // connection element index
100  uint32_t pinIndex; // connection pin index
101 
102  // read the section header
103  string sectionName;
104  inStream.readSectionHeader(sectionName);
105  /// \todo Throw a proper exception.
106  if(sectionName != ">>>>PrimDefs>>>>") throw -1;
107 
108  // initialize the tile type array
109  inStream.read(siteTypeCount);
110  mSiteTypes.setSize(siteTypeCount);
111  mOut() << "\tReading " << siteTypeCount << " site types..." << std::endl;
112  // loop through each site type
113  for(SiteTypeIndex i; i < siteTypeCount; i++) {
114  // look up the current site definition
115  PrimitiveDef& primitiveDef = const_cast<PrimitiveDef&>(mSiteTypes[i]);
116  // read the site type name
117  inStream.read(nameLength);
118  /// \todo Throw a proper exception.
119  if(nameLength > sizeof(scratch)) throw -1;
120  inStream.read(scratch, nameLength);
121  scratch[nameLength] = 0;
122 //mOut() << "\t\t" << i << ": " << scratch << std::endl;
123 //mOut().flush();
124  // read the pin count
125  inStream.read(pinCount);
126  // update the site definition
127  primitiveDef.mName = scratch;
128  primitiveDef.mPins.setSize(pinCount);
129  // loop through each pin
130  for(PinCount j; j < pinCount; j++) {
131  // look up the current pin
132  PrimitivePin& primitivePin = const_cast<PrimitivePin&>(primitiveDef.mPins[j]);
133  // read the pin flags
134  inStream.read(pinFlags);
135  // read the pin name
136  inStream.read(nameLength);
137  /// \todo Throw a proper exception.
138  if(nameLength > sizeof(scratch)) throw -1;
139  inStream.read(scratch, nameLength);
140  scratch[nameLength] = 0;
141  // update the site pin
142  primitivePin.mFlags = pinFlags;
143  primitivePin.mName = scratch;
144  primitiveDef.mPinNameToPinIndex[scratch] = xilinx::PinIndex(j);
145  }
146  // read the number of site elements
147  inStream.read(elementCount);
148  // update the site definition
149  primitiveDef.mElements.setSize(elementCount);
150  // loop through each element
151  for(uint32_t j = 0; j < elementCount; j++) {
152  // look up the current element
153  PrimitiveElement& element
154  = const_cast<PrimitiveElement&>(primitiveDef.mElements[j]);
155  // read the element name
156  inStream.read(nameLength);
157  /// \todo Throw a proper exception.
158  if(nameLength > sizeof(scratch)) throw -1;
159  inStream.read(scratch, nameLength);
160  scratch[nameLength] = 0;
161  // update the element name
162  element.mName = scratch;
163 //mOut() << primitiveDef.getName() << " - " << element.getName() << ":" << std::endl;
164 //mOut() << " ";
165  // read the BEL flag
166  uint16_t isBel;
167  inStream.read(isBel);
168  // read the pin count
169  inStream.read(pinCount);
170  // update the element
171  element.mIsBel = isBel != 0;
172  element.mPins.setSize(pinCount);
173  // loop through each pin
174  for(PinCount k; k < pinCount; k++) {
175  // look up the current pin
176  PrimitiveElementPin& elementPin =
177  const_cast<PrimitiveElementPin&>(element.mPins[k]);
178  // read the pin flags
179  inStream.read(pinFlags);
180  // read the pin name
181  inStream.read(nameLength);
182  /// \todo Throw a proper exception.
183  if(nameLength > sizeof(scratch)) throw -1;
184  inStream.read(scratch, nameLength);
185  scratch[nameLength] = 0;
186  // update the site pin
187  elementPin.mElementPtr = &element;
188 //mOut() << elementPin.mElementPtr->getName() << "." << scratch << " ";
189 //if(elementPin.mElementPtr == 0) {
190 // mOut() << "Element pin " << scratch << " has NULL element" << std::endl;
191 // mOut().flush();
192 //}
193  elementPin.mFlags = pinFlags;
194  elementPin.mName = scratch;
195  element.mPinNameToPinIndex[scratch] = xilinx::PinIndex(k);
196  }
197 //mOut() << std::endl;
198  // read the config count
199  uint32_t cfgCount;
200  inStream.read(cfgCount);
201  // loop through each cfg value
202 //bool debug = cfgCount > 0;
203 //if(debug) mOut() << "\t\t\t" << j << " \"" << scratch << "\": ";
204  for(uint32_t k = 0; k < cfgCount; k++) {
205  // read the cfg value
206  inStream.read(nameLength);
207  /// \todo Throw a proper exception.
208  if(nameLength > sizeof(scratch)) throw -1;
209  inStream.read(scratch, nameLength);
210  scratch[nameLength] = 0;
211 //if(debug) mOut() << scratch << " ";
212  // update the cfg values
213  element.mCfgs.insert(scratch);
214  }
215 //if(debug) mOut() << std::endl;
216  }
217  // read the conn count
218  uint32_t connCount;
219  inStream.read(connCount);
220 //mOut() << primitiveDef.mName << ": " << connCount << std::endl;
221  // update the site definition
222  primitiveDef.mConnections.setSize(connCount);
223  // loop through each conn
224  const PrimitiveElementArray& elements = primitiveDef.getElements();
225  for(uint32_t j = 0; j < connCount; j++) {
226  // look up the current connection
227  PrimitiveConnSharedPtr& connectionPtr = primitiveDef.mConnections[j];
228  connectionPtr = boost::shared_ptr<PrimitiveConn>(new PrimitiveConn());
229  PrimitiveConn& connection = const_cast<PrimitiveConn&>(*connectionPtr);
230  // read the source count
231  uint16_t sourceCount;
232  inStream.read(sourceCount);
233  /// \todo Throw a proper exception
234  if(sourceCount != 1) throw -1;
235  // read the source element and pin
236  inStream.read(elementIndex);
237  inStream.read(pinIndex);
238  const PrimitiveElement* elementPtr = elements.begin() + elementIndex;
239  PrimitiveElement& element = const_cast<PrimitiveElement&>(*elementPtr);
240  const PrimitiveElementPinArray& pins = element.getPins();
241  PrimitiveElementPin& pin = const_cast<PrimitiveElementPin&>(pins[pinIndex]);
242  connection.mSourcePtr = &pin;
243  const_cast<PrimitiveConnSharedPtr&>(pin.mPrimitiveConn) = connectionPtr;
244  // read the sink count
245  uint16_t sinkCount;
246  inStream.read(sinkCount);
247  // loop through each sink
248  for(uint32_t k = 0; k < sinkCount; k++) {
249  // read the sink element and pin
250  inStream.read(elementIndex);
251  inStream.read(pinIndex);
252  elementPtr = elements.begin() + elementIndex;
253  PrimitiveElement& element = const_cast<PrimitiveElement&>(*elementPtr);
254  const PrimitiveElementPinArray& pins = element.getPins();
255  PrimitiveElementPin& pin = const_cast<PrimitiveElementPin&>(pins[pinIndex]);
256  connection.mSinks.push_back(&pin);
257  const_cast<PrimitiveConnSharedPtr&>(pin.mPrimitiveConn) = connectionPtr;
258  }
259  }
260 //mOut() << primitiveDef.getName() << " - " << element.getName() << ":" << std::endl;
261  }
262 
263  // return the number of bytes read
264  return inStream.getBytesRead() - bytesReadOffset;
265  }
xilinx::SiteTypeCount SiteTypeCount
Imported type name.
Definition: Sites.hpp:59
Array< const PrimitiveDef > mSiteTypes
The site types for this family.
Definition: Sites.hpp:71
xilinx::SiteTypeIndex SiteTypeIndex
Imported type name.
Definition: Sites.hpp:60
Array< const PrimitiveElementPin > PrimitiveElementPinArray
Array of constant PrimitiveElementPin objects.
xilinx::PinCount PinCount
Imported type name.
Definition: Sites.hpp:55
boost::shared_ptr< const PrimitiveConn > PrimitiveConnSharedPtr
ostream & mOut(void)
Returns the database console output stream.
Array< const PrimitiveElement > PrimitiveElementArray
Array of constant PrimitiveElement objects.
xilinx::PinFlags PinFlags
Imported type name.
Definition: Sites.hpp:54

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t torc::architecture::Sites::readSites ( DigestStream inStream)
protected

Read the sites for the device.

Todo:
Throw a proper exception.
Todo:
Throw a proper exception.

Definition at line 305 of file Sites.cpp.

305  {
306  // prepare to read from the stream
307  size_t bytesReadOffset = inStream.getBytesRead();
308  char scratch[1 << 10]; // scratch read buffer
309  uint16_t nameLength = 0; // length of tile type name
310  SiteCount siteCount; // number of sites
311  SiteTypeIndex siteTypeIndex; // site type index
312  TileIndex tileIndex; // site tile index
313  SiteFlags flags; // site flags
314  uint16_t pinMap = 0; // site pin map
315 
316  // read the section header
317  string sectionName;
318  inStream.readSectionHeader(sectionName);
319  /// \todo Throw a proper exception.
320  if(sectionName != ">>>> Sites >>>>") throw -1;
321 
322  // initialize the site array
323  inStream.read(siteCount);
324  mSites.setSize(siteCount);
325  mOut() << "\tReading " << siteCount << " sites..." << std::endl;
326  // loop through each site
327  for(SiteIndex i; i < siteCount; i++) {
328  // read the site name
329  inStream.read(nameLength);
330  /// \todo Throw a proper exception.
331  if(nameLength > sizeof(scratch)) throw -1;
332  inStream.read(scratch, nameLength);
333  scratch[nameLength] = 0;
334  // read the site type index, tile index, flags, and pin map
335  inStream.read(siteTypeIndex);
336  inStream.read(tileIndex);
337  inStream.read(flags);
338  inStream.read(pinMap);
339  // look up a reference for the site, and discard the const trait
340  Site& site = const_cast<Site&>(mSites[i]);
341  site = Site(scratch, mSiteTypes[siteTypeIndex], tileIndex, flags,
342  mPrimitivePinMaps[pinMap]);
343  mSiteNameToSiteIndex[scratch] = i;
344  }
345 
346  // return the number of bytes read
347  return inStream.getBytesRead() - bytesReadOffset;
348  }
SiteNameToSiteIndexMap mSiteNameToSiteIndex
The mapping from site name to site index for this device.
Definition: Sites.hpp:77
Array< const PrimitiveDef > mSiteTypes
The site types for this family.
Definition: Sites.hpp:71
xilinx::TileIndex TileIndex
Imported type name.
Definition: Sites.hpp:52
xilinx::SiteCount SiteCount
Imported type name.
Definition: Sites.hpp:56
xilinx::SiteTypeIndex SiteTypeIndex
Imported type name.
Definition: Sites.hpp:60
Array< const Site > mSites
The logic sites for this device.
Definition: Sites.hpp:75
xilinx::SiteFlags SiteFlags
Imported type name.
Definition: Sites.hpp:58
xilinx::SiteIndex SiteIndex
Imported type name.
Definition: Sites.hpp:57
ostream & mOut(void)
Returns the database console output stream.
Array2D< const WireIndex > mPrimitivePinMaps
The site pin maps for this family.
Definition: Sites.hpp:73

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::architecture::DDBConsoleStreams::setConsoleErr ( ostream inStream)
inlineinherited

Sets the database console error stream.

Definition at line 77 of file DDBConsoleStreams.hpp.

77 { mErrPtr = &inStream; }

+ Here is the caller graph for this function:

void torc::architecture::DDBConsoleStreams::setConsoleIn ( istream inStream)
inlineinherited

Sets the database console input stream.

Definition at line 73 of file DDBConsoleStreams.hpp.

73 { mInPtr = &inStream; }
istream * mInPtr
Pointer to the database console input stream.

+ Here is the caller graph for this function:

void torc::architecture::DDBConsoleStreams::setConsoleLog ( ostream inStream)
inlineinherited

Sets the database console log stream.

Definition at line 79 of file DDBConsoleStreams.hpp.

79 { mLogPtr = &inStream; }

+ Here is the caller graph for this function:

void torc::architecture::DDBConsoleStreams::setConsoleOut ( ostream inStream)
inlineinherited

Sets the database console output stream.

Definition at line 75 of file DDBConsoleStreams.hpp.

75 { mOutPtr = &inStream; }

+ Here is the caller graph for this function:

virtual void torc::architecture::DDBConsoleStreams::setConsoleStreams ( istream inIn,
ostream inOut,
ostream inErr,
ostream inLog 
)
inlinevirtualinherited

Sets all of the database console streams.

Parameters
inInThe console input stream.
inOutThe console output stream.
inErrThe console error stream.
inLogThe console log stream.

Reimplemented in torc::architecture::DDB.

Definition at line 85 of file DDBConsoleStreams.hpp.

86  {
87  setConsoleIn(inIn);
88  setConsoleOut(inOut);
89  setConsoleErr(inErr);
90  setConsoleLog(inLog);
91  }
void setConsoleOut(ostream &inStream)
Sets the database console output stream.
void setConsoleIn(istream &inStream)
Sets the database console input stream.
void setConsoleLog(ostream &inStream)
Sets the database console log stream.
void setConsoleErr(ostream &inStream)
Sets the database console error stream.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend class DDB
friend

The database has access to our protected functions.

Definition at line 48 of file Sites.hpp.

Field Documentation

ostream* torc::architecture::DDBConsoleStreams::mErrPtr
protectedinherited

Definition at line 96 of file DDBConsoleStreams.hpp.

istream* torc::architecture::DDBConsoleStreams::mInPtr
protectedinherited

Pointer to the database console input stream.

Definition at line 94 of file DDBConsoleStreams.hpp.

ostream* torc::architecture::DDBConsoleStreams::mLogPtr
protectedinherited

Definition at line 97 of file DDBConsoleStreams.hpp.

ostream* torc::architecture::DDBConsoleStreams::mOutPtr
protectedinherited

Definition at line 95 of file DDBConsoleStreams.hpp.

PackageNameToPackageIndexMap torc::architecture::Sites::mPackageNameToPackageIndex
protected

The mapping from package name to package index for this device.

Definition at line 81 of file Sites.hpp.

Array<const Package> torc::architecture::Sites::mPackages
protected

The packages for this device.

Definition at line 79 of file Sites.hpp.

Array2D<const WireIndex> torc::architecture::Sites::mPrimitivePinMaps
protected

The site pin maps for this family.

Definition at line 73 of file Sites.hpp.

SiteNameToSiteIndexMap torc::architecture::Sites::mSiteNameToSiteIndex
protected

The mapping from site name to site index for this device.

Definition at line 77 of file Sites.hpp.

Array<const Site> torc::architecture::Sites::mSites
protected

The logic sites for this device.

Definition at line 75 of file Sites.hpp.

Array<const PrimitiveDef> torc::architecture::Sites::mSiteTypes
protected

The site types for this family.

Definition at line 71 of file Sites.hpp.

DDBConsoleStreams torc::architecture::DDBConsoleStreams::sDefaultConsoleStreams
staticinherited

Definition at line 45 of file DDBConsoleStreams.hpp.

DDBConsoleStreams torc::architecture::DDBConsoleStreams::sNullConsoleStreams
staticinherited

Definition at line 46 of file DDBConsoleStreams.hpp.


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