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

VirtexE bitstream inherited from Virtex bitstream. More...

#include <VirtexE.hpp>

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

Public Types

enum  ERegister {
  eRegisterCRC = 0, eRegisterFAR, eRegisterFDRI, eRegisterFDRO,
  eRegisterCMD, eRegisterCTL, eRegisterMASK, eRegisterSTAT,
  eRegisterLOUT, eRegisterCOR, eRegisterFLR =11, eRegisterCount
}
 Configuration register enumeration. More...
 
enum  ECommand {
  eCommandWCFG = 1, eCommandLFRM = 3, eCommandRCFG, eCommandSTART,
  eCommandRCAP, eCommandRCRC, eCommandAGHIGH, eCommandSWITCH,
  eCommandCount
}
 Configuration command enumeration for eRegisterCMD. More...
 
enum  EFar {
  eFarMaskBlockType = 0x06000000, eFarShiftBlockType = 25, eFarMaskMajor = 0x01FE0000, eFarShiftMajor = 17,
  eFarMaskMinor = 0x0001FE00, eFarShiftMinor = 9
}
 Frame Address Register subfields. More...
 
enum  EFarBlockType {
  eFarBlockType0 = 0, eFarBlockType1, eFarBlockType2, eFarBlockType3,
  eFarBlockType4, eFarBlockType5, eFarBlockType6, eFarBlockType7,
  eFarBlockTypeCount
}
 Frame Address Register block type constants. More...
 
enum  EColumnType {
  eColumnTypeEmpty = 0, eColumnTypeBram, eColumnTypeClb, eColumnTypeClock,
  eColumnTypeDsp, eColumnTypeGtx, eColumnTypeIob, eColumnTypeCount
}
 Major column types. More...
 
typedef
torc::common::EncapsulatedInteger
< uint16_t
ColumnIndex
 Prepares the frames to load them at the correct frame indexes. More...
 
enum  { eBlockTypeCount = 8 }
 The block type count is fixed at eight across all Xilinx architectures. More...
 
enum  EBitstreamType { eBitstreamTypeFull, eBitstreamTypePartialActive, eBitstreamTypePartialShutdown }
 The bitstream type to generate. Use eBitstreamFull to fully reconfigure a device, eBitstreamTypePartialActive to partially reconfigure it while it continues to run, or eBitstreamTypePartialShutdown to partially recongifure it after shutting it down. More...
 
enum  EFrameInclude { eFrameIncludeOnlyDirtyFrames, eFrameIncludeAllUsedFrames }
 The frames to include in a partial bitstream. Use eFrameIncludeOnlyDirtyFrames to include only dirty frames, or eFrameStateAllUsedFrames to include all allocated frames, dirty or not. Note that if not all frames were allocated, eFrameStateAllUsedFrames is not the same as a full bitstream. More...
 
typedef std::string string
 Imported type name. More...
 
typedef boost::uint8_t uint8_t
 Imported type name. More...
 
typedef boost::uint16_t uint16_t
 Imported type name. More...
 
typedef torc::common::EDevice EDevice
 Imported type name. More...
 
typedef std::map< std::string,
uint32_t
TileTypeNameToColumnType
 Mapping from tile type names to column types. More...
 
typedef std::map< uint16_t,
uint32_t
TileTypeIndexToColumnType
 Mapping from tile indexes to column types. More...
 
enum  EPacketType { ePacketType1 = 1, ePacketType2, ePacketTypeCount = 8 }
 Packet type enumeration. More...
 
enum  EOpcode {
  eOpcodeNOP = 0, eOpcodeRead, eOpcodeWrite, eOpcodeReserved,
  eOpcodeCount
}
 Packet opcode enumeration. More...
 
enum  EPacket {
  ePacketMaskType = 0xe0000000, ePacketShiftType = 29, ePacketMaskOpcode = 0x18000000, ePacketShiftOpcode = 27,
  ePacketMaskType1Address = 0x07ffe000, ePacketShiftType1Address = 13, ePacketMaskType1Reserved = 0x00001800, ePacketShiftType1Reserved = 11,
  ePacketMaskType1Count = 0x000007ff, ePacketShiftType1Count = 0, ePacketMaskType2Count = 0x07ffffff, ePacketShiftType2Count = 0
}
 Packet subfields. More...
 
enum  ESynchronization { eSynchronizationDummy = 0xffffffff, eSynchronizationSync = 0xaa995566, eSynchronizationBusWidthSync = 0x000000bb, eSynchronizationBusWidthDetect = 0x11220044 }
 Synchronization words. More...
 
typedef VirtexFrame frame_t
 FrameSet frame type. More...
 
typedef VirtexFrame::word_t word_t
 FrameSet word type. More...
 

Public Member Functions

virtual void initializeDeviceInfo (const std::string &inDeviceName)
 Initialize the device information. More...
 
virtual void initializeFrameMaps (void)
 Initialize the maps between frame indexes and frame addresses. This is generally only useful for internal purposes. More...
 
virtual uint32_t getFrameLength (void) const
 
virtual uint32_t getFrameRowCount (void) const
 Return the number of frame rows for the current device. More...
 
void prepareFrames (ColumnIndex &inCol, int &inFrameCount, int &inFrameIndex, EFarBlockType &inBlockType, int &inFarMajor, int &inWidth)
 
void initializeFullFrameBlocks (void)
 Loads full bitstream frames into block data structure. More...
 
VirtexFrameBlocks getBitstreamFrames (uint32_t inBlockCount, uint32_t inBitCol)
 Returns frames for queried bitstream coordinates. More...
 
VirtexFrameBlocks getXdlFrames (uint32_t inBlockCount, uint32_t inXdlCol)
 Returns frames for queried xdl coordinates. More...
 
virtual void readPackets (std::istream &inStream)
 Read bitstream packets from a stream. More...
 
virtual void writePackets (std::ostream &inStream)
 Write bitstream packets to a stream. More...
 
virtual void readFramePackets (void)
 Read frame data into the frame blocks structure. More...
 
virtual void updateFramePackets (EBitstreamType inBitstreamType=eBitstreamTypeFull, EFrameInclude inFrameInclusion=eFrameIncludeAllUsedFrames)
 Update the bitstream frame packets By default this updates the bitstream with full frame data. More...
 
virtual void generateBitstream (EBitstreamType inBitstreamType=eBitstreamTypeFull, EFrameInclude inFrameInclusion=eFrameIncludeAllUsedFrames)
 Discard existing packets and generate bitstream packets from frame data. By default this generates packets for a full bitstream. More...
 
virtual
VirtexPacketVector::iterator 
deleteFramePackets (void)
 Discard the existing frame packets and return an iterator to the start position. More...
 
virtual VirtexPacketVector generateFullBitstreamPackets (void)
 Return a packet vector with full frame data. More...
 
virtual VirtexPacketVector generateFullBitstreamPrefix (void)
 Return a packet vector with the full bitstream prefix. More...
 
virtual VirtexPacketVector generateFullBitstreamSuffix (void)
 Return a packet vector with the full bitstream suffix. More...
 
virtual VirtexPacketVector generatePartialBitstreamPackets (EFrameInclude inFrameInclusion)
 Return a packet vector with partial frame data. More...
 
virtual VirtexPacketVector generatePartialBitstreamPrefix (EBitstreamType inBitstreamType)
 Return a packet vector with the partial bitstream prefix. More...
 
virtual VirtexPacketVector generatePartialBitstreamSuffix (EBitstreamType inBitstreamType)
 Return a packet vector with the partial bitstream suffix. More...
 
virtual void preflightPackets (void)
 Preflight the packets. More...
 
virtual void updatePacketLength (void)
 Update the header packet length. More...
 
iterator insert (iterator position, const value_type &val)
 Regular std::vector inserter. More...
 
void insert (iterator position, size_type n, const value_type &val)
 Regular std::vector inserter. More...
 
template<class InputIterator >
void insert (iterator position, InputIterator first, InputIterator last)
 Regular std::vector inserter. More...
 
void insert (VirtexPacketVector::iterator inPosition, const VirtexPacketVector &inVector)
 Insert the contents of a packet vector at the specified position. More...
 
void append (const VirtexPacketVector &inVector)
 Append the contents of a packet vector to the end of the bitstream. More...
 
VirtexFrameBlocksgetFrameBlocks (void)
 Return the configuration frame blocks. More...
 
void write (std::ostream &inStream, uint8_t inVal)
 Write a uint8_t to the stream. More...
 
void write (std::ostream &inStream, uint16_t inVal)
 Write a uint16_t to the stream. More...
 
void write (std::ostream &inStream, uint32_t inVal)
 Write a uint32_t to the stream. More...
 
virtual void write (std::ostream &inStream)
 Write the bitstream header and packets to a stream. More...
 
void writeHeaderString (std::ostream &inStream, const string &inString)
 Write a Xilinx-style header string to the stream. More...
 
virtual void readHeader (std::istream &inStream)
 Read the bitstream header. More...
 
void cleanDateAndTime (void)
 Clean up the header date and time by replacing embedded spaces with zeros. More...
 
virtual void writeDeviceInfo (std::ostream &inStream, const std::string &inDeviceName)
 Output static device information to a stream. More...
 
void setDeviceInfo (const DeviceInfo &rhs)
 Assign static device information for the current bitstream. More...
 
void setDevice (const std::string &inDeviceName)
 Assign the device enumeration constant for the given device name. More...
 
virtual void read (std::istream &inStream, bool inCleanDateAndTime=true)
 Read the bitstream header and packets from a stream. More...
 
virtual void writeHeader (std::ostream &inStream)
 Write the bitstream header to the stream. More...
 
void setDesignName (const string &inDesignName)
 Set the design name. More...
 
void setDeviceName (const string &inDeviceName)
 Set the device name. More...
 
void setDesignDate (const string &inDesignDate)
 Set the design date. More...
 
void setDesignTime (const string &inDesignTime)
 Set the design time. More...
 
const stringgetDesignName (void) const
 Return the design name. More...
 
const stringgetDeviceName (void) const
 Return the device name. More...
 
const stringgetDesignDate (void) const
 Return the design date. More...
 
const stringgetDesignTime (void) const
 Return the design time. More...
 
uint32_t getBitstreamByteLength (void) const
 Return the bitstream packet length in bytes. More...
 
uint32_t getHeaderByteLength (void) const
 Return the bitstream header length in bytes. More...
 

Static Public Member Functions

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. More...
 
static bool expect (std::istream &inStream, uint8_t inExpected)
 Look for the expected uint8_t in the stream and return true if it matches. More...
 
static bool expect (std::istream &inStream, uint16_t inExpected)
 Look for the expected uint16_t in the stream and return true if it matches. More...
 
static bool expect (std::istream &inStream, uint32_t inExpected)
 Look for the expected uint32_t in the stream and return true if it matches. More...
 
static void readHeaderString (std::istream &inStream, string &outString)
 Read and return a bitstream header string. More...
 
static bool readHeader (std::istream &inStream, string &outDesignName, string &outDeviceName, string &outDesignDate, string &outDesignTime, uint32_t &outBitstreamLength, uint32_t &outHeaderLength)
 Read a bitstream header, and return its fields. More...
 
static void writeSubfieldSettings (std::ostream &inStream, uint32_t inWord, const Subfield *inSubfields)
 Insert 32 bit subfield settings into an output stream. More...
 
static void writeSubfieldSettings (std::ostream &inStream, uint16_t inWord, const Subfield *inSubfields)
 Insert 16 bit subfield settings into an output stream. More...
 

Data Fields

EDevice mDevice
 Bitstream device enumeration. More...
 
string mDesignName
 Header design name. More...
 
string mDeviceName
 Header device name. More...
 
string mDesignDate
 Header design date. More...
 
string mDesignTime
 Header design time. More...
 
uint32_t mBitstreamByteLength
 Bitstream packet length in bytes. More...
 
uint32_t mHeaderByteLength
 Header length in bytes. More...
 
ColumnDefVector mColumnDefs
 Column type widths. More...
 
TileTypeNameToColumnType mTileTypeNameToColumnType
 
TileTypeIndexToColumnType mTileTypeIndexToColumnType
 
DeviceInfo mDeviceInfo
 Device information. More...
 
FrameSet< VirtexFramemBlock [Bitstream::eBlockTypeCount]
 FrameSets for each of the eight block types. More...
 

Protected Types

typedef boost::uint32_t uint32_t
 Imported type name. More...
 
typedef std::map< uint32_t,
Virtex::FrameAddress
FrameIndexToAddress
 Map from frame index to frame address. More...
 
typedef std::map
< Virtex::FrameAddress,
uint32_t
FrameAddressToIndex
 Map from frame address to frame index. More...
 
typedef std::vector< uint32_tIndexVector
 Array of vectors to store frame indexes of each block type. More...
 

Protected Member Functions

void unimplemented (std::string inName)
 Reports the named function as not yet implemented in the current architecture. More...
 
virtual void updateCrc16 (torc::common::DeviceDesignator::EFamily inFamily)
 Update CRC-16 packets. More...
 
virtual void updateCrc32 (torc::common::DeviceDesignator::EFamily inFamily)
 Update CRC-32 packets. More...
 
template<class ARCH >
void readFramePackets4567 (uint32_t inBlockFrameIndexBounds[], std::map< typename ARCH::FrameAddress, uint32_t > &inFrameAddressToIndex, std::map< uint32_t, typename ARCH::FrameAddress > &inFrameIndexToAddress)
 Read frame packets in for Virtex4/5/6/7 devices. More...
 
template<class ARCH >
VirtexPacketVector::iterator deleteFramePackets4567 (void)
 Discard the existing frame packets for Virtex4/5/6/7 devices. More...
 
template<class ARCH >
VirtexPacketVector generateFullBitstreamPackets4567 (uint32_t inBlockFrameIndexBounds[])
 Return a packet vector with full frame data for Virtex4/5/6/7 devices. More...
 
template<class ARCH >
VirtexPacketVector generatePartialBitstreamPackets4567 (EFrameInclude inFrameInclusion, std::map< typename ARCH::FrameAddress, uint32_t > &inFrameAddressToIndex, std::map< uint32_t, typename ARCH::FrameAddress > &inFrameIndexToAddress)
 Return a packet vector with partial frame data for Virtex4/5/6/7 devices. More...
 

