torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Virtex2.cpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 /// \file
17 /// \brief Source for the Virtex2 class.
18 
20 #include <iostream>
21 
22 /// \todo Warning: this will need to be moved elsewhere.
26 #include <fstream>
27 
28 
29 namespace torc {
30 namespace bitstream {
31 
32  const char* Virtex2::sPacketTypeName[ePacketTypeCount] = {
33  "[UNKNOWN TYPE 0]", "TYPE1", "TYPE2", "[UNKNOWN TYPE 3]", "[UNKNOWN TYPE 4]",
34  "[UNKNOWN TYPE 5]", "[UNKNOWN TYPE 6]", "[UNKNOWN TYPE 7]"
35  };
36 
37  const char* Virtex2::sOpcodeName[eOpcodeCount] = {
38  "NOP", "READ", "WRITE", "RESERVED"
39  };
40 
41  const char* Virtex2::sRegisterName[eRegisterCount] = {
42  "CRC", "FAR", "FDRI", "FDRO", "CMD", "CTL", "MASK", "STAT", "LOUT", "COR", "MFWR", "FLR", "KEY",
43  "CBC", "IDCODE"
44  };
45 
46  const char* Virtex2::sCommandName[eCommandCount] = {
47  "[UNKNOWN COMMAND 0]", "WCFG", "MFWR", "LFRM", "RCFG", "START", "RCAP", "RCRC", "AGHIGH", "SWITCH",
48  "GRESTORE", "SHUTDOWN", "GCAPTURE", "DESYNCH"
49  };
50 
51 #define VALUES (const char*[])
52 
53  /// \see Configuration Options Register Description: UG002, v2.2, November, 2007, Table 4-26.
54  const Bitstream::Subfield Virtex2::sCOR[] = {
55  {0x00000007, 0, "GWE_cycle", "GWE_CYCLE", 5,
56  // bitgen: 6, 1, 2, 3, 4, 5, Done, Keep
57  // config: 001:"2", 010:"3", 011:"4", 100:"5", 101:"6"
58  VALUES{"[UNDEFINED 0]", "2", "3", "4", "5", "6", "[UNDEFINED 6]", "[UNDEFINED 7]", 0}},
59  {0x00000038, 3, "GTS_cycle", "GTS_CYCLE", 4,
60  // bitgen: 5, 1, 2, 3, 4, 6, Done, Keep
61  // config: 001:"2", 010:"3", 011:"4", 100:"5", 101:"6"
62  VALUES{"[UNDEFINED 0]", "2", "3", "4", "5", "6", "[UNDEFINED 6]", "[UNDEFINED 7]", 0}},
63  {0x000001c0, 6, "LCK_cycle", "LOCK_CYCLE", 7,
64  // bitgen: NoWait, 0, 1, 2, 3, 4, 5, 6
65  // config: 000:"1", 001:"2", 010:"3", 011:"4", 100:"5", 101:"6", 111:"NO_WAIT"
66  VALUES{"1", "2", "3", "4", "5", "6", "[UNDEFINED 6]", "NoWait", 0}},
67  {0x00000E00, 9, "Match_cycle", "MATCH_CYCLE", 7,
68  // bitgen: Auto, NoWait, 0, 1, 2, 3, 4, 5, 6
69  // config: 000:"1", 001:"2", 010:"3", 011:"4", 100:"5", 101:"6", 111:"NO_WAIT"
70  VALUES{"1", "2", "3", "4", "5", "6", "[UNDEFINED 6]", "NoWait", 0}},
71  {0x00007000, 12, "DONE_cycle", "DONE_CYCLE", 3,
72  // bitgen: 4, 1, 2, 3, 5, 6
73  // config: 001:"2", 010:"3", 011:"4", 100:"5", 101:"6"
74  VALUES{"[UNDEFINED 0]", "2", "3", "4", "5", "6", "[UNDEFINED 6]", "[UNDEFINED 7]", 0}},
75  {0x00018000, 15, "StartupClk", "SSCLKSRC", 0,
76  // bitgen: Cclk, UserClk, JtagClk
77  // config: 00:"CCLK", 01:"UserClk", 1x:"JTAGClk"
78  VALUES{"Cclk", "UserClk", "JtagClk", "JtagClk", 0}},
79  {0x007e0000, 17, "ConfigRate", "OSCFSEL", 0,
80  // bitgen: 4, 5, 7, 8, 9, 10, 13, 15, 20, 26, 30, 34, 41, 45, 51, 55, 60
81  // config: values undefined
82  VALUES{
83  "[UNKNOWN 0]", "[UNKNOWN 1]", "[UNKNOWN 2]", "[UNKNOWN 3]",
84  "[UNKNOWN 4]", "[UNKNOWN 5]", "[UNKNOWN 6]", "[UNKNOWN 7]",
85  "[UNKNOWN 8]", "[UNKNOWN 9]", "[UNKNOWN 10]", "[UNKNOWN 11]",
86  "[UNKNOWN 12]", "[UNKNOWN 13]", "[UNKNOWN 14]", "[UNKNOWN 15]",
87  "[UNKNOWN 16]", "[UNKNOWN 17]", "[UNKNOWN 18]", "[UNKNOWN 19]",
88  "[UNKNOWN 20]", "[UNKNOWN 21]", "[UNKNOWN 22]", "[UNKNOWN 23]",
89  "[UNKNOWN 24]", "[UNKNOWN 25]", "[UNKNOWN 26]", "[UNKNOWN 27]",
90  "[UNKNOWN 28]", "[UNKNOWN 29]", "[UNKNOWN 30]", "[UNKNOWN 31]",
91  0}},
92  {0x00800000, 23, "Capture", "SINGLE", 0,
93  // bitgen: n/a -- this comes from the CAPTURE site ONESHOT setting
94  // config: 0:"Readback is not single-shot", 1:"Readback is single-shot"
95  VALUES{"Continuous", "OneShot", 0}},
96  {0x01000000, 24, "DriveDone", "DRIVE_DONE", 0,
97  // bitgen: No, Yes
98  // config: 0:"DONE pin is open drain", 1:"DONE is actively driven high"
99  VALUES{"No", "Yes", 0}},
100  {0x02000000, 25, "DonePipe", "DONE_PIPE", 0,
101  // bitgen: No, Yes
102  // config: 0:"No pipeline stage for DONEIN", 1:"Add pipeline stage for DONEIN"
103  VALUES{"No", "Yes", 0}},
104  {0x04000000, 26, "DCMShutDown", "SHUT_RST_DCM", 0,
105  // bitgen: No, Yes
106  // config: 0:"DCMs cannot be reset through configuration", 1:"DCMs will reset during shutdown
107  // readback or reconfiguration
108  VALUES{"No", "Yes", 0}},
109  {0x20000000, 29, "CRC", "CRC_BYPASS", 0,
110  // bitgen: Enable, Disable
111  // config: 0:"CRC enabled", 1:"CRC disabled"
112  VALUES{"Enable", "Disable", 0}},
113  {0, 0, 0, 0, 0, 0}
114  };
115 
116  /// \see Status Register Description: UG002, v2.2, November, 2007, Table 4-25.
117  /// \note The "bitgen" names attempt to mimic the general bitgen convention.
118  const Bitstream::Subfield Virtex2::sSTAT[] = {
119  {0x00000001, 0, "CRC_error", "CRC_ERROR", 0,
120  // bitgen: n/a
121  // config: 0:"No CRC error", 1:"CRC error"
122  VALUES{"No", "Yes", 0}},
123  {0x00000002, 1, "DecryptorSecuritySet", "PART_SECURED", 0,
124  // bitgen: n/a
125  // config: 0:"Decryptor security not set", 1:"Decryptor security set"
126  VALUES{"No", "Yes", 0}},
127  {0x00000004, 2, "DCM_locked", "DCM_LOCK", 0,
128  // bitgen: n/a
129  // config: 0:"DCMs not locked", 1:"DCMs are locked"
130  VALUES{"No", "Yes", 0}},
131  {0x00000008, 3, "DCI_matched", "DCI_MATCH", 0,
132  // bitgen: n/a
133  // config: 0:"DCI not matched", 1:"DCI matched
134  VALUES{"No", "Yes", 0}},
135  {0x00000010, 4, "IN_error", "IN_ERROR", 0,
136  // bitgen: n/a
137  // config: 0:"No legacy input error", 1:"Legacy input error"
138  VALUES{"No", "Yes", 0}},
139  {0x00000020, 5, "GTS_CFG_B", "GTS_CFG_B", 0,
140  // bitgen: n/a
141  // config: 0:"All I/Os are placed in high-Z state", 1:"All I/Os behave as configured"
142  VALUES{"IoDisabled", "IoEnabled", 0}},
143  {0x00000040, 6, "GWE", "GWE", 0,
144  // bitgen: n/a
145  // config: 0:"FFs and block RAM are write disabled", 1:"FFs and block RAM are write
146  // enabled"
147  VALUES{"WriteDisabled", "WriteEnabled", 0}},
148  {0x00000080, 7, "GHIGH_B", "GHIGH_B", 0,
149  // bitgen: n/a
150  // config: 0:"GHIGH_B asserted", 1:"GHIGH_B deasserted"
151  VALUES{"InterconnectDisabled", "InterconnectEnabled", 0}},
152  {0x00000700, 8, "Mode", "MODE", 0,
153  // bitgen: n/a
154  // config: Status of the MODE pins (M2:M0)
155  VALUES{"MasterSerial", "SlaveSelectMap32", "[UNDEFINED 2]", "MasterSelectMap",
156  "[UNDEFINED 3]", "JTAG", "SlaveSelectMap8", "[UNDEFINED 6]", "SlaveSerial", 0}},
157  {0x00000800, 11, "INIT", "INIT", 0,
158  // bitgen: n/a
159  // config: Value on INIT pin
160  VALUES{"Deasserted", "Asserted", 0}},
161  {0x00001000, 12, "Done", "DONE", 0,
162  // bitgen: n/a
163  // config: Value on DONE pin
164  VALUES{"Deasserted", "Asserted", 0}},
165  {0x00002000, 13, "ID_error", "ID_ERROR", 0,
166  // bitgen: n/a
167  // config: 0:"No ID Error", 1:"ID Error"
168  VALUES{"No", "Yes", 0}},
169  {0x00004000, 14, "Decrypt_error", "DEC_ERROR", 0,
170  // bitgen: n/a
171  // config: 0:"No DEC_ERROR", 1:"DEC_ERROR"
172  VALUES{"NoError", "Error", 0}},
173  {0x00008000, 15, "BAD_KEY_SEQ", "BAD_KEY_SEQ", 0,
174  // bitgen: n/a
175  // config: 0:"No decryptor key sequence error", 1:"Decryptor keys were not used in the correct
176  // sequence"
177  VALUES{"NoError", "Error", 0}},
178  {0, 0, 0, 0, 0, 0}
179  };
180 
181  /// \see Control Register Description: UG002, v2.2, November, 2007, Table 4-24.
182  const Bitstream::Subfield Virtex2::sCTL[] = {
183  {0x00000001, 0, "GTS_USER_B", "GTS_USER_B", 0,
184  // bitgen: n/a?
185  // config: 0:"I/Os placed in high-Z state", 1:"I/Os active"
186  VALUES{"IoDisabled", "IoActive", 0}},
187  {0x00000008, 3, "Persist", "PERSIST", 0,
188  // bitgen: No, Yes
189  // config: 0:"No (default)", 1:"Yes"
190  VALUES{"No", "Yes", 0}},
191  {0x00000030, 4, "Security", "SBITS", 0,
192  // bitgen: None, Level1, Level2
193  // config: 00:"Read/Write OK (default)", 01:"Readback disabled", 1x:"Readback disabled,
194  // writing disabled except CRC register."
195  VALUES{"None", "Level1", "Level2", "Level2", 0}},
196  {0, 0, 0, 0, 0, 0}
197  };
198 
199  /// \see Control Mask Register Description: Inferred from Table 7-7.
200  const Bitstream::Subfield Virtex2::sMASK[] = {
201  {0x00000001, 0, "GTS_USER_B", "GTS_USER_B", 0, VALUES{"Protected", "Writable", 0}},
202  {0x00000008, 3, "Persist", "PERSIST", 0, VALUES{"Protected", "Writable", 0}},
203  {0x00000080, 4, "Security", "SBITS", 0,
204  VALUES{"Protected", "[UNKNOWN 1]", "[UNKNOWN 2]", "Writable", 0}},
205  {0, 0, 0, 0, 0, 0}
206  };
207 
208  /// \brief Return the masked value for a subfield of the specified register.
209  uint32_t Virtex2::makeSubfield(ERegister inRegister, const std::string& inSubfield,
210  const std::string& inSetting) {
211  const Subfield* subfields;
212  switch(inRegister) {
213  case eRegisterCOR: subfields = sCOR; break;
214  case eRegisterSTAT: subfields = sSTAT; break;
215  case eRegisterCTL: subfields = sCTL; break;
216  case eRegisterMASK: subfields = sMASK; break;
217  default: return 0;
218  }
219  for(uint32_t field = 0; subfields[field].mMask != 0; field++) {
220  const Subfield& subfield = subfields[field];
221  if(inSubfield != subfield.mBitgenName && inSubfield != subfield.mConfigGuideName)
222  continue;
223  const char** ptr = subfield.mValues;
224  for(uint32_t i = 0; *ptr != 0; i++, ptr++) {
225  if(inSetting == *ptr) return (i << subfield.mShift) & subfield.mMask;
226  }
227  }
228  return 0;
229  }
230 
231  void Virtex2::readPackets(std::istream& inStream) {
232  uint32_t bitstreamWordLength = mBitstreamByteLength >> 2;
233  uint32_t cumulativeWordLength = 0;
234  while(cumulativeWordLength < bitstreamWordLength) {
235  push_back(VirtexPacket::read(inStream));
236  uint32_t wordSize = back().getWordSize();
237  cumulativeWordLength += wordSize;
238  // infer Auto CRCs for writes equal to or longer than one frame (not rigorously correct)
239  if(wordSize <= getFrameLength()) continue;
240  uint32_t autoCrc = 0;
241  inStream.read((char*) &autoCrc, sizeof(autoCrc));
242  autoCrc = ntohl(autoCrc);
243  push_back(VirtexPacket(autoCrc));
244  cumulativeWordLength++;
245  }
246  }
247 
248 //#define GENERATE_STATIC_DEVICE_INFO
249 #ifndef GENERATE_STATIC_DEVICE_INFO
250 
251  extern DeviceInfo xc2v40;
252  extern DeviceInfo xc2v80;
253  extern DeviceInfo xc2v250;
254  extern DeviceInfo xc2v500;
255  extern DeviceInfo xc2v1000;
256  extern DeviceInfo xc2v1500;
257  extern DeviceInfo xc2v2000;
258  extern DeviceInfo xc2v3000;
259  extern DeviceInfo xc2v4000;
260  extern DeviceInfo xc2v6000;
261  extern DeviceInfo xc2v8000;
262 
263  void Virtex2::initializeDeviceInfo(const std::string& inDeviceName) {
264  using namespace torc::common;
265  switch(mDevice) {
266  case eXC2V40: setDeviceInfo(xc2v40); break;
267  case eXC2V80: setDeviceInfo(xc2v80); break;
268  case eXC2V250: setDeviceInfo(xc2v250); break;
269  case eXC2V500: setDeviceInfo(xc2v500); break;
270  case eXC2V1000: setDeviceInfo(xc2v1000); break;
271  case eXC2V1500: setDeviceInfo(xc2v1500); break;
272  case eXC2V2000: setDeviceInfo(xc2v2000); break;
273  case eXC2V3000: setDeviceInfo(xc2v3000); break;
274  case eXC2V4000: setDeviceInfo(xc2v4000); break;
275  case eXC2V6000: setDeviceInfo(xc2v6000); break;
276  case eXC2V8000: setDeviceInfo(xc2v8000); break;
277  default: break;
278  }
279  // update the bitstream row counts as appropriate for the device
280  //setRowCounts(inDeviceName);
281  }
282 
283 #else
284 
285  void Virtex2::initializeDeviceInfo(const std::string& inDeviceName) {
286 
292 
293  // look up the device tile map
294  torc::architecture::DDB ddb(inDeviceName);
295  const torc::architecture::Tiles& tiles = ddb.getTiles();
296  uint32_t tileCount = tiles.getTileCount();
297  uint16_t rowCount = tiles.getRowCount();
298  uint16_t colCount = tiles.getColCount();
299  ColumnTypeVector columnTypes;
300 
301  // set up the tile index and name mappings, and the index to column def mapping
302  typedef std::map<TileTypeIndex, std::string> TileTypeIndexToName;
303  typedef std::map<std::string, TileTypeIndex> TileTypeNameToIndex;
304  TileTypeIndexToName tileTypeIndexToName;
305  TileTypeNameToIndex tileTypeNameToIndex;
306  TileTypeCount tileTypeCount = tiles.getTileTypeCount();
307  for(TileTypeIndex tileTypeIndex(0); tileTypeIndex < tileTypeCount; tileTypeIndex++) {
308  const std::string tileTypeName = tiles.getTileTypeName(tileTypeIndex);
309  tileTypeIndexToName[tileTypeIndex] = tileTypeName;
310  tileTypeNameToIndex[tileTypeName] = tileTypeIndex;
311  TileTypeNameToColumnType::iterator ttwp = mTileTypeNameToColumnType.find(tileTypeName);
312  TileTypeNameToColumnType::iterator ttwe = mTileTypeNameToColumnType.end();
313  if(ttwp != ttwe) mTileTypeIndexToColumnType[tileTypeIndex] = EColumnType(ttwp->second);
314  }
315 
316  // identify every column that contains known frames
317  columnTypes.resize(colCount);
318  uint32_t frameCount = 0;
319  for(uint32_t blockType = 0; blockType < Virtex2::eFarBlockTypeCount; blockType++) {
320  for(TileCol col; col < colCount; col++) {
321  columnTypes[col] = eColumnTypeEmpty;
322  TileTypeIndexToColumnType::iterator ttwe = mTileTypeIndexToColumnType.end();
323  TileTypeIndexToColumnType::iterator ttwp = ttwe;
324  for(TileRow row; row < rowCount; row++) {
325  // look up the tile info
326  const torc::architecture::TileInfo& tileInfo
327  = tiles.getTileInfo(tiles.getTileIndex(row, col));
328  TileTypeIndex tileTypeIndex = tileInfo.getTypeIndex();
329  // determine whether the tile type widths are defined
330  ttwp = mTileTypeIndexToColumnType.find(tileTypeIndex);
331  if(ttwp != ttwe) {
332  uint32_t width = mColumnDefs[ttwp->second][blockType];
333  frameCount += width;
334  //std::cout << " " << tiles.getTileTypeName(tileInfo.getTypeIndex())
335  // << ": " << width << " (" << frameCount << ")" << std::endl;
336  columnTypes[col] = static_cast<EColumnType>(ttwp->second);
337  break;
338  }
339  }
340  }
341  //std::cout << std::endl;
342  if(blockType == 2) break;
343  }
344 
346  boost::filesystem::path generatedMap = workingPath / (inDeviceName + ".map.csv");
347  std::fstream tilemapStream(generatedMap.string().c_str(), std::ios::out);
348  for(TileRow row; row < rowCount; row++) {
349  for(TileCol col; col < colCount; col++) {
350  const torc::architecture::TileInfo& tileInfo
351  = tiles.getTileInfo(tiles.getTileIndex(row, col));
352  TileTypeIndex tileTypeIndex = tileInfo.getTypeIndex();
353  tilemapStream << tiles.getTileTypeName(tileTypeIndex);
354  if(col + 1 < colCount) tilemapStream << ",";
355  }
356  tilemapStream << std::endl;
357  }
358  tilemapStream.close();
359 
360  // update bitstream device information
361  setDeviceInfo(DeviceInfo(tileCount, rowCount, colCount, columnTypes));
362  //setRowCounts(inDeviceName);
363  }
364 #endif
365 
367 
368  bool debug = 0;
369  uint32_t frameCount = 0;
370  uint32_t frameIndex = 0;
371  bool clockColumn = true;
372  uint32_t width;
373  for(uint32_t i = 0; i < Virtex2::eFarBlockTypeCount; i++) {
375  uint32_t blockFrameIndexBounds = 0;
376  //Set first frame index to 0
377  uint32_t bitIndex = 0;
378  uint32_t xdlIndex = 0;
379  mBitColumnIndexes[i].push_back(bitIndex);
380  mXdlColumnIndexes[i].push_back(xdlIndex);
381  // build the columns
382  uint32_t farMajor = 0;
384  uint16_t finalColumn = mDeviceInfo.getColCount()-1;
385  uint32_t xdlColumnCount = 0;
386  uint32_t bitColumnCount = 0;
387  if(clockColumn) {
388  width = mColumnDefs[eColumnTypeClock][i];
389  clockColumn = false;
390  for(uint32_t farMinor = 0; farMinor < width; farMinor++) {
391  Virtex2::FrameAddress far(blockType, farMajor, farMinor);
392  mFrameIndexToAddress[frameIndex] = far;
393  mFrameAddressToIndex[far] = frameIndex;
394  frameIndex++;
395  blockFrameIndexBounds++;
396  }
397  if(width > 0) farMajor++;
398  frameCount += width;
399  }
400  for(ColumnIndex col; col < mDeviceInfo.getColCount(); col++) {
402  continue;
403  else
404  width = mColumnDefs[mDeviceInfo.getColumnTypes()[col]][i];
405  for(uint32_t farMinor = 0; farMinor < width; farMinor++) {
406  Virtex2::FrameAddress far(blockType, farMajor, farMinor);
407  mFrameIndexToAddress[frameIndex] = far;
408  mFrameAddressToIndex[far] = frameIndex;
409  frameIndex++;
410  blockFrameIndexBounds++;
411  }
412  if(width > 0) farMajor++;
413  frameCount += width;
414 
415  //Indexes for Bitstream Columns, only stores non-empty tile types
417  mXdlColumnToBitColumn[xdlColumnCount] = bitColumnCount;
418  bitColumnCount++;
419  bitIndex += width;
420  mBitColumnIndexes[i].push_back(bitIndex);
421  if(col == finalColumn) {
422  bitIndex += mColumnDefs[mDeviceInfo.getColumnTypes()[col]][i];
423  mBitColumnIndexes[i].push_back(bitIndex);
424  }
425  }
426  //Indexes for XDL Columns, stores interconnect and tile indexes for
427  //non-empty tiles
428  xdlIndex += width;
429  mXdlColumnIndexes[i].push_back(xdlIndex);
430  xdlColumnCount++;
431  if(col == finalColumn)
432  {
433  xdlIndex += mColumnDefs[mDeviceInfo.getColumnTypes()[col]][i];
434  mXdlColumnIndexes[i].push_back(xdlIndex);
435  }
436  }
437  //stores frame index bounds for each block type
438  mBlockFrameIndexBounds[i] = blockFrameIndexBounds;
439  if(debug) std::cout << "***Block frame index bounds: " << mBlockFrameIndexBounds[i] << std::endl;
440  }
441  //Test to check proper indexing
442  if(debug) {
443  for(uint32_t i = 0; i < Virtex2::eFarBlockTypeCount; i++) {
444  for(uint32_t j = 0; j < mBitColumnIndexes[i].size(); j++)
445  std::cout << "Bit Value at index: (" << i << ", " << j << ") : " << mBitColumnIndexes[i][j] << std::endl;
446  for(uint32_t k = 0; k < mXdlColumnIndexes[i].size(); k++)
447  std::cout << "Xdl Value at index: (" << i << ", " << k << ") : " << mXdlColumnIndexes[i][k] << std::endl;
448  }
449  }
450  }
451 
452 
454  boost::shared_array<uint32_t> frameWords;
455  // walk the bitstream and extract all frames
456  Virtex2::iterator p = begin();
457  Virtex2::iterator e = end();
458  while(p < e) {
459  const VirtexPacket& packet = *p++;
460  if(packet.isType2() && packet.isWrite())
461  frameWords = packet.getWords();
462  }
463  uint32_t index = 0;
464  for(uint32_t i = 0; i < Bitstream::eBlockTypeCount; i++) {
465  // all frames of block type are extracted
466  for(uint32_t j = 0; j < mBlockFrameIndexBounds[i]; j++) {
468  (new VirtexFrame(getFrameLength(), &frameWords[index])));
469  index += getFrameLength();
470  }
471  }
472  }
473 
474 
476 
477  // index and extract frames
478  int32_t bitColumnIndex[inBlockCount];
479  int32_t bitColumnBound[inBlockCount];
480 
481  for(uint32_t i = 0; i < inBlockCount; i++) {
482  // column Index of given frame index
483  bitColumnIndex[i] = mBitColumnIndexes[i][inBitCol];
484  // frame bounds for given column type
485  bitColumnBound[i] = mColumnDefs[mDeviceInfo.getColumnTypes()[inBitCol]][i];
486  }
487  // extract the tile frames for the specified FAR
488  VirtexFrameBlocks frameBlocks;
489  for(uint32_t i = 0; i < inBlockCount; i++) {
490  int startIndex = bitColumnIndex[i];
491  for(int j = 0; j < bitColumnBound[i]; j++)
492  frameBlocks.mBlock[i].push_back(mFrameBlocks.mBlock[i][startIndex+j]);
493  }
494  return frameBlocks;
495  }
496 
498 
499  // index and extract frames
500  int32_t xdlColumnIndex[inBlockCount];
501  int32_t xdlColumnBound[inBlockCount];
502  for(uint32_t i = 0; i < inBlockCount; i++) {
503  // column Index of given frame index
504  xdlColumnIndex[i] = mXdlColumnIndexes[i][inXdlCol];
505  // frame bounds for given column type
506  xdlColumnBound[i] =
508  }
509  // extract the tile frames for the specified FAR
510  VirtexFrameBlocks frameBlocks;
511  for(uint32_t i = 0; i < inBlockCount; i++) {
512  int startIndex = xdlColumnIndex[i];
513  for(int j = 0; j < xdlColumnBound[i]; j++)
514  frameBlocks.mBlock[i].push_back(mFrameBlocks.mBlock[i][startIndex+j]);
515  }
516  return frameBlocks;
517  }
518 
519 } // namespace bitstream
520 } // namespace torc
ColumnDefVector mColumnDefs
Column type widths.
VirtexFrameBlocks getBitstreamFrames(uint32_t inBlockCount, uint32_t inBitCol)
Returns frames for queried bitstream coordinates.
Definition: Virtex2.cpp:475
DeviceInfo xc2v3000
Encapsulation of a tile row in an unsigned 16-bit integer.
static const char * sOpcodeName[eOpcodeCount]
Packet opcode names.
Definition: Virtex2.hpp:88
TileTypeNameToColumnType mTileTypeNameToColumnType
#define VALUES
Definition: Virtex2.cpp:51
Encapsulation of a tile column in an unsigned 16-bit integer.
Device database, including complete wiring and logic support.
Definition: DDB.hpp:42
TileTypeCount getTileTypeCount(void) const
Returns the tile type count for this device.
Definition: Tiles.hpp:151
TileRow getRowCount(void) const
Returns the row count for this device.
Definition: Tiles.hpp:153
Header for the DirectoryTree class.
virtual void initializeFrameMaps(void)
Initialize the maps between frame indexes and frame addresses. This is generally only useful for int...
Definition: Virtex2.cpp:366
VirtexFrameBlocks mFrameBlocks
Input Frame blocks.
DeviceInfo xc2v80
Frame< uint32_t > VirtexFrame
Virtex frame type.
Definition: Frame.hpp:104
const TileInfo & getTileInfo(TileIndex inTileIndex) const
Returns the TileInfo object for the specified tile.
Definition: Tiles.hpp:137
DeviceInfo xc2v500
VirtexFrameBlocks getXdlFrames(uint32_t inBlockCount, uint32_t inXdlCol)
Returns frames for queried xdl coordinates.
Definition: Virtex2.cpp:497
TileTypeIndexToColumnType mTileTypeIndexToColumnType
Static device information class for Xilinx bitstreams. This class facilitates the creation of frame ...
Definition: DeviceInfo.hpp:75
uint16_t getColCount(void) const
Returns the column count.
Definition: DeviceInfo.hpp:114
DeviceInfo xc2v250
TileCount getTileCount(void) const
Returns the tile count for this device.
Definition: Tiles.hpp:149
EDevice mDevice
Bitstream device enumeration.
std::string string
ERegister
Configuration register enumeration.
Definition: Virtex2.hpp:55
uint32_t mShift
The subfield LSB position.
const char * mConfigGuideName
The subfield name documented in the configuration guide.
boost::uint32_t uint32_t
Imported type name.
static const Subfield sSTAT[]
Status Register (STAT) subfields.
Definition: Virtex2.hpp:96
DeviceInfo xc2v2000
virtual void readPackets(std::istream &inStream)
Definition: Virtex2.cpp:231
uint32_t mMask
The subfield bit mask.
virtual uint32_t getFrameLength(void) const
Definition: Virtex2.hpp:187
DeviceInfo mDeviceInfo
Device information.
Tile map, tile type, and wire information for the family and device.
Definition: Tiles.hpp:36
IndexVector mBitColumnIndexes[Virtex2::eFarBlockTypeCount]
Vector to store frame indexes of XDL columns.
Definition: Virtex2.hpp:222
FrameSet< FRAME_TYPE > mBlock[Bitstream::eBlockTypeCount]
FrameSets for each of the eight block types.
Definition: FrameSet.hpp:88
DeviceInfo xc2v1000
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 ColumnTypeVector & getColumnTypes(void) const
Returns the column type vector.
Definition: DeviceInfo.hpp:116
void initializeFullFrameBlocks(void)
Loads full bitstream frames into block data structure.
Definition: Virtex2.cpp:453
boost::filesystem::path path
const TileTypeIndex & getTypeIndex(void) const
Returns the tile type index for this tile.
Definition: TileInfo.hpp:92
uint32_t mBitstreamByteLength
Bitstream packet length in bytes.
boost::shared_ptr< VirtexFrame > FrameSharedPtr
Shared pointer encapsulation of a Frame.
Definition: FrameSet.hpp:44
DeviceInfo xc2v1500
const char * mBitgenName
The subfield name documented in bitgen.
uint32_t mBlockFrameIndexBounds[Virtex2::eFarBlockTypeCount]
Array to hold frame index boundaries for blocks.
Definition: Virtex2.hpp:226
static const boost::filesystem::path & getWorkingPath(void)
Returns the absolute path to the working directory.
Encapsulation of a tile type count in an unsigned 16-bit integer.
const WordSharedArray getWords(void) const
brief Returns the raw packet words, including the header word.
DeviceInfo xc2v6000
TileCol getColCount(void) const
Returns the column count for this device.
Definition: Tiles.hpp:155
static const char * sCommandName[eCommandCount]
Configuration command names.
Definition: Virtex2.hpp:92
Encapsulation of a tile type index in an unsigned 16-bit integer.
EFarBlockType
Frame Address Register block type constants.
Definition: Virtex2.hpp:74
static VirtexPacket read(std::istream &inStream)
Read a packet.
boost::uint16_t uint16_t
Imported type name.
boost::uint32_t uint32_t
Imported type name.
Definition: Virtex2.hpp:49
DeviceInfo xc2v4000
Header for the DDB class.
Header for the Virtex2 class.
EColumnType
Major column types.
Definition: Virtex2.hpp:79
Template base for encapsulated integers, to enforce strong typing.
DeviceInfo xc2v40
std::map< uint32_t, uint32_t > mXdlColumnToBitColumn
Map of XDL column indexes to bitstream column indexes.
Definition: Virtex2.hpp:228
static const char * sPacketTypeName[ePacketTypeCount]
Packet type names.
Definition: Virtex2.hpp:86
static uint32_t makeSubfield(ERegister inRegister, const std::string &inSubfield, const std::string &inSetting)
Return the masked value for a subfield of the specified register.
Definition: Virtex2.cpp:209
void setDeviceInfo(const DeviceInfo &rhs)
Assign static device information for the current bitstream.
Bitstream packet for Virtex class architectures.
const char ** mValues
The allowable subfield values.
DeviceInfo xc2v8000
static const char * sRegisterName[eRegisterCount]
Configuration register names.
Definition: Virtex2.hpp:90
IndexVector mXdlColumnIndexes[Virtex2::eFarBlockTypeCount]
Vector to store frame indexes of Bitstream columns.
Definition: Virtex2.hpp:224
FrameIndexToAddress mFrameIndexToAddress
Map of frame indexes to frame addresses.
Definition: Virtex2.hpp:218
static const Subfield sCTL[]
Control Register (CTL) subfields.
Definition: Virtex2.hpp:98
TileIndex getTileIndex(TileRow inRow, TileCol inCol) const
Returns the tile index for the given [row,column] pair.
Definition: Tiles.hpp:161
static const Subfield sCOR[]
Configuration Options Register (COR) subfields.
Definition: Virtex2.hpp:94
static const Subfield sMASK[]
Control Mask Register (MASK) subfields.
Definition: Virtex2.hpp:100
virtual void initializeDeviceInfo(const std::string &inDeviceName)
Initialize the device information.
Definition: Virtex2.cpp:263
FrameAddressToIndex mFrameAddressToIndex
Map of frame addressee to frame indexes.
Definition: Virtex2.hpp:220
Device database types for Xilinx architectures.