Protected Attributes

string mPrivateDeviceName
 
FrameIndexToAddress mFrameIndexToAddress
 Map of frame indexes to frame addresses. More...
 
FrameAddressToIndex mFrameAddressToIndex
 Map of frame addressee to frame indexes. More...
 
IndexVector mBitColumnIndexes [Virtex::eFarBlockTypeCount]
 Vector to store frame indexes of XDL columns. More...
 
IndexVector mXdlColumnIndexes [Virtex::eFarBlockTypeCount]
 Vector to store frame indexes of Bitstream columns. More...
 
uint32_t mBlockFrameIndexBounds [Virtex::eFarBlockTypeCount]
 Array to hold frame index boundaries for blocks. More...
 
uint32_t mFrameIndexBounds
 Frame index bounds count. More...
 
std::map< uint32_t, uint32_tmXdlColumnToBitColumn
 Map of XDL column indexes to bitstream column indexes. More...
 
VirtexFrameBlocks mFrameBlocks
 Input Frame blocks. More...
 

Static Protected Attributes

static const char * sPacketTypeName [ePacketTypeCount]
 Packet type names. More...
 
static const char * sOpcodeName [eOpcodeCount]
 Packet opcode names. More...
 
static const char * sRegisterName [eRegisterCount]
 Configuration register names. More...
 
static const char * sCommandName [eCommandCount]
 Configuration command names. More...
 
static const Subfield sCOR []
 Configuration Options Register (COR) subfields. More...
 
static const Subfield sSTAT []
 Status Register (STAT) subfields. More...
 
static const Subfield sCTL []
 Control Register (CTL) subfields. More...
 
static const Subfield sMASK []
 Control Mask Register (MASK) subfields. More...
 

Friends

class torc::bitstream::bitstream::VirtexEUnitTest
 
class torc::bitstream::bitstream::VirtexEFarUnitTest
 
void torc::bitstream::bitstream::testVirtexEDevice (const std::string &inDeviceName, const boost::filesystem::path &inWorkingPath)
 
void torc::bitstream::bitstream::testVirtexEFullMapping (const boost::filesystem::path &inWorkingPath)
 

Detailed Description

VirtexE bitstream inherited from Virtex bitstream.

Definition at line 37 of file VirtexE.hpp.

Member Typedef Documentation

Prepares the frames to load them at the correct frame indexes.

Definition at line 133 of file Virtex.hpp.

Imported type name.

Definition at line 64 of file bitstream/Bitstream.hpp.

FrameSet frame type.

Definition at line 83 of file FrameSet.hpp.

Map from frame address to frame index.

Definition at line 204 of file Virtex.hpp.

Map from frame index to frame address.

Definition at line 202 of file Virtex.hpp.

typedef std::vector<uint32_t> torc::bitstream::Virtex::IndexVector
protectedinherited

Array of vectors to store frame indexes of each block type.

Definition at line 206 of file Virtex.hpp.

typedef std::string torc::bitstream::Bitstream::string
inherited

Imported type name.

Todo:
Bitstream access needs to be changed from public back to protected.

Definition at line 60 of file bitstream/Bitstream.hpp.

Mapping from tile indexes to column types.

Definition at line 254 of file bitstream/Bitstream.hpp.

typedef std::map<std::string, uint32_t> torc::bitstream::Bitstream::TileTypeNameToColumnType
inherited

Mapping from tile type names to column types.

Definition at line 251 of file bitstream/Bitstream.hpp.

typedef boost::uint16_t torc::bitstream::Bitstream::uint16_t
inherited

Imported type name.

Definition at line 62 of file bitstream/Bitstream.hpp.

typedef boost::uint32_t torc::bitstream::Virtex::uint32_t
protectedinherited

Imported type name.

Definition at line 49 of file Virtex.hpp.

typedef boost::uint8_t torc::bitstream::Bitstream::uint8_t
inherited

Imported type name.

Definition at line 61 of file bitstream/Bitstream.hpp.

FrameSet word type.

Definition at line 85 of file FrameSet.hpp.

Member Enumeration Documentation

anonymous enum
inherited

The block type count is fixed at eight across all Xilinx architectures.

Enumerator
eBlockTypeCount 

Definition at line 44 of file bitstream/Bitstream.hpp.

The bitstream type to generate. Use eBitstreamFull to fully reconfigure a device, eBitstreamTypePartialActive to partially reconfigure it while it continues to run, or eBitstreamTypePartialShutdown to partially recongifure it after shutting it down.

Enumerator
eBitstreamTypeFull 
eBitstreamTypePartialActive 
eBitstreamTypePartialShutdown 

Definition at line 49 of file bitstream/Bitstream.hpp.

Major column types.

These are defined and used for internal purposes only, and are not derived from any Xilinx documentation.

Enumerator
eColumnTypeEmpty 
eColumnTypeBram 
eColumnTypeClb 
eColumnTypeClock 
eColumnTypeDsp 
eColumnTypeGtx 
eColumnTypeIob 
eColumnTypeCount 

Definition at line 78 of file Virtex.hpp.

Configuration command enumeration for eRegisterCMD.

See Also
CMD register commands: XAPP151, v1.7, October 20, 2004, Table 19.
Enumerator
eCommandWCFG 
eCommandLFRM 
eCommandRCFG 
eCommandSTART 
eCommandRCAP 
eCommandRCRC 
eCommandAGHIGH 
eCommandSWITCH 
eCommandCount 

Definition at line 61 of file Virtex.hpp.

Frame Address Register subfields.

See Also
Frame Address Register Description: XAPP151, v1.7, October 20, 2004, Figure 19.
Enumerator
eFarMaskBlockType 
eFarShiftBlockType 
eFarMaskMajor 
eFarShiftMajor 
eFarMaskMinor 
eFarShiftMinor 

Definition at line 66 of file Virtex.hpp.

The frames to include in a partial bitstream. Use eFrameIncludeOnlyDirtyFrames to include only dirty frames, or eFrameStateAllUsedFrames to include all allocated frames, dirty or not. Note that if not all frames were allocated, eFrameStateAllUsedFrames is not the same as a full bitstream.

Enumerator
eFrameIncludeOnlyDirtyFrames 
eFrameIncludeAllUsedFrames 

Definition at line 56 of file bitstream/Bitstream.hpp.

Packet subfields.

See Also
type 1 packet format: UG071, v1.10, April 8, 2008, Table 7-2.
type 2 packet format: UG071, v1.10, April 8, 2008, Table 7-4.
type 1 packet format: XAPP151, v1.7, October 20, 2004, Figure 13.
type 2 packet format: XAPP151, v1.7, October 20, 2004, Figure 14.
Enumerator
ePacketMaskType 
ePacketShiftType 
ePacketMaskOpcode 
ePacketShiftOpcode 
ePacketMaskType1Address 
ePacketShiftType1Address 
ePacketMaskType1Reserved 
ePacketShiftType1Reserved 
ePacketMaskType1Count 
ePacketShiftType1Count 
ePacketMaskType2Count 
ePacketShiftType2Count 

Definition at line 51 of file VirtexPacket.hpp.

51  {
52  // generic packet subfields
53  ePacketMaskType = 0xe0000000, ePacketShiftType = 29,
54  ePacketMaskOpcode = 0x18000000, ePacketShiftOpcode = 27,
55  // type 1 packet subfields
59  // type 2 packet subfields
61  };

Packet type enumeration.

See Also
packet type: UG071, v1.10, April 8, 2008, Tables 7-2 and 7-4.
packet type: XAPP151, v1.7, October 20, 2004, Figure 13, 14.
Enumerator
ePacketType1 
ePacketType2 
ePacketTypeCount 

Definition at line 41 of file VirtexPacket.hpp.

Configuration register enumeration.

See Also
configuration registers: XAPP151, v1.7, October 20, 2004, Table 18.
Enumerator
eRegisterCRC 
eRegisterFAR 
eRegisterFDRI 
eRegisterFDRO 
eRegisterCMD 
eRegisterCTL 
eRegisterMASK 
eRegisterSTAT 
eRegisterLOUT 
eRegisterCOR 
eRegisterFLR 
eRegisterCount 

Definition at line 55 of file Virtex.hpp.

Synchronization words.

See Also
Configuration Sequence: UG191, v3.7, June 24, 2009, Table 6-15.
Configuration Sequence: UG071, v1.10, April 8, 2008, Table 7-11.
Configuration Sequence: XAPP511, v1.7, October 20, 2004, Figure 23.
Enumerator
eSynchronizationDummy 
eSynchronizationSync 
eSynchronizationBusWidthSync 
eSynchronizationBusWidthDetect 

Definition at line 67 of file VirtexPacket.hpp.

Member Function Documentation

void torc::bitstream::VirtexBitstream::append ( const VirtexPacketVector inVector)
inlineinherited

Append the contents of a packet vector to the end of the bitstream.

Definition at line 134 of file VirtexBitstream.hpp.

134  {
135  VirtexPacketVector::insert(end(), inVector.begin(), inVector.end());
136  }
void torc::bitstream::Bitstream::cleanDateAndTime ( void  )
inlineinherited

Clean up the header date and time by replacing embedded spaces with zeros.

Definition at line 183 of file bitstream/Bitstream.hpp.

183  {
184  // some versions of the tools leave spaces inside the date and time fields
185  size_t pos = 0;
186  while((pos = mDesignDate.find(' ', pos)) != string::npos) mDesignDate[pos] = '0';
187  pos = 0;
188  while((pos = mDesignTime.find(' ', pos)) != string::npos) mDesignTime[pos] = '0';
189  }
string mDesignDate
Header design date.
string mDesignTime
Header design time.

+ Here is the caller graph for this function:

VirtexPacketVector::iterator torc::bitstream::VirtexBitstream::deleteFramePackets ( void  )
virtualinherited

Discard the existing frame packets and return an iterator to the start position.

Reimplemented in torc::bitstream::Virtex7, torc::bitstream::Virtex6, torc::bitstream::Virtex5, and torc::bitstream::Virtex4.

Definition at line 202 of file VirtexBitstream.cpp.

202  {
203  unimplemented("deleteFramePackets()");
204  return end();
205  }
void unimplemented(std::string inName)
Reports the named function as not yet implemented in the current architecture.
template<class ARCH >
VirtexPacketVector::iterator torc::bitstream::VirtexBitstream::deleteFramePackets4567 ( void  )
protectedinherited

Discard the existing frame packets for Virtex4/5/6/7 devices.

Todo:
Throw some meaningful exception

Definition at line 213 of file VirtexBitstream.cpp.

214  {
215  // walk the bitstream and look for frame packet boundaries
216  // we begin with the first FAR write, and end before the first CRC write after an FDRI write
217  iterator b = begin();
218  iterator p = b;
219  iterator e = end();
220  iterator start = e;
221  iterator stop = b;
222  iterator fdri = b;
223  while(p < e) {
224  // look up the current packet
225  const VirtexPacket& packet = *p;
226  // start from the first FAR write
227  if(start == e && packet.isWrite() && packet.getAddress() == ARCH::eRegisterFAR) {
228  start = p;
229  }
230  // remember the last FDRI write (including a trailing Type 2 write if present)
231  if(packet.isWrite() && packet.getAddress() == ARCH::eRegisterFDRI) {
232  fdri = p;
233  if((p+1)->isWrite() && (p+1)->isType2()) fdri++;
234  }
235  // stop on the first CRC after the last FDRI write
236  // (Beware: the zero "address" of a Type 2 packet looks like the CRC register)
237  if(stop < fdri && packet.isWrite() && packet.isType1()
238  && packet.getAddress() == ARCH::eRegisterCRC) {
239  stop = p;
240  }
241  p++;
242  }
243  // look for anything unexpected
244  p = start;
245  while(p < stop) {
246  // look up the current packet
247  const VirtexPacket& packet = *p++;
248  // abort if we find anything unexpected
249  if(start < e && stop > b && !(
250  packet.isNop() || (
251  packet.isWrite() && (
252  packet.getAddress() == ARCH::eRegisterFAR ||
253  packet.getAddress() == ARCH::eRegisterLOUT ||
254  packet.getAddress() == ARCH::eRegisterFDRI ||
255  packet.getAddress() == ARCH::eRegisterCRC ||
256  (packet.getAddress() == ARCH::eRegisterCMD && packet[1] == ARCH::eCommandWCFG)
257  )))) {
258  /// \todo Throw some meaningful exception
259  std::cerr << "Unable to safely distinguish frame packets." << std::endl;
260  return e;
261  }
262  }
263  // if we found the expected FAR -> FDRI -> CRC structure, delete the frame packets
264  if(start < stop && b < stop) {
265  erase(start, stop);
266  return start;
267  }
268  // if we didn't find frame packets or delete anything, return the end iterator
269  return e;
270  }

+ Here is the call graph for this function:

static bool torc::bitstream::Bitstream::expect ( std::istream &  inStream,
uint8_t  inExpected 
)
inlinestaticinherited

Look for the expected uint8_t in the stream and return true if it matches.

Definition at line 89 of file bitstream/Bitstream.hpp.

89  {
90  // read the actual data from the stream
91  uint8_t actual = 0;
92  inStream.read((char*) &actual, sizeof(actual));
93  // return equality
94  return inExpected == actual;
95  }
boost::uint8_t uint8_t
Imported type name.

+ Here is the caller graph for this function:

static bool torc::bitstream::Bitstream::expect ( std::istream &  inStream,
uint16_t  inExpected 
)
inlinestaticinherited

Look for the expected uint16_t in the stream and return true if it matches.

Definition at line 97 of file bitstream/Bitstream.hpp.

97  {
98  // read the actual data from the stream
99  uint16_t actual = 0;
100  inStream.read((char*) &actual, sizeof(actual));
101  // return equality
102  return inExpected == ntohs(actual);
103  }
boost::uint16_t uint16_t
Imported type name.
static bool torc::bitstream::Bitstream::expect ( std::istream &  inStream,
uint32_t  inExpected 
)
inlinestaticinherited

Look for the expected uint32_t in the stream and return true if it matches.

Definition at line 105 of file bitstream/Bitstream.hpp.

105  {
106  // read the actual data from the stream
107  uint32_t actual = 0;
108  inStream.read((char*) &actual, sizeof(actual));
109  // return equality
110  return inExpected == ntohl(actual);
111  }
boost::uint32_t uint32_t
Imported type name.
void torc::bitstream::VirtexBitstream::generateBitstream ( EBitstreamType  inBitstreamType = eBitstreamTypeFull,
EFrameInclude  inFrameInclusion = eFrameIncludeAllUsedFrames 
)
virtualinherited

Discard existing packets and generate bitstream packets from frame data. By default this generates packets for a full bitstream.

Parameters
inBitstreamTypeThe type of bitstream to generate: full, active partial, or shutdown partial.
inFrameInclusionThe type of frames to include in partial bitstreams: only dirty frames or all frames.

Definition at line 58 of file VirtexBitstream.cpp.

59  {
60  // discard all packets
61  clear();
62  if(inBitstreamType == eBitstreamTypeFull) {
63  // generate the prefix
65  // generate the frame packets
67  // generate the suffix
69  } else {
70  // generate the prefix
71  append(generatePartialBitstreamPrefix(inBitstreamType));
72  // generate the frame packets
73  append(generatePartialBitstreamPackets(inFrameInclusion));
74  // generate the suffix
75  append(generatePartialBitstreamSuffix(inBitstreamType));
76  }
77  }
virtual VirtexPacketVector generatePartialBitstreamPackets(EFrameInclude inFrameInclusion)
Return a packet vector with partial frame data.
virtual VirtexPacketVector generatePartialBitstreamPrefix(EBitstreamType inBitstreamType)
Return a packet vector with the partial bitstream prefix.
virtual VirtexPacketVector generatePartialBitstreamSuffix(EBitstreamType inBitstreamType)
Return a packet vector with the partial bitstream suffix.
void append(const VirtexPacketVector &inVector)
Append the contents of a packet vector to the end of the bitstream.
virtual VirtexPacketVector generateFullBitstreamPrefix(void)
Return a packet vector with the full bitstream prefix.
virtual VirtexPacketVector generateFullBitstreamSuffix(void)
Return a packet vector with the full bitstream suffix.
virtual VirtexPacketVector generateFullBitstreamPackets(void)
Return a packet vector with full frame data.
VirtexPacketVector torc::bitstream::VirtexBitstream::generateFullBitstreamPackets ( void  )
virtualinherited

Return a packet vector with full frame data.

Reimplemented in torc::bitstream::Virtex7, torc::bitstream::Virtex6, torc::bitstream::Virtex5, and torc::bitstream::Virtex4.

Definition at line 272 of file VirtexBitstream.cpp.

272  {
273  unimplemented("generateFullBitstreamPackets()");
274  return VirtexPacketVector();
275  }
void unimplemented(std::string inName)
Reports the named function as not yet implemented in the current architecture.
std::vector< VirtexPacket > VirtexPacketVector
Vector of Virtex packets.
template<class ARCH >
VirtexPacketVector torc::bitstream::VirtexBitstream::generateFullBitstreamPackets4567 ( uint32_t  inBlockFrameIndexBounds[])
protectedinherited

Return a packet vector with full frame data for Virtex4/5/6/7 devices.

Definition at line 287 of file VirtexBitstream.cpp.

288  {
289 
290  // declare the packet vector and define a NOP packet
291  typedef VirtexFrame::word_t word_t;
292  VirtexPacketVector packets;
293  VirtexPacket nop(VirtexPacket::makeHeader(ePacketType1, eOpcodeNOP, 0, 0));
294 
295  // determine the total size of the frames to write
296  size_t size = 0;
297  for(int i = 0; i < eBlockTypeCount; i++)
298  size += inBlockFrameIndexBounds[i] * getFrameLength();
299  word_t* frameContents = new VirtexFrameSet::word_t[size];
300  word_t* pos = frameContents;
301  // gather the frames to write
302  for(int i = 0; i < eBlockTypeCount; i++) {
303  // look up the frame set for this block type
304  VirtexFrameSet& frameSet = mFrameBlocks.mBlock[i];
305  // iterate through the frames in the set and collect the frame words
306  VirtexFrameSet::iterator p = frameSet.begin();
307  VirtexFrameSet::iterator e = frameSet.end();
308  while(p < e) {
309  // look up the current frame
310  VirtexFrameSharedPtr framePtr = *p++;
311  // set up the pointers
312  const word_t* wp = framePtr->getWords();
313  const word_t* we = wp + framePtr->getLength();
314  // and copy the frame words into the new memory
315  if(wp) do { *pos++ = *wp++; } while(wp < we); // frames with words allocated
316  else do { *pos++ = 0; wp++; } while(wp < we); // frames with no words allocated
317  }
318  }
319  // write the starting frame address
320  packets.push_back(VirtexPacket::makeType1Write(ARCH::eRegisterFAR, 0));
321  // write the write configuration register command
322  packets.push_back(VirtexPacket::makeType1Write(ARCH::eRegisterCMD, ARCH::eCommandWCFG));
323  packets.push_back(nop);
324  // write 0 bytes to FDRI (in preparation for type 2 write packet)
325  packets.push_back(VirtexPacket::makeNullType1Write(ARCH::eRegisterFDRI));
326  // write all frames to FDRI
327  packets.push_back(VirtexPacket::makeType2Write(size, frameContents));
328 
329  // return the packet vector
330  return packets;
331  }
VirtexFrameBlocks mFrameBlocks
Input Frame blocks.
static VirtexPacket makeNullType1Write(uint32_t inAddress)
Construct a null type 1 write packet.
FrameSet< VirtexFrame > VirtexFrameSet
Virtex frame set type.
Definition: FrameSet.hpp:73
static VirtexPacket makeType2Write(uint32_t inCount, uint32_t *inWords)
Construct a type 2 write packet.
VirtexFrame::word_t word_t
FrameSet word type.
Definition: FrameSet.hpp:85
FrameSet< FRAME_TYPE > mBlock[Bitstream::eBlockTypeCount]
FrameSets for each of the eight block types.
Definition: FrameSet.hpp:88
std::vector< VirtexPacket > VirtexPacketVector
Vector of Virtex packets.
static VirtexPacket makeType1Write(uint32_t inAddress, uint32_t inWord)
Construct a type 1 write packet.
boost::shared_ptr< VirtexFrame > VirtexFrameSharedPtr
Virtex frame type.
Definition: Frame.hpp:108
VirtexFrame::word_t word_t
FrameSet word type.
Definition: FrameSet.hpp:42
virtual uint32_t getFrameLength(void) const
Return the frame length for the current device.
static uint32_t makeHeader(EPacketType inType, EOpcode inOpcode, uint32_t inAddress, uint32_t inCount)
Construct a packet header.
WORD_TYPE word_t
Frame word type.
Definition: Frame.hpp:48
VirtexPacketVector torc::bitstream::VirtexBitstream::generateFullBitstreamPrefix ( void  )
virtualinherited

Return a packet vector with the full bitstream prefix.

Reimplemented in torc::bitstream::Virtex7, torc::bitstream::Virtex6, torc::bitstream::Virtex5, and torc::bitstream::Virtex4.

Definition at line 333 of file VirtexBitstream.cpp.

333  {
334  unimplemented("generateFullBitstreamPrefix()");
335  return VirtexPacketVector();
336  }
void unimplemented(std::string inName)
Reports the named function as not yet implemented in the current architecture.
std::vector< VirtexPacket > VirtexPacketVector
Vector of Virtex packets.
VirtexPacketVector torc::bitstream::VirtexBitstream::generateFullBitstreamSuffix ( void  )
virtualinherited

Return a packet vector with the full bitstream suffix.

Reimplemented in torc::bitstream::Virtex7, torc::bitstream::Virtex6, torc::bitstream::Virtex5, and torc::bitstream::Virtex4.

Definition at line 338 of file VirtexBitstream.cpp.

338  {
339  unimplemented("generateFullBitstreamSuffix()");
340  return VirtexPacketVector();
341  }
void unimplemented(std::string inName)
Reports the named function as not yet implemented in the current architecture.
std::vector< VirtexPacket > VirtexPacketVector
Vector of Virtex packets.
VirtexPacketVector torc::bitstream::VirtexBitstream::generatePartialBitstreamPackets ( EFrameInclude  inFrameInclusion)
virtualinherited

Return a packet vector with partial frame data.

Parameters
inFrameInclusionThe type of frames to include: only dirty frames or all frames.

Reimplemented in torc::bitstream::Virtex7, torc::bitstream::Virtex6, torc::bitstream::Virtex5, and torc::bitstream::Virtex4.

Definition at line 343 of file VirtexBitstream.cpp.

344  {
345  unimplemented("generatePartialBitstreamPackets()");
346  return VirtexPacketVector();
347  }
void unimplemented(std::string inName)
Reports the named function as not yet implemented in the current architecture.
std::vector< VirtexPacket > VirtexPacketVector
Vector of Virtex packets.
template<class ARCH >
VirtexPacketVector torc::bitstream::VirtexBitstream::generatePartialBitstreamPackets4567 ( EFrameInclude  inFrameInclusion,
std::map< typename ARCH::FrameAddress, uint32_t > &  inFrameAddressToIndex,
std::map< uint32_t, typename ARCH::FrameAddress > &  inFrameIndexToAddress 
)
protectedinherited

Return a packet vector with partial frame data for Virtex4/5/6/7 devices.

Todo:
mFrameIndexToAddress.size() is too short because excludes pad frames

Definition at line 367 of file VirtexBitstream.cpp.

370  {
371  // clean up the template parameters
372  typedef typename ARCH::FrameAddress FrameAddress;
373  typedef std::map<FrameAddress, uint32_t> FrameAddressToIndex;
374  typedef std::map<uint32_t, FrameAddress> FrameIndexToAddress;
375 
376  // declare the packet vector and define a NOP packet
377  typedef VirtexFrame::word_t word_t;
378  VirtexPacketVector packets;
379  VirtexPacket nop(VirtexPacket::makeHeader(ePacketType1, eOpcodeNOP, 0, 0));
380 
381  // write the starting frame address
382  packets.push_back(VirtexPacket::makeType1Write(ARCH::eRegisterFAR, 0));
383  // write the write configuration register command
384  packets.push_back(VirtexPacket::makeType1Write(ARCH::eRegisterCMD, ARCH::eCommandWCFG));
385  packets.push_back(nop);
386 
387  // iterate through the frame blocks looking for groups of contiguous frames that are in use
388  bool empty = true;
389  uint32_t index = 0;
390  uint32_t blockStart = 0;
391  for(int i = 0; i < eBlockTypeCount; i++) {
392  blockStart += index;
393  index = 0;
394  bool started = false;
395  uint32_t startIndex = 0;
396  // look up the frame set for this block type
397  VirtexFrameSet& frameSet = mFrameBlocks.mBlock[i];
398  // iterate through the frames in the set and add up their lengths
399  VirtexFrameSet::iterator p = frameSet.begin();
400  VirtexFrameSet::iterator e = frameSet.end();
401  while(p < e) {
402  // look up the current frame
403  VirtexFrameSharedPtr framePtr = *p++;
404  // determine whether the frame fits inclusion criteria
405  // we include dirty frames, we include clean frames if permitted by the caller,
406  // and if we are collecting frames and we encounter pad frames, we include them,
407  // but we stop collecting if we reach the last frame in the set
408  /// \todo mFrameIndexToAddress.size() is too short because excludes pad frames
409  bool include = p < e
410  && (
411  framePtr->isDirty()
412  || (inFrameInclusion == eFrameIncludeAllUsedFrames && framePtr->isUsed())
413  || (started && blockStart + index < inFrameIndexToAddress.size() &&
414  inFrameIndexToAddress.find(blockStart + index)
415  == inFrameIndexToAddress.end())
416  );
417  // if we are accumulating frames and this frame doesn't meet the criteria, process
418  // the collection of frames and stop collecting
419  if((started && !include)) {
420  started = false;
421  uint32_t stopIndex = index + (p == e ? 1 : 0);
422  uint32_t currentIndex = startIndex;
423  // std::cerr << " stopped at: " << stopIndex << std::endl;
424  // include two trailing pad frames if appropriate
425  if(inFrameIndexToAddress.find(blockStart + stopIndex + 1)
426  == inFrameIndexToAddress.end()) {
427  stopIndex++;
428  if(inFrameIndexToAddress.find(blockStart + stopIndex + 1)
429  == inFrameIndexToAddress.end())
430  stopIndex++;
431  }
432  // determine the length of the contiguous block
433  size_t size = (stopIndex - startIndex) * getFrameLength();
434  // allocate a word array
435  word_t* frameContents = new VirtexFrameSet::word_t[size];
436  word_t* pos = frameContents;
437  while(currentIndex < stopIndex) {
438  // look up the current frame
439  VirtexFrameSharedPtr framePtr = mFrameBlocks.mBlock[i][currentIndex];
440  // set up the pointers
441  const word_t* wp = framePtr->getWords();
442  const word_t* we = wp + framePtr->getLength();
443  // and copy the frame words into the new memory
444  if(wp) do { *pos++ = *wp++; } while(wp < we); // frames with words
445  else do { *pos++ = 0; wp++; } while(wp < we); // frames with no words
446  currentIndex++;
447  }
448  // write the starting frame address
449  packets.push_back(VirtexPacket::makeType1Write(ARCH::eRegisterFAR,
450  inFrameIndexToAddress[blockStart + startIndex]));
451  packets.push_back(nop);
452  // if the size is more than 2048 words, we have to use a Type 2 write
453  if(size > 2048) {
454  // write 0 bytes to FDRI (in preparation for type 2 write packet)
455  packets.push_back(VirtexPacket::makeNullType1Write(ARCH::eRegisterFDRI));
456  // write all frames to FDRI
457  packets.push_back(VirtexPacket::makeType2Write(size, frameContents));
458  } else {
459  // write all frames to FDRI
460  packets.push_back(VirtexPacket::makeType1Write(ARCH::eRegisterFDRI, size,
461  frameContents));
462  }
463  if(size) empty = false;
464  // if we are not collecting, but we encounter a frame to include, begin collecting
465  } else if(!started && include) {
466  // std::cerr << " started at: " << index << std::endl;
467  startIndex = index;
468  started = true;
469  }
470  // increment the frame index
471  index++;
472  }
473  }
474 
475  // if we generated no frame contents, discard the wrapper packets
476  if(empty) packets.clear();
477  // return the packet vector
478  return packets;
479  }
VirtexFrameBlocks mFrameBlocks
Input Frame blocks.
static VirtexPacket makeNullType1Write(uint32_t inAddress)
Construct a null type 1 write packet.
boost::uint32_t uint32_t
Imported type name.
FrameSet< VirtexFrame > VirtexFrameSet
Virtex frame set type.
Definition: FrameSet.hpp:73
static VirtexPacket makeType2Write(uint32_t inCount, uint32_t *inWords)
Construct a type 2 write packet.
VirtexFrame::word_t word_t
FrameSet word type.
Definition: FrameSet.hpp:85
FrameSet< FRAME_TYPE > mBlock[Bitstream::eBlockTypeCount]
FrameSets for each of the eight block types.
Definition: FrameSet.hpp:88
std::vector< VirtexPacket > VirtexPacketVector
Vector of Virtex packets.
static VirtexPacket makeType1Write(uint32_t inAddress, uint32_t inWord)
Construct a type 1 write packet.
boost::shared_ptr< VirtexFrame > VirtexFrameSharedPtr
Virtex frame type.
Definition: Frame.hpp:108
VirtexFrame::word_t word_t
FrameSet word type.
Definition: FrameSet.hpp:42
virtual uint32_t getFrameLength(void) const
Return the frame length for the current device.
static uint32_t makeHeader(EPacketType inType, EOpcode inOpcode, uint32_t inAddress, uint32_t inCount)
Construct a packet header.
WORD_TYPE word_t
Frame word type.
Definition: Frame.hpp:48
VirtexPacketVector torc::bitstream::VirtexBitstream::generatePartialBitstreamPrefix ( EBitstreamType  inBitstreamType)
virtualinherited

Return a packet vector with the partial bitstream prefix.

Parameters
inBitstreamTypeThe type of partial bitstream to generate: active or shutdown.

Reimplemented in torc::bitstream::Virtex7, torc::bitstream::Virtex6, torc::bitstream::Virtex5, and torc::bitstream::Virtex4.

Definition at line 481 of file VirtexBitstream.cpp.

482  {
483  unimplemented("generatePartialBitstreamPrefix()");
484  return VirtexPacketVector();
485  }
void unimplemented(std::string inName)
Reports the named function as not yet implemented in the current architecture.
std::vector< VirtexPacket > VirtexPacketVector
Vector of Virtex packets.
VirtexPacketVector torc::bitstream::VirtexBitstream::generatePartialBitstreamSuffix ( EBitstreamType  inBitstreamType)
virtualinherited

Return a packet vector with the partial bitstream suffix.

Parameters
inBitstreamTypeThe type of partial bitstream to generate: active or shutdown.

Reimplemented in torc::bitstream::Virtex7, torc::bitstream::Virtex6, torc::bitstream::Virtex5, and torc::bitstream::Virtex4.

Definition at line 487 of file VirtexBitstream.cpp.

488  {
489  unimplemented("generatePartialBitstreamSuffix()");
490  return VirtexPacketVector();
491  }
void unimplemented(std::string inName)
Reports the named function as not yet implemented in the current architecture.
std::vector< VirtexPacket > VirtexPacketVector
Vector of Virtex packets.
uint32_t torc::bitstream::Bitstream::getBitstreamByteLength ( void  ) const
inlineinherited

Return the bitstream packet length in bytes.

The length includes all packet data, but does not include the bitstream header.

Definition at line 340 of file bitstream/Bitstream.hpp.

340 { return mBitstreamByteLength; }
uint32_t mBitstreamByteLength
Bitstream packet length in bytes.
VirtexFrameBlocks torc::bitstream::Virtex::getBitstreamFrames ( uint32_t  inBlockCount,
uint32_t  inBitCol 
)
inherited

Returns frames for queried bitstream coordinates.

Definition at line 510 of file Virtex.cpp.

510  {
511 
512  // index and extract frames
513  int32_t bitColumnIndex[inBlockCount];
514  int32_t bitColumnBound[inBlockCount];
515 
516  for(uint32_t i = 0; i < inBlockCount; i++) {
517  // column Index of given frame index
518  bitColumnIndex[i] = mBitColumnIndexes[i][inBitCol];
519  // frame bounds for given column type
520  bitColumnBound[i] = mColumnDefs[mDeviceInfo.getColumnTypes()[inBitCol]][i];
521  }
522  // extract the tile frames for the specified FAR
523  VirtexFrameBlocks frameBlocks;
524  for(uint32_t i = 0; i < inBlockCount; i++) {
525  int startIndex = bitColumnIndex[i];
526  for(int j = 0; j < bitColumnBound[i]; j++)
527  frameBlocks.mBlock[i].push_back(mFrameBlocks.mBlock[i][startIndex+j]);
528  }
529  return frameBlocks;
530  }
ColumnDefVector mColumnDefs
Column type widths.
VirtexFrameBlocks mFrameBlocks
Input Frame blocks.
IndexVector mBitColumnIndexes[Virtex::eFarBlockTypeCount]
Vector to store frame indexes of XDL columns.
Definition: Virtex.hpp:214
DeviceInfo mDeviceInfo
Device information.
FrameSet< FRAME_TYPE > mBlock[Bitstream::eBlockTypeCount]
FrameSets for each of the eight block types.
Definition: FrameSet.hpp:88
const ColumnTypeVector & getColumnTypes(void) const
Returns the column type vector.
Definition: DeviceInfo.hpp:116
boost::uint32_t uint32_t
Imported type name.
Definition: Virtex.hpp:49
FrameBlocks< VirtexFrame > VirtexFrameBlocks
Virtex frame blocks type.
Definition: FrameSet.hpp:91

+ Here is the call graph for this function:

const string& torc::bitstream::Bitstream::getDesignDate ( void  ) const
inlineinherited

Return the design date.

Definition at line 335 of file bitstream/Bitstream.hpp.

335 { return mDesignDate; }
string mDesignDate
Header design date.
const string& torc::bitstream::Bitstream::getDesignName ( void  ) const
inlineinherited

Return the design name.

Definition at line 331 of file bitstream/Bitstream.hpp.

331 { return mDesignName; }
string mDesignName
Header design name.
const string& torc::bitstream::Bitstream::getDesignTime ( void  ) const
inlineinherited

Return the design time.

Definition at line 337 of file bitstream/Bitstream.hpp.

337 { return mDesignTime; }
string mDesignTime
Header design time.
const string& torc::bitstream::Bitstream::getDeviceName ( void  ) const
inlineinherited

Return the device name.

Definition at line 333 of file bitstream/Bitstream.hpp.

333 { return mDeviceName; }
string mDeviceName
Header device name.

+ Here is the caller graph for this function:

VirtexFrameBlocks& torc::bitstream::VirtexBitstream::getFrameBlocks ( void  )
inlineinherited

Return the configuration frame blocks.

Definition at line 139 of file VirtexBitstream.hpp.

139 { return mFrameBlocks; }
VirtexFrameBlocks mFrameBlocks
Input Frame blocks.
virtual uint32_t torc::bitstream::VirtexE::getFrameLength ( void  ) const
inlinevirtual

Reimplemented from torc::bitstream::Virtex.

Definition at line 51 of file VirtexE.hpp.

51  {
52  using namespace torc::common;
53  // Frame Length Register Value: XAPP151, v.1.7, October 20, 2004, Table 24.
54  switch(mDevice) {
55  case eXCV50E: return 12;
56  case eXCV100E: return 14;
57  case eXCV200E: return 18;
58  case eXCV300E: return 21;
59  case eXCV400E: return 25;
60  case eXCV405E: return 25;
61  case eXCV600E: return 30;
62  case eXCV812E: return 34;
63  case eXCV1000E: return 39;
64  case eXCV1600E: return 43;
65  case eXCV2000E: return 48;
66  case eXCV2600E: return 54;
67  case eXCV3200E: return 61;
68  default: return 0;
69  }
70  }
EDevice mDevice
Bitstream device enumeration.
virtual uint32_t torc::bitstream::VirtexE::getFrameRowCount ( void  ) const
inlinevirtual

Return the number of frame rows for the current device.

Reimplemented from torc::bitstream::Virtex.

Definition at line 72 of file VirtexE.hpp.

72 { return 0; }
uint32_t torc::bitstream::Bitstream::getHeaderByteLength ( void  ) const
inlineinherited

Return the bitstream header length in bytes.

Definition at line 342 of file bitstream/Bitstream.hpp.

342 { return mHeaderByteLength; }
uint32_t mHeaderByteLength
Header length in bytes.

+ Here is the caller graph for this function:

VirtexFrameBlocks torc::bitstream::Virtex::getXdlFrames ( uint32_t  inBlockCount,
uint32_t  inXdlCol 
)
inherited

Returns frames for queried xdl coordinates.

Definition at line 532 of file Virtex.cpp.

532  {
533 
534  // index and extract frames
535  int32_t xdlColumnIndex[inBlockCount];
536  int32_t xdlColumnBound[inBlockCount];
537  for(uint32_t i = 0; i < inBlockCount; i++) {
538  // column Index of given frame index
539  xdlColumnIndex[i] = mXdlColumnIndexes[i][inXdlCol];
540  // frame bounds for given column type
541  xdlColumnBound[i] =
543  }
544  // extract the tile frames for the specified FAR
545  VirtexFrameBlocks frameBlocks;
546  for(uint32_t i = 0; i < inBlockCount; i++) {
547  int startIndex = xdlColumnIndex[i];
548  for(int j = 0; j < xdlColumnBound[i]; j++)
549  frameBlocks.mBlock[i].push_back(mFrameBlocks.mBlock[i][startIndex+j]);
550  }
551  return frameBlocks;
552  }
ColumnDefVector mColumnDefs
Column type widths.
VirtexFrameBlocks mFrameBlocks
Input Frame blocks.
IndexVector mXdlColumnIndexes[Virtex::eFarBlockTypeCount]
Vector to store frame indexes of Bitstream columns.
Definition: Virtex.hpp:216
DeviceInfo mDeviceInfo
Device information.
std::map< uint32_t, uint32_t > mXdlColumnToBitColumn
Map of XDL column indexes to bitstream column indexes.
Definition: Virtex.hpp:222
FrameSet< FRAME_TYPE > mBlock[Bitstream::eBlockTypeCount]
FrameSets for each of the eight block types.
Definition: FrameSet.hpp:88
const ColumnTypeVector & getColumnTypes(void) const
Returns the column type vector.
Definition: DeviceInfo.hpp:116
boost::uint32_t uint32_t
Imported type name.
Definition: Virtex.hpp:49
FrameBlocks< VirtexFrame > VirtexFrameBlocks
Virtex frame blocks type.
Definition: FrameSet.hpp:91

+ Here is the call graph for this function:

void torc::bitstream::VirtexE::initializeDeviceInfo ( const std::string &  inDeviceName)
virtual

Initialize the device information.

Reimplemented from torc::bitstream::Virtex.

Definition at line 48 of file VirtexE.cpp.

48  {
49  using namespace torc::common;
50  switch(mDevice) {
51  case eXCV50E: setDeviceInfo(xcv50e); break;
52  case eXCV100E: setDeviceInfo(xcv100e); break;
53  case eXCV200E: setDeviceInfo(xcv200e); break;
54  case eXCV300E: setDeviceInfo(xcv300e); break;
55  case eXCV400E: setDeviceInfo(xcv400e); break;
56  case eXCV405E: setDeviceInfo(xcv405e); break;
57  case eXCV600E: setDeviceInfo(xcv600e); break;
58  case eXCV812E: setDeviceInfo(xcv812e); break;
59  case eXCV1000E: setDeviceInfo(xcv1000e); break;
60  case eXCV1600E: setDeviceInfo(xcv1600e); break;
61  case eXCV2000E: setDeviceInfo(xcv2000e); break;
62  case eXCV2600E: setDeviceInfo(xcv2600e); break;
63  case eXCV3200E: setDeviceInfo(xcv3200e); break;
64  default: break;
65  }
66  }
DeviceInfo xcv400e
DeviceInfo xcv600e
DeviceInfo xcv3200e
DeviceInfo xcv405e
EDevice mDevice
Bitstream device enumeration.
DeviceInfo xcv50e
DeviceInfo xcv2000e
DeviceInfo xcv1000e
DeviceInfo xcv812e
DeviceInfo xcv1600e
DeviceInfo xcv300e
DeviceInfo xcv200e
DeviceInfo xcv100e
void setDeviceInfo(const DeviceInfo &rhs)
Assign static device information for the current bitstream.
DeviceInfo xcv2600e

+ Here is the call graph for this function:

void torc::bitstream::VirtexE::initializeFrameMaps ( void  )
virtual

Initialize the maps between frame indexes and frame addresses. This is generally only useful for internal purposes.

Reimplemented from torc::bitstream::Virtex.

Definition at line 155 of file VirtexE.cpp.

155  {
156 
157  bool debug = 0;
158  int center = 0;
159  int frameIndex = 0;
160  int frameCount = 0;
161  int farMajor = 0;
162  int width = 0;
163  ColumnIndex col;
164  const ColumnTypeVector& columnTypes = mDeviceInfo.getColumnTypes();
165  for(uint32_t i = 0; i < VirtexE::eFarBlockTypeCount; i++) {
166  farMajor = i;
167  mFrameIndexBounds = 0;
168  EFarBlockType blockType = VirtexE::EFarBlockType(i);
169  //Set first frame index to 0
170  uint32_t bitIndex = 0;
171  uint32_t xdlIndex = 0;
172  mBitColumnIndexes[i].push_back(bitIndex);
173  mXdlColumnIndexes[i].push_back(xdlIndex);
174  uint16_t finalColumn = mDeviceInfo.getColCount()-1;
175  uint32_t xdlColumnCount = 0;
176  uint32_t bitColumnCount = 0;
177  // Clock Column at the middle
178  center = mDeviceInfo.getColCount()/2;
179  col = center;
180  prepareFrames(col, frameCount, frameIndex, blockType, farMajor, width);
181  int numBrams = 4;
182  int numIobs = 2;
183  int numClocks = 1;
184  int numClbs = mDeviceInfo.getColCount() - numClocks - numBrams - numIobs;
185  // Extended memory devices have different frame mapping
187  // CLB Columns alternate around the clock column
188  for(int j = 1; j < center; j++) {
189  for(int k = -1; k < 2; k += 2) {
190  col = center - (j * k);
191  if(columnTypes[col] == eColumnTypeClb) {
192  prepareFrames(col, frameCount, frameIndex, blockType, farMajor, width);
193  }
194  //Indexes for Bitstream Columns, only stores non-empty tile types
196  mXdlColumnToBitColumn[xdlColumnCount] = bitColumnCount;
197  bitColumnCount++;
198  bitIndex += width;
199  mBitColumnIndexes[i].push_back(bitIndex);
200  if(col == finalColumn) {
201  bitIndex += mColumnDefs[mDeviceInfo.getColumnTypes()[col]][i];
202  mBitColumnIndexes[i].push_back(bitIndex);
203  }
204  }
205  //Indexes for XDL Columns, stores interconnect and tile indexes for
206  //non-empty tiles
207  xdlIndex += width;
208  mXdlColumnIndexes[i].push_back(xdlIndex);
209  xdlColumnCount++;
210  if(col == finalColumn)
211  {
212  xdlIndex += mColumnDefs[mDeviceInfo.getColumnTypes()[col]][i];
213  mXdlColumnIndexes[i].push_back(xdlIndex);
214  }
215  }
216  }
217  // IOB Columns alternate after the CLB's
218  for(int j = center; j < (center + 1); j++) {
219  for(int k = -1; k < 2; k += 2) {
220  col = center - (j * k);
221  prepareFrames(col, frameCount, frameIndex, blockType, farMajor, width);
222  //Indexes for Bitstream Columns, only stores non-empty tile types
224  mXdlColumnToBitColumn[xdlColumnCount] = bitColumnCount;
225  bitColumnCount++;
226  bitIndex += width;
227  mBitColumnIndexes[i].push_back(bitIndex);
228  if(col == finalColumn) {
229  bitIndex += mColumnDefs[mDeviceInfo.getColumnTypes()[col]][i];
230  mBitColumnIndexes[i].push_back(bitIndex);
231  }
232  }
233  //Indexes for XDL Columns, stores interconnect and tile indexes for
234  //non-empty tiles
235  xdlIndex += width;
236  mXdlColumnIndexes[i].push_back(xdlIndex);
237  xdlColumnCount++;
238  if(col == finalColumn)
239  {
240  xdlIndex += mColumnDefs[mDeviceInfo.getColumnTypes()[col]][i];
241  mXdlColumnIndexes[i].push_back(xdlIndex);
242  }
243  }
244  }
245  // BRAM Columns alternate after the IOB's
246  for(int j = 1; j < center; j++) {
247  for(int k = -1; k < 2; k += 2) {
248  col = center - (j * k);
249  if(columnTypes[col] == eColumnTypeBram) {
250  prepareFrames(col, frameCount, frameIndex, blockType, farMajor, width);
251  }
252  //Indexes for Bitstream Columns, only stores non-empty tile types
254  mXdlColumnToBitColumn[xdlColumnCount] = bitColumnCount;
255  bitColumnCount++;
256  bitIndex += width;
257  mBitColumnIndexes[i].push_back(bitIndex);
258  if(col == finalColumn) {
259  bitIndex += mColumnDefs[mDeviceInfo.getColumnTypes()[col]][i];
260  mBitColumnIndexes[i].push_back(bitIndex);
261  }
262  }
263  //Indexes for XDL Columns, stores interconnect and tile indexes for
264  //non-empty tiles
265  xdlIndex += width;
266  mXdlColumnIndexes[i].push_back(xdlIndex);
267  xdlColumnCount++;
268  if(col == finalColumn)
269  {
270  xdlIndex += mColumnDefs[mDeviceInfo.getColumnTypes()[col]][i];
271  mXdlColumnIndexes[i].push_back(xdlIndex);
272  }
273  }
274  }
275  }
276  else {
277  // CLB and BRAM Columns alternate around the clock column
278  for(int j = 1; j <= (numClbs + numBrams) / 2; j++) {
279  for(int k = -1; k < 2; k += 2) {
280  col = center - (j * k);
281  prepareFrames(col, frameCount, frameIndex, blockType, farMajor, width);
282  //Indexes for Bitstream Columns, only stores non-empty tile types
284  mXdlColumnToBitColumn[xdlColumnCount] = bitColumnCount;
285  bitColumnCount++;
286  bitIndex += width;
287  mBitColumnIndexes[i].push_back(bitIndex);
288  if(col == finalColumn) {
289  bitIndex += mColumnDefs[mDeviceInfo.getColumnTypes()[col]][i];
290  mBitColumnIndexes[i].push_back(bitIndex);
291  }
292  }
293  //Indexes for XDL Columns, stores interconnect and tile indexes for
294  //non-empty tiles
295  xdlIndex += width;
296  mXdlColumnIndexes[i].push_back(xdlIndex);
297  xdlColumnCount++;
298  if(col == finalColumn)
299  {
300  xdlIndex += mColumnDefs[mDeviceInfo.getColumnTypes()[col]][i];
301  mXdlColumnIndexes[i].push_back(xdlIndex);
302  }
303  }
304  }
305  // IOB Columns alternate after the CLB's
306  for(int j = center; j < (center + 1); j++) {
307  for(int k = -1; k < 2; k += 2) {
308  col = center - (j * k);
309  prepareFrames(col, frameCount, frameIndex, blockType, farMajor, width);
310  //Indexes for Bitstream Columns, only stores non-empty tile types
312  mXdlColumnToBitColumn[xdlColumnCount] = bitColumnCount;
313  bitColumnCount++;
314  bitIndex += width;
315  mBitColumnIndexes[i].push_back(bitIndex);
316  if(col == finalColumn) {
317  bitIndex += mColumnDefs[mDeviceInfo.getColumnTypes()[col]][i];
318  mBitColumnIndexes[i].push_back(bitIndex);
319  }
320  }
321  //Indexes for XDL Columns, stores interconnect and tile indexes for
322  //non-empty tiles
323  xdlIndex += width;
324  mXdlColumnIndexes[i].push_back(xdlIndex);
325  xdlColumnCount++;
326  if(col == finalColumn)
327  {
328  xdlIndex += mColumnDefs[mDeviceInfo.getColumnTypes()[col]][i];
329  mXdlColumnIndexes[i].push_back(xdlIndex);
330  }
331  }
332  }
333  }
334  //stores frame index bounds for each block type
336  if(debug) std::cout << "***Block frame index bounds: " << mBlockFrameIndexBounds[i] << std::endl;
337  }
338  //Test to check proper indexing
339  if(debug) {
340  for(uint32_t i = 0; i < Virtex::eFarBlockTypeCount; i++) {
341  for(uint32_t j = 0; j < mBitColumnIndexes[i].size(); j++)
342  std::cout << "Bit Value at index: (" << i << ", " << j << ") : " << mBitColumnIndexes[i][j] << std::endl;
343  for(uint32_t k = 0; k < mXdlColumnIndexes[i].size(); k++)
344  std::cout << "Xdl Value at index: (" << i << ", " << k << ") : " << mXdlColumnIndexes[i][k] << std::endl;
345  }
346  }
347  }
ColumnDefVector mColumnDefs
Column type widths.
uint32_t mFrameIndexBounds
Frame index bounds count.
Definition: Virtex.hpp:220
IndexVector mXdlColumnIndexes[Virtex::eFarBlockTypeCount]
Vector to store frame indexes of Bitstream columns.
Definition: Virtex.hpp:216
uint16_t getColCount(void) const
Returns the column count.
Definition: DeviceInfo.hpp:114
torc::common::EncapsulatedInteger< uint16_t > ColumnIndex
Prepares the frames to load them at the correct frame indexes.
Definition: Virtex.hpp:133
void prepareFrames(ColumnIndex &inCol, int &inFrameCount, int &inFrameIndex, EFarBlockType &inBlockType, int &inFarMajor, int &inWidth)
Definition: Virtex.cpp:471
EDevice mDevice
Bitstream device enumeration.
uint32_t mBlockFrameIndexBounds[Virtex::eFarBlockTypeCount]
Array to hold frame index boundaries for blocks.
Definition: Virtex.hpp:218
IndexVector mBitColumnIndexes[Virtex::eFarBlockTypeCount]
Vector to store frame indexes of XDL columns.
Definition: Virtex.hpp:214
DeviceInfo mDeviceInfo
Device information.
std::map< uint32_t, uint32_t > mXdlColumnToBitColumn
Map of XDL column indexes to bitstream column indexes.
Definition: Virtex.hpp:222
const ColumnTypeVector & getColumnTypes(void) const
Returns the column type vector.
Definition: DeviceInfo.hpp:116
EFarBlockType
Frame Address Register block type constants.
Definition: Virtex.hpp:73
boost::uint32_t uint32_t
Imported type name.
Definition: Virtex.hpp:49
boost::uint16_t uint16_t
Imported type name.

+ Here is the call graph for this function:

void torc::bitstream::Virtex::initializeFullFrameBlocks ( void  )
inherited

Loads full bitstream frames into block data structure.

Definition at line 488 of file Virtex.cpp.

488  {
489  boost::shared_array<uint32_t> frameWords;
490  // walk the bitstream and extract all frames
491  Virtex::iterator p = begin();
492  Virtex::iterator e = end();
493  while(p < e) {
494  const VirtexPacket& packet = *p++;
495  if(packet.isType2() && packet.isWrite())
496  frameWords = packet.getWords();
497  }
498  uint32_t index = 0;
499  for(uint32_t i = 0; i < Bitstream::eBlockTypeCount; i++) {
500  // all frames of block type are extracted
501  for(uint32_t j = 0; j < mBlockFrameIndexBounds[i]; j++) {
503  (new VirtexFrame(getFrameLength(), &frameWords[index])));
504  index += getFrameLength();
505  }
506  }
507  }
VirtexFrameBlocks mFrameBlocks
Input Frame blocks.
Frame< uint32_t > VirtexFrame
Virtex frame type.
Definition: Frame.hpp:104
uint32_t mBlockFrameIndexBounds[Virtex::eFarBlockTypeCount]
Array to hold frame index boundaries for blocks.
Definition: Virtex.hpp:218
FrameSet< FRAME_TYPE > mBlock[Bitstream::eBlockTypeCount]
FrameSets for each of the eight block types.
Definition: FrameSet.hpp:88
boost::shared_ptr< VirtexFrame > FrameSharedPtr
Shared pointer encapsulation of a Frame.
Definition: FrameSet.hpp:44
boost::uint32_t uint32_t
Imported type name.
Definition: Virtex.hpp:49
virtual uint32_t getFrameLength(void) const
Return the frame length for the current device.
Definition: Virtex.hpp:181

+ Here is the call graph for this function:

iterator torc::bitstream::VirtexBitstream::insert ( iterator  position,
const value_type &  val 
)
inlineinherited

Regular std::vector inserter.

Definition at line 116 of file VirtexBitstream.hpp.

116  {
117  return VirtexPacketVector::insert(position, val);
118  }

+ Here is the caller graph for this function:

void torc::bitstream::VirtexBitstream::insert ( iterator  position,
size_type  n,
const value_type &  val 
)
inlineinherited

Regular std::vector inserter.

Definition at line 120 of file VirtexBitstream.hpp.

120  {
121  VirtexPacketVector::insert(position, n, val);
122  }
template<class InputIterator >
void torc::bitstream::VirtexBitstream::insert ( iterator  position,
InputIterator  first,
InputIterator  last 
)
inlineinherited

Regular std::vector inserter.

Definition at line 124 of file VirtexBitstream.hpp.

125  {
126  VirtexPacketVector::insert(position, first, last);
127  }
void torc::bitstream::VirtexBitstream::insert ( VirtexPacketVector::iterator  inPosition,
const VirtexPacketVector inVector 
)
inlineinherited

Insert the contents of a packet vector at the specified position.

Definition at line 129 of file VirtexBitstream.hpp.

130  {
131  VirtexPacketVector::insert(inPosition, inVector.begin(), inVector.end());
132  }
uint32_t torc::bitstream::Virtex::makeSubfield ( ERegister  inRegister,
const std::string &  inSubfield,
const std::string &  inSetting 
)
staticinherited

Return the masked value for a subfield of the specified register.

Definition at line 203 of file Virtex.cpp.

204  {
205  const Subfield* subfields;
206  switch(inRegister) {
207  case eRegisterCOR: subfields = sCOR; break;
208  case eRegisterSTAT: subfields = sSTAT; break;
209  case eRegisterCTL: subfields = sCTL; break;
210  case eRegisterMASK: subfields = sMASK; break;
211  default: return 0;
212  }
213  for(uint32_t field = 0; subfields[field].mMask != 0; field++) {
214  const Subfield& subfield = subfields[field];
215  if(inSubfield != subfield.mBitgenName && inSubfield != subfield.mConfigGuideName)
216  continue;
217  const char** ptr = subfield.mValues;
218  for(uint32_t i = 0; *ptr != 0; i++, ptr++) {
219  if(inSetting == *ptr) return (i << subfield.mShift) & subfield.mMask;
220  }
221  }
222  return 0;
223  }
static const Subfield sCOR[]
Configuration Options Register (COR) subfields.
Definition: Virtex.hpp:93
static const Subfield sMASK[]
Control Mask Register (MASK) subfields.
Definition: Virtex.hpp:99
static const Subfield sSTAT[]
Status Register (STAT) subfields.
Definition: Virtex.hpp:95
boost::uint32_t uint32_t
Imported type name.
Definition: Virtex.hpp:49
static const Subfield sCTL[]
Control Register (CTL) subfields.
Definition: Virtex.hpp:97
const char ** mValues
The allowable subfield values.
void torc::bitstream::VirtexBitstream::preflightPackets ( void  )
virtualinherited

Preflight the packets.

Reimplemented from torc::bitstream::Bitstream.

Definition at line 493 of file VirtexBitstream.cpp.

493  {
494  // determine which architecture this is
495  DeviceDesignator deviceDesignator(getDeviceName());
496  DeviceDesignator::EFamily family = deviceDesignator.getFamily();
497  switch(family) {
500  updateCrc16(family); break;
504  case DeviceDesignator::eFamilyZynq7000: default:
505  updateCrc32(family); break;
506  }
507  }
Encapsulation of a device designator and its constituent elements.
const string & getDeviceName(void) const
Return the device name.
virtual void updateCrc32(torc::common::DeviceDesignator::EFamily inFamily)
Update CRC-32 packets.
virtual void updateCrc16(torc::common::DeviceDesignator::EFamily inFamily)
Update CRC-16 packets.

+ Here is the call graph for this function:

void torc::bitstream::Virtex::prepareFrames ( ColumnIndex inCol,
int &  inFrameCount,
int &  inFrameIndex,
EFarBlockType inBlockType,
int &  inFarMajor,
int &  inWidth 
)
inherited

Definition at line 471 of file Virtex.cpp.

471  {
472  inWidth = mColumnDefs[mDeviceInfo.getColumnTypes()[inCol]][inBlockType];
473  if(inWidth == 0) return;
474  inFrameCount += inWidth;
475  for(int farMinor = 0; farMinor < inWidth; farMinor++) {
476  Virtex::FrameAddress far(inBlockType, inFarMajor, farMinor);
477  //std::cout << inBlockType << "(" << inFarMajor << "," << farMinor << ")" << std::endl;
478  mFrameIndexToAddress[inFrameIndex] = far;
479  mFrameAddressToIndex[far] = inFrameIndex;
480  inFrameIndex++;
482  }
483  if(inWidth > 0) inFarMajor++;
484  return;
485  }
ColumnDefVector mColumnDefs
Column type widths.
uint32_t mFrameIndexBounds
Frame index bounds count.
Definition: Virtex.hpp:220
FrameAddressToIndex mFrameAddressToIndex
Map of frame addressee to frame indexes.
Definition: Virtex.hpp:212
DeviceInfo mDeviceInfo
Device information.
const ColumnTypeVector & getColumnTypes(void) const
Returns the column type vector.
Definition: DeviceInfo.hpp:116
FrameIndexToAddress mFrameIndexToAddress
Map of frame indexes to frame addresses.
Definition: Virtex.hpp:210

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void torc::bitstream::Bitstream::read ( std::istream &  inStream,
bool  inCleanDateAndTime = true 
)
inlinevirtualinherited

Read the bitstream header and packets from a stream.

Definition at line 266 of file bitstream/Bitstream.hpp.

266  {
267  readHeader(inStream);
268  readPackets(inStream);
269  if(inCleanDateAndTime) cleanDateAndTime();
270  }
static bool readHeader(std::istream &inStream, string &outDesignName, string &outDeviceName, string &outDesignDate, string &outDesignTime, uint32_t &outBitstreamLength, uint32_t &outHeaderLength)
Read a bitstream header, and return its fields.
void cleanDateAndTime(void)
Clean up the header date and time by replacing embedded spaces with zeros.
virtual void readPackets(std::istream &inStream)
Read the bitstream packets.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::bitstream::VirtexBitstream::readFramePackets ( void  )
virtualinherited

Read frame data into the frame blocks structure.

Reimplemented in torc::bitstream::Virtex7, torc::bitstream::Virtex6, torc::bitstream::Virtex5, and torc::bitstream::Virtex4.

Definition at line 83 of file VirtexBitstream.cpp.

83  {
84  unimplemented("readFramePackets(void)");
85  }
void unimplemented(std::string inName)
Reports the named function as not yet implemented in the current architecture.
template<class ARCH >
void torc::bitstream::VirtexBitstream::readFramePackets4567 ( uint32_t  inBlockFrameIndexBounds[],
std::map< typename ARCH::FrameAddress, uint32_t > &  inFrameAddressToIndex,
std::map< uint32_t, typename ARCH::FrameAddress > &  inFrameIndexToAddress 
)
protectedinherited

Read frame packets in for Virtex4/5/6/7 devices.

Todo:

Definition at line 101 of file VirtexBitstream.cpp.

104  {
105  // clean up the template parameters
106  typedef typename ARCH::FrameAddress FrameAddress;
107  typedef std::map<FrameAddress, uint32_t> FrameAddressToIndex;
108  typedef std::map<uint32_t, FrameAddress> FrameIndexToAddress;
109  // declare a shared word array
110  boost::shared_array<uint32_t> frameWords;
111  // precalculate the start indexes of all blocks, and create all possible frames
112  uint32_t frameStart[eBlockTypeCount + 1];
113  frameStart[0] = 0;
114  VirtexFrame frame(ARCH::eFrameLength);
115  for(int i = 0; i < eBlockTypeCount; i++) {
116  frameStart[i + 1] = frameStart[i] + inBlockFrameIndexBounds[i];
117  // clear any existing frames
118  mFrameBlocks.mBlock[i].clear();
119  // populate the block with the correct number of empty frames
120  for(uint32_t j = 0; j < inBlockFrameIndexBounds[i]; j++) {
122  (new VirtexFrame(getFrameLength())));
123  mFrameBlocks.mBlock[i].back()->setUsed(false);
124  }
125  }
126  // walk the bitstream and extract all frames
127  const uint32_t frameLength = getFrameLength();
128  uint32_t frameIndex = 0;
129  FrameAddress frameAddress;
130  typename ARCH::ERegister lastAddress = typename ARCH::ERegister();
131  typename ARCH::iterator p = begin();
132  typename ARCH::iterator e = end();
133  while(p < e) {
134  const VirtexPacket& packet = *p++;
135  // process FAR write packets
136  if(packet.isWrite() && packet.getAddress() == ARCH::eRegisterFAR) {
137  // extract the new frame address
138  frameAddress = typename ARCH::FrameAddress(packet[1]);
139  // convert the frame address to the corresponding frame index
140  typename FrameAddressToIndex::iterator ip
141  = inFrameAddressToIndex.find(frameAddress);
142  if(ip != inFrameAddressToIndex.end()) frameIndex = ip->second;
143  }
144  // process FDRI write packets
145  else if(packet.isWrite()
146  && (
147  // this is a Type 2 packet and the prior Type 1 address was FDRI
148  (packet.isType2() && lastAddress == ARCH::eRegisterFDRI)
149  ||
150  // this is a non-empty Type 1 packet and its address is FDRI
151  (packet.isType1() && packet.getAddress() == ARCH::eRegisterFDRI
152  && packet.getWordCount() > 0)
153  )) {
154  // determine the number of frames in the packet and look up the frame words
155  const uint32_t numWords = packet.getWordCount();
156  boost::shared_array<uint32_t> frameWords(packet.getWords());
157  uint32_t position = 0;
158  // iterate over every frame in the packet
159  while(position + frameLength <= numWords) {
160  // look up the current block type and the frame index into that block type
161  typename ARCH::EFarBlockType blockType = frameAddress.mBlockType;
162  uint32_t index = frameIndex - frameStart[blockType];
164  (new VirtexFrame(frameLength, &frameWords[position]));
165  mFrameBlocks.mBlock[blockType][index]->setUsed();
166  position += frameLength;
167  frameIndex++;
168  typename FrameIndexToAddress::iterator ap
169  = inFrameIndexToAddress.find(frameIndex);
170  if(ap != inFrameIndexToAddress.end()) frameAddress = ap->second;
171  // sanity escape exit (which also breaks out of the higher level loop)
172  if(position > numWords) {
173  std::cerr << "Overflowed expected frame counts for device." << std::endl;
174  break;
175  }
176  }
177  if(frameIndex != frameStart[frameAddress.mBlockType + 1]) {
178  // if we ended on a pad frame, where the current index has no corresponding
179  // frame address, we need to advance to the next valid frame address
180  if(inFrameIndexToAddress.find(frameIndex) == inFrameIndexToAddress.end())
181  frameIndex++;
182  if(inFrameIndexToAddress.find(frameIndex) == inFrameIndexToAddress.end())
183  frameIndex++;
184  // at this point we should again be on a valid frame
185  typename FrameIndexToAddress::iterator ap
186  = inFrameIndexToAddress.find(frameIndex);
187  if(ap != inFrameIndexToAddress.end()) frameAddress = ap->second;
188  else if(frameIndex == frameStart[frameAddress.mBlockType + 1]) /* at end */;
189  else {
190  std::cerr << "Failed to find the next valid frame address at the end of a "
191  "packet." << std::endl;
192  }
193  }
194  }
195  // remember the last register address for Type 2 packets
196  if(packet.isType1()) lastAddress = typename ARCH::ERegister(packet.getAddress());
197  // process MFWR write packets
198  /// \todo
199  }
200  }
VirtexFrameBlocks mFrameBlocks
Input Frame blocks.
Frame< uint32_t > VirtexFrame
Virtex frame type.
Definition: Frame.hpp:104
boost::uint32_t uint32_t
Imported type name.
FrameSet< FRAME_TYPE > mBlock[Bitstream::eBlockTypeCount]
FrameSets for each of the eight block types.
Definition: FrameSet.hpp:88
boost::shared_ptr< VirtexFrame > FrameSharedPtr
Shared pointer encapsulation of a Frame.
Definition: FrameSet.hpp:44
virtual uint32_t getFrameLength(void) const
Return the frame length for the current device.

+ Here is the call graph for this function:

static bool torc::bitstream::Bitstream::readHeader ( std::istream &  inStream,
string outDesignName,
string outDeviceName,
string outDesignDate,
string outDesignTime,
uint32_t outBitstreamLength,
uint32_t outHeaderLength 
)
inlinestaticinherited

Read a bitstream header, and return its fields.

Definition at line 142 of file bitstream/Bitstream.hpp.

144  {
145  // assume success unless we find otherwise
146  bool success = true;
147  // read the magic length
148  success &= expect(inStream, uint16_t(0x0009));
149  // read the magic bytes
150  success &= expect(inStream, uint32_t(0x0ff00ff0));
151  success &= expect(inStream, uint32_t(0x0ff00ff0));
152  success &= expect(inStream, uint8_t(0x00));
153  // read the mysterious 0x0001
154  success &= expect(inStream, uint16_t(0x0001));
155  // read the 'a' byte
156  success &= expect(inStream, uint8_t('a'));
157  // read the design name length
158  readHeaderString(inStream, outDesignName);
159  // read the 'b' byte
160  success &= expect(inStream, uint8_t('b'));
161  // read the device name length
162  readHeaderString(inStream, outDeviceName);
163  // read the 'c' byte
164  success &= expect(inStream, uint8_t('c'));
165  // read the design date length
166  readHeaderString(inStream, outDesignDate);
167  // read the 'd' byte
168  success &= expect(inStream, uint8_t('d'));
169  // read the design time length
170  readHeaderString(inStream, outDesignTime);
171  // read the 'e' byte
172  success &= expect(inStream, uint8_t('e'));
173  // read the inStream length
174  inStream.read((char*) &outBitstreamLength, sizeof(outBitstreamLength));
175  outBitstreamLength = ntohl(outBitstreamLength);
176  // determine the header length
177  outHeaderLength = 34 + outDesignName.length() + outDeviceName.length()
178  + outDesignDate.length() + outDesignTime.length();
179  // return the result
180  return success;
181  }
boost::uint8_t uint8_t
Imported type name.
static bool expect(std::istream &inStream, uint8_t inExpected)
Look for the expected uint8_t in the stream and return true if it matches.
boost::uint32_t uint32_t
Imported type name.
static void readHeaderString(std::istream &inStream, string &outString)
Read and return a bitstream header string.
boost::uint16_t uint16_t
Imported type name.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void torc::bitstream::Bitstream::readHeader ( std::istream &  inStream)
inlinevirtualinherited

Read the bitstream header.

Definition at line 274 of file bitstream/Bitstream.hpp.

274  {
278  }
static bool readHeader(std::istream &inStream, string &outDesignName, string &outDeviceName, string &outDesignDate, string &outDesignTime, uint32_t &outBitstreamLength, uint32_t &outHeaderLength)
Read a bitstream header, and return its fields.
string mDesignDate
Header design date.
string mDesignTime
Header design time.
string mDesignName
Header design name.
string mDeviceName
Header device name.
uint32_t mBitstreamByteLength
Bitstream packet length in bytes.
void setDevice(const std::string &inDeviceName)
Assign the device enumeration constant for the given device name.
uint32_t mHeaderByteLength
Header length in bytes.

+ Here is the call graph for this function:

static void torc::bitstream::Bitstream::readHeaderString ( std::istream &  inStream,
string outString 
)
inlinestaticinherited

Read and return a bitstream header string.

Definition at line 124 of file bitstream/Bitstream.hpp.

124  {
125  // read the string length
126  uint16_t length = 0;
127  inStream.read((char*) &length, sizeof(length));
128  length = ntohs(length);
129  if(length > 0) {
130  // create a buffer
131  char* buffer = new char[length];
132  // read the null-terminated string
133  inStream.read(buffer, length);
134  // copy the data into the string
135  outString.assign(buffer, length - 1);
136  delete[] buffer;
137  } else {
138  outString.clear();
139  }
140  }
boost::uint16_t uint16_t
Imported type name.

+ Here is the caller graph for this function:

void torc::bitstream::VirtexBitstream::readPackets ( std::istream &  inStream)
virtualinherited

Read bitstream packets from a stream.

Note
This function should be called after the bitstream header has been read.

Reimplemented from torc::bitstream::Bitstream.

Reimplemented in torc::bitstream::Virtex2.

Definition at line 31 of file VirtexBitstream.cpp.

31  {
32  uint32_t bitstreamWordLength = mBitstreamByteLength >> 2;
33  uint32_t cumulativeWordLength = 0;
34  while(cumulativeWordLength < bitstreamWordLength) {
35  push_back(VirtexPacket::read(inStream));
36  cumulativeWordLength += back().getWordSize();
37  }
38  }
boost::uint32_t uint32_t
Imported type name.
uint32_t mBitstreamByteLength
Bitstream packet length in bytes.
static VirtexPacket read(std::istream &inStream)
Read a packet.
void torc::bitstream::Bitstream::setDesignDate ( const string inDesignDate)
inlineinherited

Set the design date.

Definition at line 327 of file bitstream/Bitstream.hpp.

327 { mDesignDate = inDesignDate; }
string mDesignDate
Header design date.

+ Here is the caller graph for this function:

void torc::bitstream::Bitstream::setDesignName ( const string inDesignName)
inlineinherited

Set the design name.

Definition at line 323 of file bitstream/Bitstream.hpp.

323 { mDesignName = inDesignName; }
string mDesignName
Header design name.

+ Here is the caller graph for this function:

void torc::bitstream::Bitstream::setDesignTime ( const string inDesignTime)
inlineinherited

Set the design time.

Definition at line 329 of file bitstream/Bitstream.hpp.

329 { mDesignTime = inDesignTime; }
string mDesignTime
Header design time.

+ Here is the caller graph for this function:

void torc::bitstream::Bitstream::setDevice ( const std::string &  inDeviceName)
inlineinherited

Assign the device enumeration constant for the given device name.

Definition at line 225 of file bitstream/Bitstream.hpp.

225  {
227  }
static EDevice getDeviceEnum(const string &inName)
Returns the device enumeration corresponding to the given device name.
Definition: Devices.hpp:216
EDevice mDevice
Bitstream device enumeration.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::bitstream::Bitstream::setDeviceInfo ( const DeviceInfo rhs)
inlineinherited

Assign static device information for the current bitstream.

Definition at line 223 of file bitstream/Bitstream.hpp.

223 { mDeviceInfo = rhs; }
DeviceInfo mDeviceInfo
Device information.

+ Here is the caller graph for this function:

void torc::bitstream::Bitstream::setDeviceName ( const string inDeviceName)
inlineinherited

Set the device name.

Definition at line 325 of file bitstream/Bitstream.hpp.

325 { mDeviceName = inDeviceName; }
string mDeviceName
Header device name.

+ Here is the caller graph for this function:

void torc::bitstream::VirtexBitstream::unimplemented ( std::string  inName)
protectedinherited

Reports the named function as not yet implemented in the current architecture.

Definition at line 79 of file VirtexBitstream.cpp.

79  {
80  std::cerr << inName << " is not yet implemented for this architecture." << std::endl;
81  }
void torc::bitstream::VirtexBitstream::updateCrc16 ( torc::common::DeviceDesignator::EFamily  inFamily)
protectedvirtualinherited

Update CRC-16 packets.

Definition at line 509 of file VirtexBitstream.cpp.

509  {
510  // set up family-specific variables
511  uint32_t crcRegister = 0;
512  uint32_t cmdRegister = 0;
513  uint32_t fdriRegister = 0;
514  uint32_t rcrcCommand = 0;
515  uint32_t addressLength = 0;
516  bool autoCrc = false;
517  switch(inFamily) {
519  cmdRegister = Virtex::eRegisterCMD; rcrcCommand = Virtex::eCommandRCRC;
520  fdriRegister = Virtex::eRegisterFDRI; crcRegister = Virtex::eRegisterCRC;
521  addressLength = 4; autoCrc = false;
522  break;
524  cmdRegister = Virtex2::eRegisterCMD; rcrcCommand = Virtex2::eCommandRCRC;
525  fdriRegister = Virtex2::eRegisterFDRI; crcRegister = Virtex::eRegisterCRC;
526  addressLength = 5; autoCrc = true;
527  break;
528  default:
529  std::cerr << "Unsupported architecture in VirtexBitstream::updateCrc16()." << std::endl;
530  break;
531  }
532  // begin CRC calculation
533  uint32_t address = 0;
534  iterator p = begin();
535  iterator e = end();
536  // CRC-16-IBM polynomial for Spartan3/6 and Virtex/E/2/2P families
537  boost::crc_basic<16> crc16(0x8005, 0, 0, false, true);
538  while(p < e) {
539  // look up the current packet
540  const VirtexPacket& packet = *p++;
541  // only process write packets with non-zero payload length
542  if(!packet.isWrite()) continue;
543  if(packet.isType1()) address = packet.getAddress();
544  uint32_t wordCount = packet.getWordCount();
545  if(wordCount == 0) continue;
546  // CRC register write (this is what compares the expected and supplied CRC values)
547  if(address == crcRegister) {
548  //printf("Expected CRC16: %4.4x\n", packet[1]);
549  //printf("Calculated CRC16: %4.4x\n", crc16.checksum());
550  *(p-1) = VirtexPacket::makeType1Write(crcRegister, crc16.checksum());
551  crc16.reset();
552  // reset CRC command
553  } else if(address == cmdRegister && wordCount >= 1 && packet[1] == rcrcCommand) {
554  crc16.reset();
555  // process packet contents
556  } else {
557  uint32_t j;
558  uint32_t mask;
559  for(uint32_t i = 1; i <= wordCount; i++) {
560  uint32_t word = packet[i];
561  //printf("Address: %4.4x\n", address);
562  //printf("Word: %8.8x\n", word);
563  for(j = 0, mask = 1; j < 32; j++, mask <<= 1) {
564  crc16.process_bit((word & mask) ? 1 : 0);
565  }
566  for(j = 0, mask = 1; j < addressLength; j++, mask <<= 1) {
567  crc16.process_bit((address & mask) ? 1 : 0);
568  }
569  }
570  // process the Auto CRC on Virtex2 and Virtex2P
571  if(autoCrc && address == fdriRegister) {
572  //printf("Expected Auto CRC16: %4.4x\n", packet[1]);
573  //printf("Calculated Auto CRC16: %4.4x\n", crc16.checksum());
574  *p = VirtexPacket(crc16.checksum()); // current word is FDRI, next is Auto CRC
575  crc16.reset();
576  }
577  }
578  }
579  }
boost::uint32_t uint32_t
Imported type name.
static VirtexPacket makeType1Write(uint32_t inAddress, uint32_t inWord)
Construct a type 1 write packet.

+ Here is the call graph for this function:

void torc::bitstream::VirtexBitstream::updateCrc32 ( torc::common::DeviceDesignator::EFamily  inFamily)
protectedvirtualinherited

Update CRC-32 packets.

Definition at line 581 of file VirtexBitstream.cpp.

581  {
582  // set up family-specific variables
583  uint32_t crcRegister = 0;
584  uint32_t cmdRegister = 0;
585  uint32_t rcrcCommand = 0;
586  uint32_t addressLength = 5;
587  switch(inFamily) {
589  cmdRegister = Virtex4::eRegisterCMD; rcrcCommand = Virtex4::eCommandRCRC;
590  crcRegister = Virtex4::eRegisterCRC;
591  break;
593  cmdRegister = Virtex5::eRegisterCMD; rcrcCommand = Virtex5::eCommandRCRC;
594  crcRegister = Virtex5::eRegisterCRC;
595  break;
597  cmdRegister = Virtex6::eRegisterCMD; rcrcCommand = Virtex6::eCommandRCRC;
598  crcRegister = Virtex6::eRegisterCRC;
599  break;
602  cmdRegister = Virtex7::eRegisterCMD; rcrcCommand = Virtex7::eCommandRCRC;
603  crcRegister = Virtex7::eRegisterCRC;
604  break;
605  default:
606  std::cerr << "Unsupported architecture in VirtexBitstream::updateCrc32()." << std::endl;
607  break;
608  }
609  // begin CRC calculation
610  uint32_t address = 0;
611  iterator p = begin();
612  iterator e = end();
613  // CRC-32C (Castagnoli) polynomial for Virtex4/5/6/7 families
614  boost::crc_basic<32> crc32(0x1edc6f41, 0, 0, false, true);
615  while(p < e) {
616  // look up the current packet
617  const VirtexPacket& packet = *p++;
618  // only process write packets with non-zero payload length
619  if(!packet.isWrite()) continue;
620  if(packet.isType1()) address = packet.getAddress();
621  uint32_t wordCount = packet.getWordCount();
622  if(wordCount == 0) continue;
623  // CRC register write (this is what compares the expected and supplied CRC values)
624  if(address == crcRegister) {
625  //printf("Expected CRC32: %8.8x\n", packet[1]);
626  //printf("Calculated CRC32: %8.8x\n", crc32.checksum());
627  *(p-1) = VirtexPacket::makeType1Write(crcRegister, crc32.checksum());
628  crc32.reset();
629  // reset CRC command
630  } else if(address == cmdRegister && wordCount >= 1 && packet[1] == rcrcCommand) {
631  crc32.reset();
632  // process packet contents
633  } else {
634  uint32_t j;
635  uint32_t mask;
636  for(uint32_t i = 1; i <= wordCount; i++) {
637  uint32_t word = packet[i];
638  //printf("Address: %4.4x\n", address);
639  //printf("Word: %8.8x\n", word);
640  for(j = 0, mask = 1; j < 32; j++, mask <<= 1) {
641  crc32.process_bit((word & mask) ? 1 : 0);
642  }
643  for(j = 0, mask = 1; j < addressLength; j++, mask <<= 1) {
644  crc32.process_bit((address & mask) ? 1 : 0);
645  }
646  }
647  }
648  }
649  }
boost::uint32_t uint32_t
Imported type name.
static VirtexPacket makeType1Write(uint32_t inAddress, uint32_t inWord)
Construct a type 1 write packet.

+ Here is the call graph for this function:

void torc::bitstream::VirtexBitstream::updateFramePackets ( EBitstreamType  inBitstreamType = eBitstreamTypeFull,
EFrameInclude  inFrameInclusion = eFrameIncludeAllUsedFrames 
)
virtualinherited

Update the bitstream frame packets By default this updates the bitstream with full frame data.

Parameters
inBitstreamTypeThe type of bitstream to generate: full or partial.
inFrameInclusionThe type of frames to include in partial bitstreams: only dirty frames or all frames.

Definition at line 46 of file VirtexBitstream.cpp.

47  {
48  // delete the existing frame packets
49  iterator position = deleteFramePackets();
50  // insert the new frame packets in place of the old ones
51  if(inBitstreamType == eBitstreamTypeFull) {
53  } else {
54  insert(position, generatePartialBitstreamPackets(inFrameInclusion));
55  }
56  }
virtual VirtexPacketVector generatePartialBitstreamPackets(EFrameInclude inFrameInclusion)
Return a packet vector with partial frame data.
iterator insert(iterator position, const value_type &val)
Regular std::vector inserter.
virtual VirtexPacketVector::iterator deleteFramePackets(void)
Discard the existing frame packets and return an iterator to the start position.
virtual VirtexPacketVector generateFullBitstreamPackets(void)
Return a packet vector with full frame data.

+ Here is the caller graph for this function:

void torc::bitstream::VirtexBitstream::updatePacketLength ( void  )
virtualinherited

Update the header packet length.

Reimplemented from torc::bitstream::Bitstream.

Definition at line 651 of file VirtexBitstream.cpp.

651  {
652  uint32_t totalWordCount = 0;
653  iterator p = begin();
654  iterator e = end();
655  while(p < e) totalWordCount += (p++)->getWordSize();
656  mBitstreamByteLength = totalWordCount << 2;
657  }
boost::uint32_t uint32_t
Imported type name.
uint32_t mBitstreamByteLength
Bitstream packet length in bytes.
void torc::bitstream::Bitstream::write ( std::ostream &  inStream,
uint8_t  inVal 
)
inlineinherited

Write a uint8_t to the stream.

Definition at line 67 of file bitstream/Bitstream.hpp.

67  {
68  uint8_t actual = inVal;
69  inStream.write((char*) &actual, sizeof(actual));
70  }
boost::uint8_t uint8_t
Imported type name.

+ Here is the caller graph for this function:

void torc::bitstream::Bitstream::write ( std::ostream &  inStream,
uint16_t  inVal 
)
inlineinherited

Write a uint16_t to the stream.

Definition at line 72 of file bitstream/Bitstream.hpp.

72  {
73  uint16_t actual = htons(inVal);
74  inStream.write((char*) &actual, sizeof(actual));
75  }
boost::uint16_t uint16_t
Imported type name.
void torc::bitstream::Bitstream::write ( std::ostream &  inStream,
uint32_t  inVal 
)
inlineinherited

Write a uint32_t to the stream.

Definition at line 77 of file bitstream/Bitstream.hpp.

77  {
78  uint32_t actual = htonl(inVal);
79  inStream.write((char*) &actual, sizeof(actual));
80  }
boost::uint32_t uint32_t
Imported type name.
virtual void torc::bitstream::Bitstream::write ( std::ostream &  inStream)
inlinevirtualinherited

Write the bitstream header and packets to a stream.

Definition at line 280 of file bitstream/Bitstream.hpp.

280  {
283  writeHeader(inStream);
284  writePackets(inStream);
285  }
virtual void updatePacketLength(void)
Update the header packet length.
virtual void preflightPackets(void)
Preflight the packets.
virtual void writeHeader(std::ostream &inStream)
Write the bitstream header to the stream.
virtual void writePackets(std::ostream &inStream)
Write the bitstream packets.

+ Here is the call graph for this function:

void torc::bitstream::Bitstream::writeDeviceInfo ( std::ostream &  inStream,
const std::string &  inDeviceName 
)
virtualinherited

Output static device information to a stream.

This is used to generate the static column maps for bitstream frame mapping.

Definition at line 74 of file Bitstream.cpp.

75  {
76  // write the device column composition
77  inStream << "\t// " << inDeviceName << " static device information." << std::endl;
78  inStream << "\tboost::uint32_t " << inDeviceName << "Columns[] = { ";
79  ColumnTypeVector::const_iterator p = mDeviceInfo.getColumnTypes().begin();
80  ColumnTypeVector::const_iterator e = mDeviceInfo.getColumnTypes().end();
81  while(p < e) inStream << mColumnDefs[*p++].getName() << ", ";
82  inStream << "END };" << std::endl;
83  // instantiate the device information
84  inStream << "\tDeviceInfo " << inDeviceName << "(" << mDeviceInfo.getTileCount() << ", "
85  << mDeviceInfo.getRowCount() << ", " << mDeviceInfo.getColCount() << ", "
86  << inDeviceName << "Columns);" << std::endl;
87  }
ColumnDefVector mColumnDefs
Column type widths.
uint16_t getRowCount(void) const
Returns the row count.
Definition: DeviceInfo.hpp:112
uint16_t getColCount(void) const
Returns the column count.
Definition: DeviceInfo.hpp:114
DeviceInfo mDeviceInfo
Device information.
const ColumnTypeVector & getColumnTypes(void) const
Returns the column type vector.
Definition: DeviceInfo.hpp:116
uint32_t getTileCount(void) const
Returns the tile count.
Definition: DeviceInfo.hpp:110

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void torc::bitstream::Bitstream::writeHeader ( std::ostream &  inStream)
inlinevirtualinherited

Write the bitstream header to the stream.

Definition at line 293 of file bitstream/Bitstream.hpp.

293  {
294  // write the magic length
295  write(inStream, uint16_t(0x0009));
296  // write the magic bytes with null termination
297  write(inStream, uint32_t(0x0ff00ff0));
298  write(inStream, uint32_t(0x0ff00ff0));
299  write(inStream, uint8_t(0x00));
300  // write the mysterious 0x0001
301  write(inStream, uint16_t(0x0001));
302  // write the 'a' byte and the design name
303  write(inStream, uint8_t('a'));
304  writeHeaderString(inStream, mDesignName);
305  // write the 'b' byte and the device name
306  write(inStream, uint8_t('b'));
307  writeHeaderString(inStream, mDeviceName);
308  // write the 'c' byte and the design date
309  write(inStream, uint8_t('c'));
310  writeHeaderString(inStream, mDesignDate);
311  // write the 'd' byte and the design time
312  write(inStream, uint8_t('d'));
313  writeHeaderString(inStream, mDesignTime);
314  // write the 'e' byte and the design name
315  write(inStream, uint8_t('e'));
316  write(inStream, uint32_t(mBitstreamByteLength));
317  }
void writeHeaderString(std::ostream &inStream, const string &inString)
Write a Xilinx-style header string to the stream.
string mDesignDate
Header design date.
string mDesignTime
Header design time.
string mDesignName
Header design name.
boost::uint8_t uint8_t
Imported type name.
boost::uint32_t uint32_t
Imported type name.
string mDeviceName
Header device name.
uint32_t mBitstreamByteLength
Bitstream packet length in bytes.
void write(std::ostream &inStream, uint8_t inVal)
Write a uint8_t to the stream.
boost::uint16_t uint16_t
Imported type name.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::bitstream::Bitstream::writeHeaderString ( std::ostream &  inStream,
const string inString 
)
inlineinherited

Write a Xilinx-style header string to the stream.

Definition at line 82 of file bitstream/Bitstream.hpp.

82  {
83  // write the string length
84  uint16_t length = inString.length() + 1;
85  write(inStream, uint16_t(length));
86  inStream.write(inString.c_str(), length);
87  }
void write(std::ostream &inStream, uint8_t inVal)
Write a uint8_t to the stream.
boost::uint16_t uint16_t
Imported type name.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::bitstream::VirtexBitstream::writePackets ( std::ostream &  inStream)
virtualinherited

Write bitstream packets to a stream.

Reimplemented from torc::bitstream::Bitstream.

Definition at line 40 of file VirtexBitstream.cpp.

40  {
41  const_iterator p = begin();
42  const_iterator e = end();
43  while(p < e) p++->write(inStream);
44  }
void torc::bitstream::Bitstream::writeSubfieldSettings ( std::ostream &  inStream,
uint32_t  inWord,
const Subfield inSubfields 
)
staticinherited

Insert 32 bit subfield settings into an output stream.

Definition at line 26 of file Bitstream.cpp.

27  {
28  // count the subfields
29  int subfieldCount = 0;
30  while(inSubfields[subfieldCount].mMask) subfieldCount++;
31  // generate the output
32  inStream << " (";
33  for(int index = subfieldCount; index > 0; index--) {
34  uint32_t field = index - 1;
35  const Subfield& subfield = inSubfields[field];
36  uint32_t value = (inWord & subfield.mMask) >> subfield.mShift;
37  inStream << (*subfield.mBitgenName == 0 ? subfield.mConfigGuideName
38  : subfield.mBitgenName) << ":";
39  const char** ptr = subfield.mValues;
40  for(uint32_t i = 0; ; i++) {
41  if(*ptr == 0) { inStream << "[UNKNOWN " << i << "]"; break; }
42  if(value == i) { inStream << *ptr; break; }
43  ptr++;
44  }
45  if(index > 1) inStream << ", ";
46  }
47  inStream << ")";
48  }
boost::uint32_t uint32_t
Imported type name.

+ Here is the caller graph for this function:

void torc::bitstream::Bitstream::writeSubfieldSettings ( std::ostream &  inStream,
uint16_t  inWord,
const Subfield inSubfields 
)
staticinherited

Insert 16 bit subfield settings into an output stream.

Definition at line 50 of file Bitstream.cpp.

51  {
52  // count the subfields
53  int subfieldCount = 0;
54  while(inSubfields[subfieldCount].mMask) subfieldCount++;
55  // generate the output
56  inStream << " (";
57  for(int index = subfieldCount; index > 0; index--) {
58  uint16_t field = index - 1;
59  const Subfield& subfield = inSubfields[field];
60  uint16_t value = (inWord & subfield.mMask) >> subfield.mShift;
61  inStream << (*subfield.mBitgenName == 0 ? subfield.mConfigGuideName
62  : subfield.mBitgenName) << ":";
63  const char** ptr = subfield.mValues;
64  for(uint16_t i = 0; ; i++) {
65  if(*ptr == 0) { inStream << "[UNKNOWN " << i << "]"; break; }
66  if(value == i) { inStream << *ptr; break; }
67  ptr++;
68  }
69  if(index > 1) inStream << ", ";
70  }
71  inStream << ")";
72  }
boost::uint16_t uint16_t
Imported type name.

Friends And Related Function Documentation

void torc::bitstream::bitstream::testVirtexEDevice ( const std::string &  inDeviceName,
const boost::filesystem::path &  inWorkingPath 
)
friend
void torc::bitstream::bitstream::testVirtexEFullMapping ( const boost::filesystem::path &  inWorkingPath)
friend
friend class torc::bitstream::bitstream::VirtexEFarUnitTest
friend

Definition at line 39 of file VirtexE.hpp.

friend class torc::bitstream::bitstream::VirtexEUnitTest
friend

Definition at line 38 of file VirtexE.hpp.

Field Documentation

IndexVector torc::bitstream::Virtex::mBitColumnIndexes[Virtex::eFarBlockTypeCount]
protectedinherited

Vector to store frame indexes of XDL columns.

Definition at line 214 of file Virtex.hpp.

uint32_t torc::bitstream::Bitstream::mBitstreamByteLength
inherited

Bitstream packet length in bytes.

This is the length in bytes of all the bitstream packets, without the bitstream header.

Definition at line 242 of file bitstream/Bitstream.hpp.

FrameSets for each of the eight block types.

Definition at line 88 of file FrameSet.hpp.

uint32_t torc::bitstream::Virtex::mBlockFrameIndexBounds[Virtex::eFarBlockTypeCount]
protectedinherited

Array to hold frame index boundaries for blocks.

Definition at line 218 of file Virtex.hpp.

ColumnDefVector torc::bitstream::Bitstream::mColumnDefs
inherited

Column type widths.

Definition at line 249 of file bitstream/Bitstream.hpp.

string torc::bitstream::Bitstream::mDesignDate
inherited

Header design date.

Definition at line 236 of file bitstream/Bitstream.hpp.

string torc::bitstream::Bitstream::mDesignName
inherited

Header design name.

Definition at line 232 of file bitstream/Bitstream.hpp.

string torc::bitstream::Bitstream::mDesignTime
inherited

Header design time.

Definition at line 238 of file bitstream/Bitstream.hpp.

EDevice torc::bitstream::Bitstream::mDevice
inherited

Bitstream device enumeration.

Definition at line 230 of file bitstream/Bitstream.hpp.

DeviceInfo torc::bitstream::Bitstream::mDeviceInfo
inherited

Device information.

Definition at line 257 of file bitstream/Bitstream.hpp.

string torc::bitstream::Bitstream::mDeviceName
inherited

Header device name.

Definition at line 234 of file bitstream/Bitstream.hpp.

FrameAddressToIndex torc::bitstream::Virtex::mFrameAddressToIndex
protectedinherited

Map of frame addressee to frame indexes.

Definition at line 212 of file Virtex.hpp.

VirtexFrameBlocks torc::bitstream::VirtexBitstream::mFrameBlocks
protectedinherited

Input Frame blocks.

Definition at line 65 of file VirtexBitstream.hpp.

uint32_t torc::bitstream::Virtex::mFrameIndexBounds
protectedinherited

Frame index bounds count.

Definition at line 220 of file Virtex.hpp.

FrameIndexToAddress torc::bitstream::Virtex::mFrameIndexToAddress
protectedinherited

Map of frame indexes to frame addresses.

Definition at line 210 of file Virtex.hpp.

uint32_t torc::bitstream::Bitstream::mHeaderByteLength
inherited

Header length in bytes.

This is the length of the header itself, as opposed to mBitstreamByteLength, which is the length of bitstream reported by the header.

Definition at line 246 of file bitstream/Bitstream.hpp.

string torc::bitstream::Virtex::mPrivateDeviceName
protectedinherited

Definition at line 100 of file Virtex.hpp.

TileTypeIndexToColumnType torc::bitstream::Bitstream::mTileTypeIndexToColumnType
inherited

Definition at line 255 of file bitstream/Bitstream.hpp.

TileTypeNameToColumnType torc::bitstream::Bitstream::mTileTypeNameToColumnType
inherited

Definition at line 252 of file bitstream/Bitstream.hpp.

IndexVector torc::bitstream::Virtex::mXdlColumnIndexes[Virtex::eFarBlockTypeCount]
protectedinherited

Vector to store frame indexes of Bitstream columns.

Definition at line 216 of file Virtex.hpp.

std::map<uint32_t, uint32_t> torc::bitstream::Virtex::mXdlColumnToBitColumn
protectedinherited

Map of XDL column indexes to bitstream column indexes.

Definition at line 222 of file Virtex.hpp.

const char * torc::bitstream::Virtex::sCommandName
staticprotectedinherited
Initial value:
= {
"[UNKNOWN CMD 0]", "WCFG", "", "LFRM", "RCFG", "START", "RCAP", "RCRC", "AGHIGH", "SWITCH"
}

Configuration command names.

Definition at line 91 of file Virtex.hpp.

const Bitstream::Subfield torc::bitstream::Virtex::sCOR
staticprotectedinherited

Configuration Options Register (COR) subfields.

See Also
Configuration Options Register Description: XAPP151, v1.7, October 20, 2004, Table 20.

Definition at line 93 of file Virtex.hpp.

const Bitstream::Subfield torc::bitstream::Virtex::sCTL
staticprotectedinherited
Initial value:
= {
{0x00000001, 0, "GTS_USER_B", "GTS_USER_B", 0,
VALUES{"IoDisabled", "IoActive", 0}},
{0x00000040, 6, "Persist", "PERSIST", 0,
VALUES{"No", "Yes", 0}},
{0x00000180, 7, "Security", "SBITS", 0,
VALUES{"None", "Level1", "Level2", "Level2", 0}},
{0, 0, 0, 0, 0, 0}
}

Control Register (CTL) subfields.

See Also
Status Register Description: XAPP151, v1.7, October 20, 2004, Table 23.

Definition at line 97 of file Virtex.hpp.

const Bitstream::Subfield torc::bitstream::Virtex::sMASK
staticprotectedinherited
Initial value:
= {
{0x00000001, 0, "GTS_USER_B", "GTS_USER_B", 0, VALUES{"Protected", "Writable", 0}},
{0x00000040, 6, "Persist", "PERSIST", 0, VALUES{"Protected", "Writable", 0}},
{0x00000180, 7, "Security", "SBITS", 0,
VALUES{"Protected", "[UNKNOWN 1]", "[UNKNOWN 2]", "Writable", 0}},
{0, 0, 0, 0, 0, 0}
}

Control Mask Register (MASK) subfields.

See Also
Control Mask Register Description: Inferred from Table 23.

Definition at line 99 of file Virtex.hpp.

const char * torc::bitstream::Virtex::sOpcodeName
staticprotectedinherited
Initial value:
= {
"[UNKNOWN OP 0]", "READ", "WRITE", "[UNKNOWN OP 3]"
}

Packet opcode names.

See Also
configuration data: XAPP151, v1.7, October 20, 2004, Figure 12.

Definition at line 87 of file Virtex.hpp.

const char * torc::bitstream::Virtex::sPacketTypeName
staticprotectedinherited
Initial value:
= {
"[UNKNOWN TYPE 0]", "TYPE1", "TYPE2", "[UNKNOWN TYPE 3]", "[UNKNOWN TYPE 4]",
"[UNKNOWN TYPE 5]", "[UNKNOWN TYPE 6]", "[UNKNOWN TYPE 7]"
}

Packet type names.

Definition at line 85 of file Virtex.hpp.

const char * torc::bitstream::Virtex::sRegisterName
staticprotectedinherited
Initial value:
= {
"CRC", "FAR", "FDRI", "FDRO", "CMD", "CTL", "MASK", "STAT", "LOUT", "COR", "[UNKNOWN REG 0]", "FLR"
}

Configuration register names.

Definition at line 89 of file Virtex.hpp.

const Bitstream::Subfield torc::bitstream::Virtex::sSTAT
staticprotectedinherited

Status Register (STAT) subfields.

See Also
Status Register Description: XAPP151, v1.7, October 20, 2004, Table 25.
Note
The "bitgen" names attempt to mimic the general bitgen convention.

Definition at line 95 of file Virtex.hpp.


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