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

Virtex7 bitstream. More...

#include <Virtex7.hpp>

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

Data Structures

class  FrameAddress
 
struct  FrameRowDesignator
 Frame row designator: top/bottom flag and row index. More...
 

Public Types

enum  ERegister {
  eRegisterCRC = 0, eRegisterFAR, eRegisterFDRI, eRegisterFDRO,
  eRegisterCMD, eRegisterCTL0, eRegisterMASK, eRegisterSTAT,
  eRegisterLOUT, eRegisterCOR0, eRegisterMFWR, eRegisterCBC,
  eRegisterIDCODE, eRegisterAXSS, eRegisterCOR1, eRegisterWBSTAR = 16,
  eRegisterTIMER, eRegisterBOOTSTS = 22, eRegisterCTL1 = 24, eRegisterCount
}
 Configuration register enumeration. More...
 
enum  ECommand {
  eCommandNULL = 0, eCommandWCFG, eCommandMFW, eCommandDGHIGH,
  eCommandLFRM = eCommandDGHIGH, eCommandRCFG, eCommandSTART, eCommandRCAP,
  eCommandRCRC, eCommandAGHIGH, eCommandSWITCH, eCommandGRESTORE,
  eCommandSHUTDOWN, eCommandGCAPTURE, eCommandDESYNCH, eCommandReserved,
  eCommandIPROG, eCommandCRCC, eCommandLTIMER, eCommandCount
}
 Configuration register enumeration. More...
 
enum  EFar {
  eFarMaskBlockType = 0x03800000, eFarShiftBlockType = 23, eFarMaskTopBottom = 0x00400000, eFarShiftTopBottom = 22,
  eFarMaskRow = 0x003e0000, eFarShiftRow = 17, eFarMaskMajor = 0x0001ff80, eFarShiftMajor = 7,
  eFarMaskMinor = 0x0000007f, eFarShiftMinor = 0
}
 Frame Address Register subfields. More...
 
enum  EFarTopBottom { eFarTop = 0, eFarBottom = 1 }
 Frame Address Register top and bottom constants. More...
 
enum  EFarBlockType {
  eFarBlockType0 = 0, eFarBlockType1, eFarBlockType2, eFarBlockType3,
  eFarBlockType4, eFarBlockType5, eFarBlockType6, eFarBlockType7,
  eFarBlockTypeCount
}
 Frame Address Register block type constants. More...
 
enum  { eStartAddr = 0x1fffffff, eTimerValue = 0x3fffffff }
 Assorted Constants. More...
 
enum  EColumnType {
  eColumnTypeEmpty = 0, eColumnTypeInt, eColumnTypeBram, eColumnTypeCfg,
  eColumnTypeClb, eColumnTypeClock, eColumnTypeCmt, eColumnTypeDsp,
  eColumnTypeGtx, eColumnTypeIoi, eColumnTypeVframe, eColumnTypePss,
  eColumnTypeCount
}
 Major Column Types. More...
 
enum  { eFrameLength = 101 }
 Frame length. More...
 
enum  { eRowPadFrames = 2 }
 Number of pad frames after each frame row. More...
 
enum  { eClockRegionRows = 52 }
 Number of rows in a clock region. 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

 Virtex7 (void)
 Basic Constructor. More...
 
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 useful only for internal purposes. More...
 
virtual void readFramePackets (void)
 Read frame data into the frame blocks structure. 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...
 
VirtexFrameBlocks getBitstreamFrames (EFarTopBottom inTopBottom, uint32_t inFrameRow, uint32_t inBitCol, uint32_t inBlockCount=eBlockTypeCount)
 Returns frames for specified bitstream tile column. inTopBottom The top or bottom half of the device: eFarTop or eFarBottom. inFrameRow The frame or clock region row in the area specified by inTopBottom. inBitCol The bitstream column coordinate (different than the XDL column coordinate). inBlockCount The highest block type requested (8 for Xilinx architectures). More...
 
VirtexFrameBlocks getBitstreamFrames (uint32_t inBitRow, uint32_t inBitCol, uint32_t &outBeginBit, uint32_t &outEndBit, uint32_t inBlockCount=eBlockTypeCount)
 Returns frames for specified bitstream tile column. inBitRow The bitstream row coordinate (same as the XDL row coordinate). inBitCol The bitstream column coordinate (different than the XDL column coordinate). outBeginBit The bit index of the beginning of the requested tile. outEndBit The bit index of the end of the requested tile. inBlockCount The highest block type requested (8 for Xilinx architectures). More...
 
VirtexFrameBlocks getXdlFrames (uint32_t inXdlRow, uint32_t inXdlCol, uint32_t &outBeginBit, uint32_t &outEndBit, uint32_t inBlockCount=eBlockTypeCount)
 Returns frames for specified XDL tile coordinates. inXldRow The XDL row coordinate. inXdlCol The XDL column coordinate. outBeginBit The bit index of the beginning of the requested tile. outEndBit The bit index of the end of the requested tile. inBlockCount The highest block type requested (8 for Xilinx architectures). More...
 
uint32_t getPrimaryXdlColumn (uint32_t inXdlRow, uint32_t inXdlCol)
 Returns the primary column corresponding to the given tile. If the specified tile falls in an INT_L or INT_R tile, this function returns the index of the corresponding primary XDL column. inXdlCol The XDL column coordinate. More...
 
virtual void splitFrameIndex (uint32_t inFrameIndex, uint32_t &outMajorIndex, uint32_t &outMinorIndex)
 Split the given frame index into the base index of the major frame and the index of the minor frame. More...
 
DEPRECATED void initializeFullFrameBlocks (void)
 Loads full bitstream frames into block data structure. More...
 
DEPRECATED void updateFullFrameBlocks (void)
 Transfers frame block data into the full bitstream frame packet. More...
 
virtual uint32_t getFrameRowCount (void) const
 Return the number of frame rows for the current device. More...
 
virtual uint32_t getFrameLength (void) const
 Return the frame length for the current device. More...
 
virtual uint32_t getRowPadFrames (void) const
 Return the number of pad frames after each row. 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 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 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,
Virtex7::FrameAddress
FrameIndexToAddress
 Map from frame index to frame address. More...
 
typedef std::map
< Virtex7::FrameAddress,
uint32_t
FrameAddressToIndex
 Map from frame address to frame index. More...
 
typedef std::vector< uint32_tIndexVector
 Vector of frame indexes. More...
 
typedef std::map< uint32_t,
uint32_t
BitColumnToXdlColumn
 Map from bitstream column index to XDL column index. More...
 
typedef std::vector
< FrameRowDesignator
FrameRowDesignatorVector
 Vector of FrameRowDesignator entries. More...
 

Protected Member Functions

void setRowCounts (const string &inDeviceName)
 Set the number of top and bottom bitstream rows. More...
 
VirtexFrameBlocks getBitstreamFrames (uint32_t inSerialFrameRow, uint32_t inBitCol, uint32_t inBlockCount=eBlockTypeCount)
 Returns frames for queried bitstream coordinates inSerialFrameRow The frame row as indexed starting from top row zero and incrementing toward the top of the device, and then continuing from bottom row zero and incrementing toward the bottom of the device. More...
 
VirtexFrameBlocks getXdlFrames (uint32_t inSerialFrameRow, uint32_t inColumnVectorBase, uint32_t inXdlCol, uint32_t inBlockCount=eBlockTypeCount)
 Returns frames for queried XDL coordinates inSerialFrameRow The frame row as indexed starting from top row zero and incrementing toward the top of the device, and then continuing from bottom row zero and incrementing toward the bottom of the device. More...
 
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

uint32_t mTopRowCount
 The number of top bitstream rows. More...
 
uint32_t mBottomRowCount
 The number of bottom bitstream rows. More...
 
FrameIndexToAddress mFrameIndexToAddress
 Map of frame indexes to frame addresses. More...
 
FrameAddressToIndex mFrameAddressToIndex
 Map of frame addresses to frame indexes. More...
 
IndexVector mBitColumnIndexes [Virtex7::eFarBlockTypeCount]
 Vector to store frame indexes of XDL columns. More...
 
IndexVector mXdlColumnIndexes [Virtex7::eFarBlockTypeCount]
 Vector to store frame indexes of Bitstream columns. More...
 
uint32_t mBlockFrameIndexBounds [Virtex7::eFarBlockTypeCount]
 Array to hold frame index boundaries for blocks. More...
 
BitColumnToXdlColumn mBitColumnToXdlColumn
 Map of bitstream column indexes to XDL column indexes. More...
 
uint32_t mFrameRowCount
 Number of frame rows. More...
 
FrameRowDesignatorVector mXdlRowToFrameRowDesignator
 Vector of FrameRowDesignator entries for each XDL row. More...
 
VirtexFrameBlocks mFrameBlocks
 Input Frame blocks. More...
 

Static Protected Attributes

static const char * sPacketTypeName [ePacketTypeCount]
 Configuration controller registers. 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 sCOR0 []
 Configurations Options Register 0 (COR) subfields. More...
 
static const Subfield sCOR1 []
 Configurations Options Register 1 (COR) subfields. More...
 
static const Subfield sSTAT []
 Status Register (STAT) subfields. More...
 
static const Subfield sCTL0 []
 Control Register 0 (CTL) subfields. More...
 
static const Subfield sCTL1 []
 Control Register 1 (CTL) subfields. More...
 
static const Subfield sMASK0 []
 Control Mask Register (MASK) subfields. More...
 
static const Subfield sWBSTAR []
 Warm Boot Start Address Register (WBSTAR) subfields. More...
 
static const Subfield sTIMER []
 Watchdog Timer Register (TIMER) subfields. More...
 
static const Subfield sBOOTSTS []
 Boot History Status Register (BOOTSTS) subfields. More...
 

Friends

class torc::bitstream::bitstream::Virtex7UnitTest
 
class torc::bitstream::bitstream::Virtex7FarUnitTest
 
class torc::bitstream::bitstream::Zynq7000DebugUnitTest
 
void torc::bitstream::bitstream::testVirtex7Device (const std::string &inDeviceName, const boost::filesystem::path &inWorkingPath)
 
std::ostream & operator<< (std::ostream &os, const Virtex7 &rhs)
 Insert the bitstream header into and output stream. More...
 

Detailed Description

Virtex7 bitstream.

Definition at line 40 of file Virtex7.hpp.

Member Typedef Documentation

Map from bitstream column index to XDL column index.

Definition at line 395 of file Virtex7.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 391 of file Virtex7.hpp.

Map from frame index to frame address.

Definition at line 389 of file Virtex7.hpp.

Vector of FrameRowDesignator entries.

Definition at line 397 of file Virtex7.hpp.

typedef std::vector<uint32_t> torc::bitstream::Virtex7::IndexVector
protected

Vector of frame indexes.

Definition at line 393 of file Virtex7.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::Virtex7::uint32_t
protected

Imported type name.

Definition at line 49 of file Virtex7.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.

anonymous enum

Assorted Constants.

See Also
WBSTAR Register Description: UG470, v1.1, March 28, 2011, Table 5-31.
Enumerator
eStartAddr 
eTimerValue 

Definition at line 89 of file Virtex7.hpp.

89  {
90  eStartAddr = 0x1fffffff,
91  eTimerValue = 0x3fffffff,
92  };
anonymous enum

Frame length.

Constant frame length of 101 32-bit words for the entire Virtex7 family.

See Also
Frame Address Register (00001): UG470, v1.1, March 28, 2011.
Enumerator
eFrameLength 

Definition at line 103 of file Virtex7.hpp.

anonymous enum

Number of pad frames after each frame row.

The configuration controller expects two frames of NOPs after each frame row.

Enumerator
eRowPadFrames 

Definition at line 106 of file Virtex7.hpp.

anonymous enum

Number of rows in a clock region.

Enumerator
eClockRegionRows 

Definition at line 108 of file Virtex7.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 
eColumnTypeInt 
eColumnTypeBram 
eColumnTypeCfg 
eColumnTypeClb 
eColumnTypeClock 
eColumnTypeCmt 
eColumnTypeDsp 
eColumnTypeGtx 
eColumnTypeIoi 
eColumnTypeVframe 
eColumnTypePss 
eColumnTypeCount 

Definition at line 97 of file Virtex7.hpp.

Configuration register enumeration.

See Also
Command Register Codes: UG470, v1.1, March 28, 2011, Table 5-21.
Enumerator
eCommandNULL 
eCommandWCFG 
eCommandMFW 
eCommandDGHIGH 
eCommandLFRM 
eCommandRCFG 
eCommandSTART 
eCommandRCAP 
eCommandRCRC 
eCommandAGHIGH 
eCommandSWITCH 
eCommandGRESTORE 
eCommandSHUTDOWN 
eCommandGCAPTURE 
eCommandDESYNCH 
eCommandReserved 
eCommandIPROG 
eCommandCRCC 
eCommandLTIMER 
eCommandCount 

Definition at line 63 of file Virtex7.hpp.

67  eCommandCount };

Frame Address Register subfields.

See Also
Frame Address Register Description: UG470, v1.1, March 28 2011, Table 5-20.
Enumerator
eFarMaskBlockType 
eFarShiftBlockType 
eFarMaskTopBottom 
eFarShiftTopBottom 
eFarMaskRow 
eFarShiftRow 
eFarMaskMajor 
eFarShiftMajor 
eFarMaskMinor 
eFarShiftMinor 

Definition at line 71 of file Virtex7.hpp.

Frame Address Register top and bottom constants.

See Also
Frame Address Register Description: UG470, v1.1, March 28, 2011, Table 5-20.
Enumerator
eFarTop 
eFarBottom 

Definition at line 81 of file Virtex7.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
Type 1 Packet Registers: UG470, v1.1, March 28, 2011, Table 5-19.
Enumerator
eRegisterCRC 
eRegisterFAR 
eRegisterFDRI 
eRegisterFDRO 
eRegisterCMD 
eRegisterCTL0 
eRegisterMASK 
eRegisterSTAT 
eRegisterLOUT 
eRegisterCOR0 
eRegisterMFWR 
eRegisterCBC 
eRegisterIDCODE 
eRegisterAXSS 
eRegisterCOR1 
eRegisterWBSTAR 
eRegisterTIMER 
eRegisterBOOTSTS 
eRegisterCTL1 
eRegisterCount 

Definition at line 55 of file Virtex7.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.

Constructor & Destructor Documentation

torc::bitstream::Virtex7::Virtex7 ( void  )
inline

Basic Constructor.

Definition at line 150 of file Virtex7.hpp.

151 // for(int i = 0; i < eRegisterCount; i++) mRegister[i] =0;
152  for(int i = 0; i < eFarBlockTypeCount; i++) mBlockFrameIndexBounds[i] = 0;
153  // initialize miscellaneous variables
154  mFrameRowCount = 0;
155  // initialize the column type widths for this family
157  mColumnDefs[eColumnTypeEmpty] = ColumnDef("Empty", 0, 0, 0, 0, 0, 0, 0, 0);
158  mColumnDefs[eColumnTypeInt] = ColumnDef("Int", 0, 0, 0, 0, 0, 0, 0, 0);
159  mColumnDefs[eColumnTypeBram] = ColumnDef("Bram", 28,128, 0, 0, 0, 0, 0, 0);
160  mColumnDefs[eColumnTypeCfg] = ColumnDef("Cfg", 36, 0, 0, 0, 0, 0, 0, 0);
161  mColumnDefs[eColumnTypeClb] = ColumnDef("Clb", 36, 0, 0, 0, 0, 0, 0, 0);
162  mColumnDefs[eColumnTypeClock] = ColumnDef("Clock", 30, 0, 0, 0, 0, 0, 0, 0);
163  mColumnDefs[eColumnTypeCmt] = ColumnDef("Cmt", 30, 0, 0, 0, 0, 0, 0, 0);
164  mColumnDefs[eColumnTypeDsp] = ColumnDef("Dsp", 28, 0, 0, 0, 0, 0, 0, 0);
165  mColumnDefs[eColumnTypeGtx] = ColumnDef("Gtx", 32, 0, 0, 0, 0, 0, 0, 0);
166  mColumnDefs[eColumnTypeIoi] = ColumnDef("Ioi", 42, 0, 0, 0, 0, 0, 0, 0);
167  mColumnDefs[eColumnTypeVframe] = ColumnDef("Vframe", 30, 0, 0, 0, 0, 0, 0, 0);
168  mColumnDefs[eColumnTypePss] = ColumnDef("Pss", 0, 0, 0, 0, 0, 0, 0, 0);
169  // map type type names to column types
174  mTileTypeNameToColumnType["CFG_CENTER_TOP"] = eColumnTypeCfg;
175  mTileTypeNameToColumnType["CFG_CENTER_BOT"] = eColumnTypeCfg;
176  mTileTypeNameToColumnType["MONITOR_TOP_PELE1"] = eColumnTypeCfg;
181  mTileTypeNameToColumnType["INT_FEEDTHRU_1"] = eColumnTypeClb;
188  mTileTypeNameToColumnType["GTP_COMMON_MID_LEFT"] = eColumnTypeGtx;
189  mTileTypeNameToColumnType["GTP_COMMON_MID_RIGHT"] = eColumnTypeGtx;
197  }
ColumnDefVector mColumnDefs
Column type widths.
TileTypeNameToColumnType mTileTypeNameToColumnType
VirtexBitstream(void)
Basic constructor.
uint32_t mTopRowCount
The number of top bitstream rows.
Definition: Virtex7.hpp:140
uint32_t mFrameRowCount
Number of frame rows.
Definition: Virtex7.hpp:425
uint32_t mBottomRowCount
The number of bottom bitstream rows.
Definition: Virtex7.hpp:142
uint32_t mBlockFrameIndexBounds[Virtex7::eFarBlockTypeCount]
Array to hold frame index boundaries for blocks.
Definition: Virtex7.hpp:421

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:

virtual VirtexPacketVector::iterator torc::bitstream::Virtex7::deleteFramePackets ( void  )
inlinevirtual

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

Reimplemented from torc::bitstream::VirtexBitstream.

Definition at line 229 of file Virtex7.hpp.

229  {
230  return deleteFramePackets4567<Virtex7>();
231  }
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.
virtual VirtexPacketVector torc::bitstream::Virtex7::generateFullBitstreamPackets ( void  )
inlinevirtual

Return a packet vector with full frame data.

Reimplemented from torc::bitstream::VirtexBitstream.

Definition at line 233 of file Virtex7.hpp.

233  {
234  return generateFullBitstreamPackets4567<Virtex7>(mBlockFrameIndexBounds);
235  }
uint32_t mBlockFrameIndexBounds[Virtex7::eFarBlockTypeCount]
Array to hold frame index boundaries for blocks.
Definition: Virtex7.hpp:421
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::Virtex7::generateFullBitstreamPrefix ( void  )
virtual

Return a packet vector with the full bitstream prefix.

Reimplemented from torc::bitstream::VirtexBitstream.

Definition at line 847 of file Virtex7.cpp.

847  {
848  // 0000005d: DUMMY
849  // 00000061: DUMMY
850  // 00000065: DUMMY
851  // 00000069: DUMMY
852  // 0000006d: DUMMY
853  // 00000071: DUMMY
854  // 00000075: DUMMY
855  // 00000079: DUMMY
856  // 0000007d: BUS WIDTH SYNC
857  // 00000081: BUS WIDTH DETECT
858  // 00000085: DUMMY
859  // 00000089: DUMMY
860  // 0000008d: SYNC
861  // 00000091: NOP x 1
862  // 00000095: TYPE1 WRITE TIMER: 00000000 (TimerForUser:Disabled, TimerForConfig:Disabled)
863  // 0000009d: TYPE1 WRITE WBSTAR: 00000000 (RevisionSelectTristate:Disabled,
864  // NextRevisionSelect:00)
865  // 000000a5: TYPE1 WRITE CMD NULL
866  // 000000ad: NOP x 1
867  // 000000b1: TYPE1 WRITE CMD RCRC
868  // 000000b9: NOP x 2
869  // 000000c1: TYPE1 WRITE [UNKNOWN REG 19]: 00000000
870  // 000000c9: TYPE1 WRITE COR0: 02003fe5 (DONE_status:DonePin, DonePipe:Yes, DriveDone:No,
871  // Capture:Continuous, ConfigRate:[UNKNOWN 0], StartupClk:Cclk, DONE_cycle:4,
872  // Match_cycle:NoWait, LCK_cycle:No Wait, GTS_cycle:5, GWE_cycle:6)
873  // 000000d1: TYPE1 WRITE COR1: 00000000 (PersistDeassertAtDesynch:Disabled,
874  // ActionReadbackCRC:Continue, InitAsCRCErrorPin:Disabled,
875  // ContinuousReadbackCRC:Enabled, BPI_1st_read_cycle:1, BPI_page_size:1)
876  // 000000d9: TYPE1 WRITE IDCODE: 03651093
877  // 000000e1: TYPE1 WRITE CMD SWITCH
878  // 000000e9: NOP x 1
879  // 000000ed: TYPE1 WRITE MASK: 00000401 (EFUSE_key:Protected, ICAP_sel:Protected,
880  // OverTempPowerDown:Protected, GLUTMASK:Protected, FARSRC:Protected,
881  // Encrypt:Protected, Security:Protected, Persist:Protected,
882  // GTS_USER_B:Writable)
883  // 000000f5: TYPE1 WRITE CTL0: 00000501 (EFUSE_key:No, ICAP_sel:Top,
884  // OverTempPowerDown:Disable, GLUTMASK:Dynamic, FARSRC:FAR, Encrypt:No,
885  // Security:None, Persist:No, GTS_USER_B:IoActive)
886  // 000000fd: TYPE1 WRITE MASK: 00000000 ()
887  // 00000105: TYPE1 WRITE CTL1: 00000000 ()
888  // 0000010d: NOP x 8
889 
890  // declare the packet vector and define a NOP packet
891  typedef VirtexFrame::word_t word_t;
892  VirtexPacketVector packets;
893  VirtexPacket nop(VirtexPacket::makeHeader(ePacketType1, eOpcodeNOP, 0, 0));
894  VirtexPacket dummy(eSynchronizationDummy);
895  // dummy words
896  packets.insert(packets.end(), 8, dummy);
897  // bus width detect
898  packets.push_back(VirtexPacket(eSynchronizationBusWidthSync));
899  packets.push_back(VirtexPacket(eSynchronizationBusWidthDetect));
900  packets.push_back(dummy);
901  packets.push_back(dummy);
902  // sync
903  packets.push_back(VirtexPacket(eSynchronizationSync));
904  packets.push_back(nop);
905  // watchdog timer
906  packets.push_back(VirtexPacket::makeType1Write(eRegisterTIMER, 0));
907  // warm boot register
908  packets.push_back(VirtexPacket::makeType1Write(eRegisterWBSTAR, 0));
909  // NULL command
911  packets.push_back(nop);
912  // reset CRC command
914  packets.push_back(nop);
915  packets.push_back(nop);
916  // undocumented register 19
917  packets.push_back(VirtexPacket::makeType1Write(19, 0));
918  // configuration options register 0
919  packets.push_back(VirtexPacket::makeType1Write(eRegisterCOR0,
920  makeSubfield(eRegisterCOR0, "DONE_status", "DonePin") |
921  makeSubfield(eRegisterCOR0, "DonePipe", "Yes") |
922  makeSubfield(eRegisterCOR0, "DriveDone", "No") |
923  makeSubfield(eRegisterCOR0, "Capture", "Continuous") |
924  makeSubfield(eRegisterCOR0, "ConfigRate", "[UNKNOWN 0]") |
925  makeSubfield(eRegisterCOR0, "StartupClk", "Cclk") |
926  makeSubfield(eRegisterCOR0, "DONE_cycle", "4") |
927  makeSubfield(eRegisterCOR0, "Match_cycle", "NoWait") |
928  makeSubfield(eRegisterCOR0, "LCK_cycle", "NoWait") |
929  makeSubfield(eRegisterCOR0, "GTS_cycle", "5") |
930  makeSubfield(eRegisterCOR0, "GWE_cycle", "6") |
931  0));
932  // configuration options register 1
933  packets.push_back(VirtexPacket::makeType1Write(eRegisterCOR1,
934  makeSubfield(eRegisterCOR1, "PersistDeassertAtDesynch", "Disabled") |
935  makeSubfield(eRegisterCOR1, "ActionReadbackCRC", "Continue") |
936  makeSubfield(eRegisterCOR1, "InitAsCRCErrorPin", "Disabled") |
937  makeSubfield(eRegisterCOR1, "ContinuousReadbackCRC", "Enabled") |
938  makeSubfield(eRegisterCOR1, "BPI_1st_read_cycle", "1") |
939  makeSubfield(eRegisterCOR1, "BPI_page_size", "1") |
940  0));
941  // write the ID code
942  packets.push_back(VirtexPacket::makeType1Write(eRegisterIDCODE, 0x00000000));
943  // clock and rate switch command
945  packets.push_back(nop);
946  // control register 0 mask
947  packets.push_back(VirtexPacket::makeType1Write(eRegisterMASK,
948  makeSubfield(eRegisterMASK, "EFUSE_key", "Protected") |
949  makeSubfield(eRegisterMASK, "ICAP_sel", "Protected") |
950  makeSubfield(eRegisterMASK, "OverTempPowerDown", "Protected") |
951  makeSubfield(eRegisterMASK, "GLUTMASK", "Protected") |
952  makeSubfield(eRegisterMASK, "FARSRC", "Protected") |
953  makeSubfield(eRegisterMASK, "Encrypt", "Protected") |
954  makeSubfield(eRegisterMASK, "Security", "Protected") |
955  makeSubfield(eRegisterMASK, "Persist", "Protected") |
956  makeSubfield(eRegisterMASK, "GTS_USER_B", "Writable") |
957  0));
958  // control register 0
959  packets.push_back(VirtexPacket::makeType1Write(eRegisterCTL0,
960  makeSubfield(eRegisterCTL0, "EFUSE_key", "NO") |
961  makeSubfield(eRegisterCTL0, "ICAP_sel", "Top") |
962  makeSubfield(eRegisterCTL0, "OverTempPowerDown", "Disable") |
963  makeSubfield(eRegisterCTL0, "GLUTMASK", "Dynamic") |
964  makeSubfield(eRegisterCTL0, "FARSRC", "FAR") |
965  makeSubfield(eRegisterCTL0, "Encrypt", "No") |
966  makeSubfield(eRegisterCTL0, "Security", "None") |
967  makeSubfield(eRegisterCTL0, "Persist", "No") |
968  makeSubfield(eRegisterCTL0, "GTS_USER_B", "IoActive") |
969  0));
970  // control register 1 mask
971  packets.push_back(VirtexPacket::makeType1Write(eRegisterMASK, 0));
972  // control register 1
973  packets.push_back(VirtexPacket::makeType1Write(eRegisterCTL1, 0));
974  // more NOPs
975  packets.insert(packets.end(), 8, nop);
976  // return the packet vector
977  return packets;
978  }
static uint32_t makeSubfield(ERegister inRegister, const std::string &inSubfield, const std::string &inSetting)
Return the masked value for a subfield of the specified register.
Definition: Virtex7.cpp:361
VirtexFrame::word_t word_t
FrameSet word type.
Definition: FrameSet.hpp:85
std::vector< VirtexPacket > VirtexPacketVector
Vector of Virtex packets.
static VirtexPacket makeType1Write(uint32_t inAddress, uint32_t inWord)
Construct a type 1 write packet.
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

+ Here is the call graph for this function:

VirtexPacketVector torc::bitstream::Virtex7::generateFullBitstreamSuffix ( void  )
virtual

Return a packet vector with the full bitstream suffix.

Reimplemented from torc::bitstream::VirtexBitstream.

Definition at line 980 of file Virtex7.cpp.

980  {
981  // 00ae95cd: TYPE1 WRITE CRC: 9f18b580
982  // 00ae95d1: NOP x 2
983  // 00ae95d9: TYPE1 WRITE CMD GRESTORE
984  // 00ae95e1: NOP x 1
985  // 00ae95e5: TYPE1 WRITE CMD DGHIGH/LFRM
986  // 00ae95ed: NOP x 100
987  // 00ae977d: TYPE1 WRITE CMD START
988  // 00ae9785: NOP x 1
989  // 00ae9789: TYPE1 WRITE FAR: 03be0000
990  // 00ae9791: TYPE1 WRITE MASK: 00000501 (EFUSE_key:Protected, ICAP_sel:Protected,
991  // OverTempPowerDown:Protected, GLUTMASK:Writable, FARSRC:Protected,
992  // Encrypt:Protected, Security:Protected, Persist:Protected,
993  // GTS_USER_B:Writable)
994  // 00ae9799: TYPE1 WRITE CTL0: 00000501 (EFUSE_key:No, ICAP_sel:Top,
995  // OverTempPowerDown:Disable, GLUTMASK:Dynamic, FARSRC:FAR, Encrypt:No,
996  // Security:None, Persist:No, GTS_USER_B:IoActive)
997  // 00ae97a1: TYPE1 WRITE CRC: e3ad7ea5
998  // 00ae97a9: NOP x 2
999  // 00ae97b1: TYPE1 WRITE CMD DESYNCH
1000  // 00ae97b9: NOP x 400
1001 
1002  // declare the packet vector and define a NOP packet
1003  typedef VirtexFrame::word_t word_t;
1004  VirtexPacketVector packets;
1005  VirtexPacket nop(VirtexPacket::makeHeader(ePacketType1, eOpcodeNOP, 0, 0));
1006  // write a placeholder CRC value
1007  packets.push_back(VirtexPacket::makeType1Write(eRegisterCRC, 0));
1008  packets.push_back(nop);
1009  packets.push_back(nop);
1010  // restore command
1012  packets.push_back(nop);
1013  // last frame command
1015  packets.insert(packets.end(), 100, nop);
1016  // start command
1018  packets.push_back(nop);
1019  // frame address register
1020  packets.push_back(VirtexPacket::makeType1Write(eRegisterFAR,
1021  eFarMaskBlockType | eFarMaskRow)); // is this what the configuration controller wants?
1022  // control register 0 mask
1023  packets.push_back(VirtexPacket::makeType1Write(eRegisterMASK,
1024  makeSubfield(eRegisterMASK, "EFUSE_key", "Protected") |
1025  makeSubfield(eRegisterMASK, "ICAP_sel", "Protected") |
1026  makeSubfield(eRegisterMASK, "OverTempPowerDown", "Protected") |
1027  makeSubfield(eRegisterMASK, "GLUTMASK", "Protected") |
1028  makeSubfield(eRegisterMASK, "FARSRC", "Protected") |
1029  makeSubfield(eRegisterMASK, "Encrypt", "Protected") |
1030  makeSubfield(eRegisterMASK, "Security", "Protected") |
1031  makeSubfield(eRegisterMASK, "Persist", "Protected") |
1032  makeSubfield(eRegisterMASK, "GTS_USER_B", "Writable") |
1033  0));
1034  // control register 0
1035  packets.push_back(VirtexPacket::makeType1Write(eRegisterCTL0,
1036  makeSubfield(eRegisterCTL0, "EFUSE_key", "NO") |
1037  makeSubfield(eRegisterCTL0, "ICAP_sel", "Top") |
1038  makeSubfield(eRegisterCTL0, "OverTempPowerDown", "Disable") |
1039  makeSubfield(eRegisterCTL0, "GLUTMASK", "Dynamic") |
1040  makeSubfield(eRegisterCTL0, "FARSRC", "FAR") |
1041  makeSubfield(eRegisterCTL0, "Encrypt", "No") |
1042  makeSubfield(eRegisterCTL0, "Security", "None") |
1043  makeSubfield(eRegisterCTL0, "Persist", "No") |
1044  makeSubfield(eRegisterCTL0, "GTS_USER_B", "IoActive") |
1045  0));
1046  // write the CRC value
1047  packets.push_back(VirtexPacket::makeType1Write(eRegisterCRC, 0x00000000));
1048  packets.push_back(nop);
1049  packets.push_back(nop);
1050  // desynch command
1052  packets.insert(packets.end(), 400, nop);
1053  // return the packet vector
1054  return packets;
1055  }
static uint32_t makeSubfield(ERegister inRegister, const std::string &inSubfield, const std::string &inSetting)
Return the masked value for a subfield of the specified register.
Definition: Virtex7.cpp:361
VirtexFrame::word_t word_t
FrameSet word type.
Definition: FrameSet.hpp:85
std::vector< VirtexPacket > VirtexPacketVector
Vector of Virtex packets.
static VirtexPacket makeType1Write(uint32_t inAddress, uint32_t inWord)
Construct a type 1 write packet.
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

+ Here is the call graph for this function:

virtual VirtexPacketVector torc::bitstream::Virtex7::generatePartialBitstreamPackets ( EFrameInclude  inFrameInclusion)
inlinevirtual

Return a packet vector with partial frame data.

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

Reimplemented from torc::bitstream::VirtexBitstream.

Definition at line 242 of file Virtex7.hpp.

242  {
243  return generatePartialBitstreamPackets4567<Virtex7>(inFrameInclusion,
245  }
FrameIndexToAddress mFrameIndexToAddress
Map of frame indexes to frame addresses.
Definition: Virtex7.hpp:413
FrameAddressToIndex mFrameAddressToIndex
Map of frame addresses to frame indexes.
Definition: Virtex7.hpp:415
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::Virtex7::generatePartialBitstreamPrefix ( EBitstreamType  inBitstreamType)
virtual

Return a packet vector with the partial bitstream prefix.

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

Reimplemented from torc::bitstream::VirtexBitstream.

Definition at line 1057 of file Virtex7.cpp.

1057  {
1058  // Packets marked S pertain to shutdown bitstreams only
1059  // 0000005d: DUMMY
1060  // 00000061: DUMMY
1061  // 00000065: DUMMY
1062  // 00000069: DUMMY
1063  // 0000006d: DUMMY
1064  // 00000071: DUMMY
1065  // 00000075: DUMMY
1066  // 00000079: DUMMY
1067  // 0000007d: BUS WIDTH SYNC
1068  // 00000081: BUS WIDTH DETECT
1069  // 00000085: DUMMY
1070  // 00000089: DUMMY
1071  // 0000008d: SYNC
1072  // 00000091: NOP x 1
1073  // 00000095: TYPE1 WRITE CMD RCRC
1074  // 0000009d: NOP x 2
1075  // 000000a5: TYPE1 WRITE IDCODE: 03651093
1076  // S 000000ad: TYPE1 WRITE COR0: 02003fe5 (DONE_status:DonePin, DonePipe:Yes,
1077  // DriveDone:No, Capture:Continuous, ConfigRate:[UNKNOWN 0],
1078  // StartupClk:Cclk, DONE_cycle:4, Match_cycle:NoWait, LCK_cycle:No Wait,
1079  // GTS_cycle:5, GWE_cycle:6)
1080  // S 000000b5: TYPE1 WRITE CMD SHUTDOWN
1081  // S 000000bd: NOP x 1
1082  // S 000000c1: TYPE1 WRITE CRC: 6f322c8f
1083  // S 000000c9: NOP x 4
1084  // S 000000d9: TYPE1 WRITE CMD AGHIGH
1085  // S 000000e1: NOP x 1
1086  // 000000e5: TYPE1 WRITE CMD NULL
1087 
1088  // declare the packet vector and define a NOP packet
1089  typedef VirtexFrame::word_t word_t;
1090  VirtexPacketVector packets;
1091  VirtexPacket nop(VirtexPacket::makeHeader(ePacketType1, eOpcodeNOP, 0, 0));
1092  VirtexPacket dummy(eSynchronizationDummy);
1093  // dummy words
1094  packets.insert(packets.end(), 8, dummy);
1095  // bus width detect
1096  packets.push_back(VirtexPacket(eSynchronizationBusWidthSync));
1097  packets.push_back(VirtexPacket(eSynchronizationBusWidthDetect));
1098  packets.push_back(dummy);
1099  packets.push_back(dummy);
1100  // sync
1101  packets.push_back(VirtexPacket(eSynchronizationSync));
1102  packets.push_back(nop);
1103  // reset CRC command
1105  packets.push_back(nop);
1106  packets.push_back(nop);
1107  // write the ID code
1108  packets.push_back(VirtexPacket::makeType1Write(eRegisterIDCODE, 0x00000000));
1109  // extra for shutdown bitstreams
1110  if(inBitstreamType == eBitstreamTypePartialShutdown) {
1111  // configuration options register 0
1112  packets.push_back(VirtexPacket::makeType1Write(eRegisterCOR0,
1113  makeSubfield(eRegisterCOR0, "DONE_status", "DonePin") |
1114  makeSubfield(eRegisterCOR0, "DonePipe", "Yes") |
1115  makeSubfield(eRegisterCOR0, "DriveDone", "No") |
1116  makeSubfield(eRegisterCOR0, "Capture", "Continuous") |
1117  makeSubfield(eRegisterCOR0, "ConfigRate", "[UNKNOWN 0]") |
1118  makeSubfield(eRegisterCOR0, "StartupClk", "Cclk") |
1119  makeSubfield(eRegisterCOR0, "DONE_cycle", "4") |
1120  makeSubfield(eRegisterCOR0, "Match_cycle", "NoWait") |
1121  makeSubfield(eRegisterCOR0, "LCK_cycle", "NoWait") |
1122  makeSubfield(eRegisterCOR0, "GTS_cycle", "5") |
1123  makeSubfield(eRegisterCOR0, "GWE_cycle", "6") |
1124  0));
1125  // shutdown command
1127  packets.push_back(nop);
1128  // write the CRC value
1129  packets.push_back(VirtexPacket::makeType1Write(eRegisterCRC, 0x00000000));
1130  packets.insert(packets.end(), 4, nop);
1131  // aghigh command
1133  packets.push_back(nop);
1134  }
1135  // null command
1137  // return the packet vector
1138  return packets;
1139  }
static uint32_t makeSubfield(ERegister inRegister, const std::string &inSubfield, const std::string &inSetting)
Return the masked value for a subfield of the specified register.
Definition: Virtex7.cpp:361
VirtexFrame::word_t word_t
FrameSet word type.
Definition: FrameSet.hpp:85
std::vector< VirtexPacket > VirtexPacketVector
Vector of Virtex packets.
static VirtexPacket makeType1Write(uint32_t inAddress, uint32_t inWord)
Construct a type 1 write packet.
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

+ Here is the call graph for this function:

VirtexPacketVector torc::bitstream::Virtex7::generatePartialBitstreamSuffix ( EBitstreamType  inBitstreamType)
virtual

Return a packet vector with the partial bitstream suffix.

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

Reimplemented from torc::bitstream::VirtexBitstream.

Definition at line 1141 of file Virtex7.cpp.

1141  {
1142  // Packets marked S pertain to shutdown bitstreams only
1143  // S 000008ed: TYPE1 WRITE CMD GRESTORE
1144  // S 000008f5: NOP x 1
1145  // 000008f9: TYPE1 WRITE CMD DGHIGH/LFRM
1146  // 00000901: NOP x 100
1147  // S 00000a91: TYPE1 WRITE CMD GRESTORE
1148  // S 00000a99: NOP x 1
1149  // S 00000a9d: TYPE1 WRITE CMD START
1150  // S 00000aa5: NOP x 1
1151  // 00000aa9: TYPE1 WRITE FAR: 03be0000
1152  // 00000ab1: TYPE1 WRITE CRC: a658dd48
1153  // 00000ab9: TYPE1 WRITE CMD DESYNCH
1154  // 00000ac1: NOP x 16
1155 
1156  // declare the packet vector and define a NOP packet
1157  typedef VirtexFrame::word_t word_t;
1158  VirtexPacketVector packets;
1159  VirtexPacket nop(VirtexPacket::makeHeader(ePacketType1, eOpcodeNOP, 0, 0));
1160  // extra for shutdown bitstreams
1161  if(inBitstreamType == eBitstreamTypePartialShutdown) {
1162  // restore command
1164  packets.push_back(nop);
1165  }
1166  // last frame command
1168  packets.insert(packets.end(), 100, nop);
1169  // extra for shutdown bitstreams
1170  if(inBitstreamType == eBitstreamTypePartialShutdown) {
1171  // restore command
1173  packets.push_back(nop);
1174  // start command
1176  packets.push_back(nop);
1177  }
1178  // frame address register
1179  packets.push_back(VirtexPacket::makeType1Write(eRegisterFAR,
1180  eFarMaskBlockType | eFarMaskRow)); // is this what the configuration controller wants?
1181  // write the CRC value
1182  packets.push_back(VirtexPacket::makeType1Write(eRegisterCRC, 0x00000000));
1183  // desynch command
1185  packets.insert(packets.end(), 16, nop);
1186  // return the packet vector
1187  return packets;
1188  }
VirtexFrame::word_t word_t
FrameSet word type.
Definition: FrameSet.hpp:85
std::vector< VirtexPacket > VirtexPacketVector
Vector of Virtex packets.
static VirtexPacket makeType1Write(uint32_t inAddress, uint32_t inWord)
Construct a type 1 write packet.
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

+ Here is the call graph for this function:

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::Virtex7::getBitstreamFrames ( EFarTopBottom  inTopBottom,
uint32_t  inFrameRow,
uint32_t  inBitCol,
uint32_t  inBlockCount = eBlockTypeCount 
)

Returns frames for specified bitstream tile column. inTopBottom The top or bottom half of the device: eFarTop or eFarBottom. inFrameRow The frame or clock region row in the area specified by inTopBottom. inBitCol The bitstream column coordinate (different than the XDL column coordinate). inBlockCount The highest block type requested (8 for Xilinx architectures).

Definition at line 1235 of file Virtex7.cpp.

1236  {
1237  return getXdlFrames(inFrameRow + (inTopBottom == eFarBottom ? (mTopRowCount) : 0),
1238  mBitColumnToXdlColumn[inBitCol], inBlockCount);
1239  }
BitColumnToXdlColumn mBitColumnToXdlColumn
Map of bitstream column indexes to XDL column indexes.
Definition: Virtex7.hpp:423
VirtexFrameBlocks getXdlFrames(uint32_t inXdlRow, uint32_t inXdlCol, uint32_t &outBeginBit, uint32_t &outEndBit, uint32_t inBlockCount=eBlockTypeCount)
Returns frames for specified XDL tile coordinates. inXldRow The XDL row coordinate. inXdlCol The XDL column coordinate. outBeginBit The bit index of the beginning of the requested tile. outEndBit The bit index of the end of the requested tile. inBlockCount The highest block type requested (8 for Xilinx architectures).
Definition: Virtex7.cpp:1252
uint32_t mTopRowCount
The number of top bitstream rows.
Definition: Virtex7.hpp:140

+ Here is the call graph for this function:

VirtexFrameBlocks torc::bitstream::Virtex7::getBitstreamFrames ( uint32_t  inBitRow,
uint32_t  inBitCol,
uint32_t outBeginBit,
uint32_t outEndBit,
uint32_t  inBlockCount = eBlockTypeCount 
)

Returns frames for specified bitstream tile column. inBitRow The bitstream row coordinate (same as the XDL row coordinate). inBitCol The bitstream column coordinate (different than the XDL column coordinate). outBeginBit The bit index of the beginning of the requested tile. outEndBit The bit index of the end of the requested tile. inBlockCount The highest block type requested (8 for Xilinx architectures).

Definition at line 1241 of file Virtex7.cpp.

1242  {
1243  return getXdlFrames(inBitRow, mBitColumnToXdlColumn[inBitCol], outBeginBit, outEndBit,
1244  inBlockCount);
1245  }
BitColumnToXdlColumn mBitColumnToXdlColumn
Map of bitstream column indexes to XDL column indexes.
Definition: Virtex7.hpp:423
VirtexFrameBlocks getXdlFrames(uint32_t inXdlRow, uint32_t inXdlCol, uint32_t &outBeginBit, uint32_t &outEndBit, uint32_t inBlockCount=eBlockTypeCount)
Returns frames for specified XDL tile coordinates. inXldRow The XDL row coordinate. inXdlCol The XDL column coordinate. outBeginBit The bit index of the beginning of the requested tile. outEndBit The bit index of the end of the requested tile. inBlockCount The highest block type requested (8 for Xilinx architectures).
Definition: Virtex7.cpp:1252

+ Here is the call graph for this function:

VirtexFrameBlocks torc::bitstream::Virtex7::getBitstreamFrames ( uint32_t  inSerialFrameRow,
uint32_t  inBitCol,
uint32_t  inBlockCount = eBlockTypeCount 
)
protected

Returns frames for queried bitstream coordinates inSerialFrameRow The frame row as indexed starting from top row zero and incrementing toward the top of the device, and then continuing from bottom row zero and incrementing toward the bottom of the device.

Definition at line 1247 of file Virtex7.cpp.

1248  {
1249  return getXdlFrames(inSerialFrameRow, mBitColumnToXdlColumn[inBitCol], inBlockCount);
1250  }
BitColumnToXdlColumn mBitColumnToXdlColumn
Map of bitstream column indexes to XDL column indexes.
Definition: Virtex7.hpp:423
VirtexFrameBlocks getXdlFrames(uint32_t inXdlRow, uint32_t inXdlCol, uint32_t &outBeginBit, uint32_t &outEndBit, uint32_t inBlockCount=eBlockTypeCount)
Returns frames for specified XDL tile coordinates. inXldRow The XDL row coordinate. inXdlCol The XDL column coordinate. outBeginBit The bit index of the beginning of the requested tile. outEndBit The bit index of the end of the requested tile. inBlockCount The highest block type requested (8 for Xilinx architectures).
Definition: Virtex7.cpp:1252

+ 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::Virtex7::getFrameLength ( void  ) const
inlinevirtual

Return the frame length for the current device.

Reimplemented from torc::bitstream::Bitstream.

Definition at line 304 of file Virtex7.hpp.

+ Here is the caller graph for this function:

virtual uint32_t torc::bitstream::Virtex7::getFrameRowCount ( void  ) const
inlinevirtual

Return the number of frame rows for the current device.

Definition at line 302 of file Virtex7.hpp.

302 { return mFrameRowCount; }
uint32_t mFrameRowCount
Number of frame rows.
Definition: Virtex7.hpp:425

+ Here is the caller graph for this function:

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:

uint32_t torc::bitstream::Virtex7::getPrimaryXdlColumn ( uint32_t  inXdlRow,
uint32_t  inXdlCol 
)

Returns the primary column corresponding to the given tile. If the specified tile falls in an INT_L or INT_R tile, this function returns the index of the corresponding primary XDL column. inXdlCol The XDL column coordinate.

Definition at line 1349 of file Virtex7.cpp.

1349  {
1350  // INT columns "belong" with their corresponding primary column in the bitstream, so if the
1351  // caller hands us an INT column, we look for the next primary column;
1352  // if the caller passes in a primary column, we return it as is
1353  const ColumnTypeVector& columns = mDeviceInfo.getColumnTypes();
1354  // look up the column vector base index for this XDL row
1355  uint32_t columnVectorBase = mXdlRowToFrameRowDesignator[inXdlRow].mColumnVectorBase;
1356  // determine the bounds for the current column
1357  uint32_t col = inXdlCol;
1358  ColumnTypeVector::const_iterator b = columnVectorBase + columns.begin();
1359  ColumnTypeVector::const_iterator p = columnVectorBase + columns.begin() + col;
1360  ColumnTypeVector::const_iterator e = columnVectorBase + columns.end();
1361  // if this is anything other than an INT_L or INT_R column, we return it unchanged
1362  if(*p != eColumnTypeInt) return inXdlCol;
1363  // if column to the left is also INT, then this is an INT_R, otherwise it's an INT_L
1364  if(p > b && *(p-1) == eColumnTypeInt) {
1365  // this is an INT_R
1366  while(p < e) {
1367  col++; p++; if(p == e) break;
1368  if(*p != eColumnTypeEmpty && *p != eColumnTypeVframe && *p != eColumnTypeCfg
1369  && *p != eColumnTypeClock) return col;
1370  }
1371  } else {
1372  // this is an INT_L
1373  while(p > b) {
1374  col--; p--;
1375  if(*p != eColumnTypeEmpty && *p != eColumnTypeVframe && *p != eColumnTypeCfg
1376  && *p != eColumnTypeClock) return col;
1377  }
1378  }
1379  // we shouldn't get here, but if we do, the best thing is to return the original column
1380  return inXdlCol;
1381  }
FrameRowDesignatorVector mXdlRowToFrameRowDesignator
Vector of FrameRowDesignator entries for each XDL row.
Definition: Virtex7.hpp:427
boost::uint32_t uint32_t
Imported type name.
Definition: Virtex7.hpp:49
DeviceInfo mDeviceInfo
Device information.
const ColumnTypeVector & getColumnTypes(void) const
Returns the column type vector.
Definition: DeviceInfo.hpp:116

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual uint32_t torc::bitstream::Virtex7::getRowPadFrames ( void  ) const
inlinevirtual

Return the number of pad frames after each row.

Definition at line 306 of file Virtex7.hpp.

+ Here is the caller graph for this function:

VirtexFrameBlocks torc::bitstream::Virtex7::getXdlFrames ( uint32_t  inXdlRow,
uint32_t  inXdlCol,
uint32_t outBeginBit,
uint32_t outEndBit,
uint32_t  inBlockCount = eBlockTypeCount 
)

Returns frames for specified XDL tile coordinates. inXldRow The XDL row coordinate. inXdlCol The XDL column coordinate. outBeginBit The bit index of the beginning of the requested tile. outEndBit The bit index of the end of the requested tile. inBlockCount The highest block type requested (8 for Xilinx architectures).

Definition at line 1252 of file Virtex7.cpp.

1253  {
1254 
1255  // look up the frame row designator for this XDL row
1256  FrameRowDesignator designator = mXdlRowToFrameRowDesignator[inXdlRow];
1257 
1258  // by default we have no bit position information
1259  outBeginBit = outEndBit = 0;
1260 
1261  // look up the relative XDL row
1262  uint32_t relativeXdlRow = inXdlRow - designator.mXdlBaseRow;
1263  //std::cout << "inXdlRow: " << inXdlRow << std::endl;
1264  //std::cout << "inXdlCol: " << inXdlCol << std::endl;
1265  //std::cout << " designator.mTopBottom: " << designator.mTopBottom << std::endl;
1266  //std::cout << " designator.mFrameRow: " << designator.mFrameRow << std::endl;
1267  //std::cout << " designator.mXdlBaseRow: " << designator.mXdlBaseRow << std::endl;
1268  //std::cout << " designator.mColumnVectorBase: " << designator.mColumnVectorBase
1269  // << std::endl;
1270 
1271  // provide bit information for the columns that we know
1272  uint32_t index = relativeXdlRow;
1273  uint32_t columnVectorBase = designator.mColumnVectorBase;
1274  //std::cout << " relativeXdlRow: " << relativeXdlRow << std::endl;
1275  //std::cout << " mDeviceInfo.getColumnTypes()[inXdlCol]: "
1276  // << mDeviceInfo.getColumnTypes()[inXdlCol + columnVectorBase] << std::endl;
1277  switch(mDeviceInfo.getColumnTypes()[inXdlCol + columnVectorBase]) {
1278  case eColumnTypeClb:
1279  case eColumnTypeInt:
1280  if(index == 0 || index == 26) break; // these tiles have no bits
1281  index--; // tile 0 has no bits
1282  outBeginBit = index * 64; // regular tiles are 64 bits long
1283  outEndBit = outBeginBit + 64;
1284  if(index > 26) {
1285  outBeginBit -= 32; // the clock word is 32 bits long
1286  outEndBit -= 32; // the clock word is 32 bits long
1287  }
1288  break;
1289  case eColumnTypeDsp:
1290  case eColumnTypeBram:
1291  if(index != 5 && index != 10 && index != 15 && index != 20 && index != 25
1292  && index != 31 && index != 36 && index != 41 && index != 46 && index != 51) break;
1293  index -= 5;
1294  outBeginBit = index * 64; // regular tiles are 64 bits long
1295  outEndBit = outBeginBit + 320;
1296  if(index > 25) {
1297  outBeginBit -= 32; // the clock word is 32 bits long
1298  outEndBit -= 32; // the clock word is 32 bits long
1299  }
1300  break;
1301  default:
1302  break;
1303  }
1304 
1305  // invoke the function that really does the work
1306  return getXdlFrames(designator.mFrameRow, designator.mColumnVectorBase, inXdlCol);
1307  }
FrameRowDesignatorVector mXdlRowToFrameRowDesignator
Vector of FrameRowDesignator entries for each XDL row.
Definition: Virtex7.hpp:427
boost::uint32_t uint32_t
Imported type name.
Definition: Virtex7.hpp:49
VirtexFrameBlocks getXdlFrames(uint32_t inXdlRow, uint32_t inXdlCol, uint32_t &outBeginBit, uint32_t &outEndBit, uint32_t inBlockCount=eBlockTypeCount)
Returns frames for specified XDL tile coordinates. inXldRow The XDL row coordinate. inXdlCol The XDL column coordinate. outBeginBit The bit index of the beginning of the requested tile. outEndBit The bit index of the end of the requested tile. inBlockCount The highest block type requested (8 for Xilinx architectures).
Definition: Virtex7.cpp:1252
DeviceInfo mDeviceInfo
Device information.
const ColumnTypeVector & getColumnTypes(void) const
Returns the column type vector.
Definition: DeviceInfo.hpp:116

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VirtexFrameBlocks torc::bitstream::Virtex7::getXdlFrames ( uint32_t  inSerialFrameRow,
uint32_t  inColumnVectorBase,
uint32_t  inXdlCol,
uint32_t  inBlockCount = eBlockTypeCount 
)
protected

Returns frames for queried XDL coordinates inSerialFrameRow The frame row as indexed starting from top row zero and incrementing toward the top of the device, and then continuing from bottom row zero and incrementing toward the bottom of the device.

Definition at line 1309 of file Virtex7.cpp.

1310  {
1311  if(inSerialFrameRow > getFrameRowCount()) return VirtexFrameBlocks();
1312 
1313  // index and extract frames
1314  int32_t xdlColumnIndex[inBlockCount];
1315  int32_t xdlColumnBound[inBlockCount];
1316  for(uint32_t i = 0; i < inBlockCount; i++) {
1317  // column index of given frame index
1318  xdlColumnIndex[i] = mXdlColumnIndexes[i][inColumnVectorBase + inXdlCol];
1319  // frame bounds for given column type
1320  uint32_t col = inColumnVectorBase + inXdlCol;
1321  xdlColumnBound[i] = mColumnDefs[mDeviceInfo.getColumnTypes()[col]][i];
1322  //std::cout << " i: " << i << std::endl;
1323  //std::cout << " length: " << mXdlColumnIndexes[i].size() << std::endl;
1324  //std::cout << " xdlColumnBound[i]: " << xdlColumnBound[i] << std::endl;
1325  //std::cout << " xdlColumnIndex[i]: " << xdlColumnIndex[i] << std::endl;
1326  //std::cout << " col: " << col << std::endl;
1327  }
1328  // extract the tile frames for the specified FAR
1329  VirtexFrameBlocks frameBlocks;
1330  for(uint32_t i = 0; i < inBlockCount; i++) {
1331  int startIndex = xdlColumnIndex[i];
1332  for(int j = 0; j < xdlColumnBound[i]; j++) {
1333  frameBlocks.mBlock[i].push_back(mFrameBlocks.mBlock[i][startIndex+j]);
1334  if(!xdlColumnBound[i]) continue;
1335  int offset = i > 0 ? mXdlColumnIndexes[i-1].back() + 2 : 0;
1336  std::cout << "Virtex7::getXdlFrames(): pushing mBlock[" << i << "]["
1337  << (startIndex + offset + j) << "]: "
1338  << mFrameIndexToAddress[startIndex + offset + j] << std::endl;
1339  //std::cout << " pushing mBlock[" << i << "][" << (startIndex + offset) << "]-["
1340  // << (startIndex + offset + xdlColumnBound[i] - 1) << "]" << ": "
1341  // << mFrameIndexToAddress[startIndex + offset] << " - "
1342  // << mFrameIndexToAddress[startIndex + offset + xdlColumnBound[i] - 1]
1343  // << std::endl;
1344  }
1345  }
1346  return frameBlocks;
1347  }
ColumnDefVector mColumnDefs
Column type widths.
VirtexFrameBlocks mFrameBlocks
Input Frame blocks.
boost::uint32_t uint32_t
Imported type name.
Definition: Virtex7.hpp:49
FrameIndexToAddress mFrameIndexToAddress
Map of frame indexes to frame addresses.
Definition: Virtex7.hpp:413
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
IndexVector mXdlColumnIndexes[Virtex7::eFarBlockTypeCount]
Vector to store frame indexes of Bitstream columns.
Definition: Virtex7.hpp:419
virtual uint32_t getFrameRowCount(void) const
Return the number of frame rows for the current device.
Definition: Virtex7.hpp:302
FrameBlocks< VirtexFrame > VirtexFrameBlocks
Virtex frame blocks type.
Definition: FrameSet.hpp:91

+ Here is the call graph for this function:

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

Initialize the Device Information.

Reimplemented from torc::bitstream::Bitstream.

Definition at line 416 of file Virtex7.cpp.

416  {
417  using namespace torc::common;
418  switch(mDevice) {
419  case eXC7A100T: setDeviceInfo(xc7a100t); break;
420  case eXC7A200T: setDeviceInfo(xc7a200t); break;
421  case eXC7K70T: setDeviceInfo(xc7k70t); break;
422  case eXC7K160T: setDeviceInfo(xc7k160t); break;
423  case eXC7K325T: setDeviceInfo(xc7k325t); break;
424  case eXC7K355T: setDeviceInfo(xc7k355t); break;
425  case eXC7K410T: setDeviceInfo(xc7k410t); break;
426  case eXC7K420T: setDeviceInfo(xc7k420t); break;
427  case eXC7K480T: setDeviceInfo(xc7k480t); break;
428  case eXC7V585T: setDeviceInfo(xc7v585t); break;
429  case eXC7V2000T: setDeviceInfo(xc7v2000t); break;
430  case eXC7VH580T: setDeviceInfo(xc7vh580t); break;
431  case eXC7VH870T: setDeviceInfo(xc7vh870t); break;
432  case eXC7VX330T: setDeviceInfo(xc7vx330t); break;
433  case eXC7VX415T: setDeviceInfo(xc7vx415t); break;
434  case eXC7VX485T: setDeviceInfo(xc7vx485t); break;
435  case eXC7VX550T: setDeviceInfo(xc7vx550t); break;
436  case eXC7VX690T: setDeviceInfo(xc7vx690t); break;
437  case eXC7VX980T: setDeviceInfo(xc7vx980t); break;
438  case eXC7VX1140T: setDeviceInfo(xc7vx1140t); break;
439  case eXC7Z010: setDeviceInfo(xc7z010); break;
440  case eXC7Z020: setDeviceInfo(xc7z020); break;
441  case eXC7Z030: setDeviceInfo(xc7z030); break;
442  case eXC7Z045: setDeviceInfo(xc7z045); break;
443  default: break;
444  }
445 
446  // update the top and bottom bitstream row counts as appropriate for the device
447  setRowCounts(inDeviceName);
448  }
DeviceInfo xc7vx485t
DeviceInfo xc7v2000t
DeviceInfo xc7k420t
DeviceInfo xc7vx415t
DeviceInfo xc7vx330t
DeviceInfo xc7z010
DeviceInfo xc7vh870t
DeviceInfo xc7k355t
DeviceInfo xc7k410t
DeviceInfo xc7z045
DeviceInfo xc7z020
EDevice mDevice
Bitstream device enumeration.
DeviceInfo xc7k160t
DeviceInfo xc7k70t
DeviceInfo xc7vx1140t
DeviceInfo xc7z030
void setRowCounts(const string &inDeviceName)
Set the number of top and bottom bitstream rows.
Definition: Virtex7.cpp:670
DeviceInfo xc7vx980t
DeviceInfo xc7k325t
DeviceInfo xc7k480t
DeviceInfo xc7a100t
DeviceInfo xc7vh580t
DeviceInfo xc7a200t
void setDeviceInfo(const DeviceInfo &rhs)
Assign static device information for the current bitstream.
DeviceInfo xc7v585t
DeviceInfo xc7vx550t
DeviceInfo xc7vx690t

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

Reimplemented from torc::bitstream::Bitstream.

Definition at line 710 of file Virtex7.cpp.

710  {
711 
712  bool debug = false;
715  if(mFrameRowCount == 0) return;
716  uint32_t frameCount = 0;
717 
718 //std::cerr << "row count: " << mDeviceInfo.getRowCount() << ", far row count: " << mFrameRowCount
719 // << std::endl;
720 
721  // map XDL tiles to top/bottom halves and frame rows
723  uint32_t xdlRow = 0;
724  uint32_t xdlBaseRow = xdlRow;
725  uint32_t baseCol = 0;
726  uint32_t serialFrame = mTopRowCount - 1;
727  baseCol = serialFrame * mDeviceInfo.getColCount();
728  for(uint32_t frameRow = mTopRowCount - 1; ; frameRow--) {
729  for(int i = 0; i < eClockRegionRows; i++, xdlRow++) {
730 //std::cout << "mapping XDL row " << xdlRow << " to top frame row " << frameRow << " (serial "
731 // << serialFrame << ")" << " (base " << xdlBaseRow << ") from " << baseCol << std::endl;
733  = FrameRowDesignator(eFarTop, serialFrame, xdlBaseRow, baseCol);
734  }
735  xdlBaseRow += eClockRegionRows;
736  baseCol -= mDeviceInfo.getColCount();
737  serialFrame--;
738  if(frameRow == 0) break;
739  }
740  // bottom half rows
741  serialFrame = mTopRowCount;
742  baseCol = serialFrame * mDeviceInfo.getColCount();
743  for(uint32_t frameRow = 0; frameRow < mBottomRowCount; frameRow++) {
744  for(int i = 0; i < eClockRegionRows; i++, xdlRow++) {
745 //std::cout << "mapping XDL row " << xdlRow << " to bottom frame row " << frameRow << " (serial "
746 // << serialFrame << ")" << " (base " << xdlBaseRow << ") from " << baseCol << std::endl;
748  = FrameRowDesignator(eFarBottom, serialFrame, xdlBaseRow, baseCol);
749  }
750  xdlBaseRow += eClockRegionRows;
751  baseCol += mDeviceInfo.getColCount();
752  serialFrame++;
753  }
754 
755  // generate the columns and mappings
756  uint32_t frameIndex = 0;
757  for(uint32_t i = 0; i < eFarBlockTypeCount; i++) {
758  EFarBlockType blockType = EFarBlockType(i);
759  uint32_t blockFrameIndexBounds = 0;
760  // set first frame index to 0
761  uint32_t bitIndex = 0;
762  uint32_t xdlIndex = 0;
763  mBitColumnIndexes[i].push_back(bitIndex);
764  mXdlColumnIndexes[i].push_back(xdlIndex);
765  bool blockUsed = false;
766  uint32_t baseCol = 0;
767  for(uint32_t half = 0; half < 2; half++) {
768  EFarTopBottom topBottom(half == eFarTop ? eFarTop : eFarBottom);
769  uint32_t farRowCount = (topBottom == eFarTop) ? mTopRowCount : mBottomRowCount;
770  for(uint32_t farRow = 0; farRow < farRowCount; farRow++) {
771  // build the columns
772  uint32_t farMajor = 0;
774  uint16_t finalColumn = mDeviceInfo.getColCount() - 1;
775  uint32_t xdlColumnCount = 0;
776  uint32_t bitColumnCount = 0;
777  for(ColumnIndex col; col < mDeviceInfo.getColCount(); col++) {
778  uint32_t realCol = col + baseCol;
779  uint32_t width
780  = mColumnDefs[mDeviceInfo.getColumnTypes()[col + baseCol]][i];
781 //std::cerr << "block: " << i << ", xdl col: " << col << " => " << realCol << ": "
782 // << mDeviceInfo.getColumnTypes()[realCol] << std::endl;
783  // allocate the frame maps
784  for(uint32_t farMinor = 0; farMinor < width; farMinor++) {
785  FrameAddress far(EFarTopBottom(topBottom),
786  blockType, farRow, farMajor, farMinor);
787  mFrameIndexToAddress[frameIndex] = far;
788  mFrameAddressToIndex[far] = frameIndex;
789  frameIndex++;
790  blockFrameIndexBounds++;
791  }
792 //if(width) std::cerr << "CALCULATED: " << (topBottom ? "B" : "T") << blockType << "(" << farRow
793 // << "," << farMajor << "." << (width - 1) << "): "
794 // << mColumnDefs[mDeviceInfo.getColumnTypes()[col + baseCol]].getName() << std::endl;
795  if(width > 0) {
796  farMajor++;
797  blockUsed = true;
798  }
799  frameCount += width;
800  // indexes for Bitstream Columns, only stores non-empty tile types
801  if(mDeviceInfo.getColumnTypes()[realCol] != eColumnTypeEmpty &&
802  mDeviceInfo.getColumnTypes()[realCol] != eColumnTypeInt) {
803  mBitColumnToXdlColumn[bitColumnCount] = xdlColumnCount;
804  bitColumnCount++;
805  bitIndex += width;
806  mBitColumnIndexes[i].push_back(bitIndex);
807  if(blockUsed && col == finalColumn) {
808  bitIndex += getRowPadFrames();
809  }
810  }
811  // indexes for XDL Columns
812  xdlIndex += width;
813  mXdlColumnIndexes[i].push_back(xdlIndex);
814  xdlColumnCount++;
815  if(blockUsed && col == finalColumn) {
816  xdlIndex += getRowPadFrames();
817  }
818  }
819  baseCol += mDeviceInfo.getColCount();
820  // account for two pad frames after each frame row
821  if(blockUsed) {
822  frameIndex += getRowPadFrames();
823  blockFrameIndexBounds += getRowPadFrames();
824  }
825  if(debug) std::cout << "Last frame index: [" << i << ", " << frameIndex
826  << "]" << std::endl;
827  }
828  }
829  // stores frame index bounds for each block type
830  mBlockFrameIndexBounds[i] = blockFrameIndexBounds;
831  if(debug) std::cout << "***Block frame index bounds: " << mBlockFrameIndexBounds[i]
832  << std::endl;
833  }
834  // test to check proper indexing
835  if(debug) {
836  for(uint32_t i = 0; i < eFarBlockTypeCount; i++) {
837  for(uint32_t j = 0; j < mBitColumnIndexes[i].size(); j++)
838  std::cout << "Bit Value at index: (" << i << ", " << j << ") : "
839  << mBitColumnIndexes[i][j] << std::endl;
840  for(uint32_t k = 0; k < mXdlColumnIndexes[i].size(); k++)
841  std::cout << "Xdl Value at index: (" << i << ", " << k << ") : "
842  << mXdlColumnIndexes[i][k] << std::endl;
843  }
844  }
845  }
ColumnDefVector mColumnDefs
Column type widths.
BitColumnToXdlColumn mBitColumnToXdlColumn
Map of bitstream column indexes to XDL column indexes.
Definition: Virtex7.hpp:423
FrameRowDesignatorVector mXdlRowToFrameRowDesignator
Vector of FrameRowDesignator entries for each XDL row.
Definition: Virtex7.hpp:427
uint16_t getRowCount(void) const
Returns the row count.
Definition: DeviceInfo.hpp:112
boost::uint32_t uint32_t
Imported type name.
Definition: Virtex7.hpp:49
uint16_t getColCount(void) const
Returns the column count.
Definition: DeviceInfo.hpp:114
EFarBlockType
Frame Address Register block type constants.
Definition: Virtex7.hpp:84
uint32_t mTopRowCount
The number of top bitstream rows.
Definition: Virtex7.hpp:140
string mDeviceName
Header device name.
FrameIndexToAddress mFrameIndexToAddress
Map of frame indexes to frame addresses.
Definition: Virtex7.hpp:413
DeviceInfo mDeviceInfo
Device information.
EFarTopBottom
Frame Address Register top and bottom constants.
Definition: Virtex7.hpp:81
const ColumnTypeVector & getColumnTypes(void) const
Returns the column type vector.
Definition: DeviceInfo.hpp:116
IndexVector mXdlColumnIndexes[Virtex7::eFarBlockTypeCount]
Vector to store frame indexes of Bitstream columns.
Definition: Virtex7.hpp:419
uint32_t mFrameRowCount
Number of frame rows.
Definition: Virtex7.hpp:425
void setRowCounts(const string &inDeviceName)
Set the number of top and bottom bitstream rows.
Definition: Virtex7.cpp:670
virtual uint32_t getRowPadFrames(void) const
Return the number of pad frames after each row.
Definition: Virtex7.hpp:306
uint32_t mBottomRowCount
The number of bottom bitstream rows.
Definition: Virtex7.hpp:142
boost::uint16_t uint16_t
Imported type name.
uint32_t mBlockFrameIndexBounds[Virtex7::eFarBlockTypeCount]
Array to hold frame index boundaries for blocks.
Definition: Virtex7.hpp:421
Template base for encapsulated integers, to enforce strong typing.
IndexVector mBitColumnIndexes[Virtex7::eFarBlockTypeCount]
Vector to store frame indexes of XDL columns.
Definition: Virtex7.hpp:417
FrameAddressToIndex mFrameAddressToIndex
Map of frame addresses to frame indexes.
Definition: Virtex7.hpp:415

+ Here is the call graph for this function:

void torc::bitstream::Virtex7::initializeFullFrameBlocks ( void  )

Loads full bitstream frames into block data structure.

Definition at line 1190 of file Virtex7.cpp.

1190  {
1191  boost::shared_array<uint32_t> frameWords;
1192  // walk the bitstream and extract all frames
1193  Virtex7::iterator p = begin();
1194  Virtex7::iterator e = end();
1195  while(p < e) {
1196  const VirtexPacket& packet = *p++;
1197  if(packet.isType2() && packet.isWrite())
1198  frameWords = packet.getWords();
1199  }
1200  uint32_t index = 0;
1201  for(uint32_t i = 0; i < Bitstream::eBlockTypeCount; i++) {
1202  // all frames of block type are extracted
1203  for(uint32_t j = 0; j < mBlockFrameIndexBounds[i]; j++) {
1205  (new VirtexFrame(getFrameLength(), &frameWords[index])));
1206  index += getFrameLength();
1207  }
1208  }
1209  }
VirtexFrameBlocks mFrameBlocks
Input Frame blocks.
Frame< uint32_t > VirtexFrame
Virtex frame type.
Definition: Frame.hpp:104
boost::uint32_t uint32_t
Imported type name.
Definition: Virtex7.hpp:49
virtual uint32_t getFrameLength(void) const
Return the frame length for the current device.
Definition: Virtex7.hpp:304
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
uint32_t mBlockFrameIndexBounds[Virtex7::eFarBlockTypeCount]
Array to hold frame index boundaries for blocks.
Definition: Virtex7.hpp:421

+ 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::Virtex7::makeSubfield ( ERegister  inRegister,
const std::string &  inSubfield,
const std::string &  inSetting 
)
static

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

Definition at line 361 of file Virtex7.cpp.

362  {
363  const Subfield* subfields;
364  switch(inRegister) {
365  case eRegisterCOR0: subfields = sCOR0; break;
366  case eRegisterCOR1: subfields = sCOR1; break;
367  case eRegisterSTAT: subfields = sSTAT; break;
368  case eRegisterCTL0: subfields = sCTL0; break;
369  case eRegisterCTL1: subfields = sCTL1; break;
370  case eRegisterMASK: subfields = sMASK0; break;
371  case eRegisterWBSTAR: subfields = sWBSTAR; break;
372  case eRegisterTIMER: subfields = sTIMER; break;
373  case eRegisterBOOTSTS: subfields = sBOOTSTS; break;
374  default: return 0;
375  }
376  for(uint32_t field = 0; subfields[field].mMask != 0; field++){
377  const Subfield& subfield = subfields[field];
378  if(inSubfield != subfield.mBitgenName && inSubfield != subfield.mConfigGuideName)
379  continue;
380  const char** ptr = subfield.mValues;
381  for(uint32_t i = 0; *ptr != 0; i++, ptr++){
382  if(inSetting == *ptr) return (i << subfield.mShift) & subfield.mMask;
383  }
384  }
385  return 0;
386  }
boost::uint32_t uint32_t
Imported type name.
Definition: Virtex7.hpp:49
static const Subfield sMASK0[]
Control Mask Register (MASK) subfields.
Definition: Virtex7.hpp:132
static const Subfield sSTAT[]
Status Register (STAT) subfields.
Definition: Virtex7.hpp:126
static const Subfield sBOOTSTS[]
Boot History Status Register (BOOTSTS) subfields.
Definition: Virtex7.hpp:138
static const Subfield sTIMER[]
Watchdog Timer Register (TIMER) subfields.
Definition: Virtex7.hpp:136
static const Subfield sWBSTAR[]
Warm Boot Start Address Register (WBSTAR) subfields.
Definition: Virtex7.hpp:134
static const Subfield sCOR1[]
Configurations Options Register 1 (COR) subfields.
Definition: Virtex7.hpp:124
static const Subfield sCTL1[]
Control Register 1 (CTL) subfields.
Definition: Virtex7.hpp:130
static const Subfield sCTL0[]
Control Register 0 (CTL) subfields.
Definition: Virtex7.hpp:128
const char ** mValues
The allowable subfield values.
static const Subfield sCOR0[]
Configurations Options Register 0 (COR) subfields.
Definition: Virtex7.hpp:122

+ Here is the caller graph for this function:

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:

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:

virtual void torc::bitstream::Virtex7::readFramePackets ( void  )
inlinevirtual

Read frame data into the frame blocks structure.

Reimplemented from torc::bitstream::VirtexBitstream.

Definition at line 208 of file Virtex7.hpp.

208  {
209  readFramePackets4567<Virtex7>(mBlockFrameIndexBounds, mFrameAddressToIndex,
211  }
FrameIndexToAddress mFrameIndexToAddress
Map of frame indexes to frame addresses.
Definition: Virtex7.hpp:413
uint32_t mBlockFrameIndexBounds[Virtex7::eFarBlockTypeCount]
Array to hold frame index boundaries for blocks.
Definition: Virtex7.hpp:421
FrameAddressToIndex mFrameAddressToIndex
Map of frame addresses to frame indexes.
Definition: Virtex7.hpp:415

+ Here is the caller graph for this function:

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::Virtex7::setRowCounts ( const string inDeviceName)
protected

Set the number of top and bottom bitstream rows.

Definition at line 670 of file Virtex7.cpp.

670  {
671  // The division between top and bottom rows can be determined by the locations of the
672  // CLK_HROW_TOP_R and CLK_HROW_BOT_R tiles in the clock column. The number of clock
673  // regions above and including the CLK_HROW_TOP_R tile determine the number of top rows in
674  // the bitstream. The number of clock regions below and including the CLK_HROW_BOT_R tile
675  // determine the number of bottom rows in the bitstream.
676  using namespace torc::common;
677  switch(mDevice) {
678  // Artix
679  case eXC7A100T: mTopRowCount = 2; mBottomRowCount = 2; break;
680  case eXC7A200T: mTopRowCount = 2; mBottomRowCount = 3; break;
681  // Kintex
682  case eXC7K70T: mTopRowCount = 2; mBottomRowCount = 2; break;
683  case eXC7K160T: mTopRowCount = 2; mBottomRowCount = 3; break;
684  case eXC7K325T: mTopRowCount = 4; mBottomRowCount = 3; break;
685  case eXC7K355T: mTopRowCount = 3; mBottomRowCount = 3; break;
686  case eXC7K410T: mTopRowCount = 4; mBottomRowCount = 3; break;
687  case eXC7K420T: mTopRowCount = 4; mBottomRowCount = 4; break;
688  case eXC7K480T: mTopRowCount = 4; mBottomRowCount = 4; break;
689  // Virtex
690  case eXC7V585T: mTopRowCount = 5; mBottomRowCount = 4; break;
691  case eXC7VX330T: mTopRowCount = 5; mBottomRowCount = 2; break;
692  case eXC7VX415T: mTopRowCount = 5; mBottomRowCount = 1; break;
693  case eXC7VX485T: mTopRowCount = 5; mBottomRowCount = 2; break;
694  case eXC7VX550T: mTopRowCount = 5; mBottomRowCount = 5; break;
695  case eXC7VX690T: mTopRowCount = 5; mBottomRowCount = 5; break;
696  case eXC7VX980T: mTopRowCount = 4; mBottomRowCount = 5; break;
697  // Zynq
698  case eXC7Z010: mTopRowCount = 1; mBottomRowCount = 1; break;
699  case eXC7Z020: mTopRowCount = 1; mBottomRowCount = 2; break;
700  case eXC7Z030: mTopRowCount = 1; mBottomRowCount = 3; break;
701  case eXC7Z045: mTopRowCount = 1; mBottomRowCount = 6; break;
702  default:
703  std::cerr << "Bitstream row dimensions are undefined for " << mDevice << "."
704  << std::endl;
705  mTopRowCount = 0; mBottomRowCount = 0;
706  break;
707  }
708  }
EDevice mDevice
Bitstream device enumeration.
uint32_t mTopRowCount
The number of top bitstream rows.
Definition: Virtex7.hpp:140
uint32_t mBottomRowCount
The number of bottom bitstream rows.
Definition: Virtex7.hpp:142

+ Here is the caller graph for this function:

virtual void torc::bitstream::Virtex7::splitFrameIndex ( uint32_t  inFrameIndex,
uint32_t outMajorIndex,
uint32_t outMinorIndex 
)
inlinevirtual

Split the given frame index into the base index of the major frame and the index of the minor frame.

Definition at line 285 of file Virtex7.hpp.

286  {
287  outMinorIndex = mFrameIndexToAddress[inFrameIndex].mMinor;
288  outMajorIndex = inFrameIndex - outMinorIndex;
289  }
FrameIndexToAddress mFrameIndexToAddress
Map of frame indexes to frame addresses.
Definition: Virtex7.hpp:413
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::Virtex7::updateFullFrameBlocks ( void  )

Transfers frame block data into the full bitstream frame packet.

Todo:
If the packet size differs from the frame data size, we need to replace the entire packet.

Definition at line 1211 of file Virtex7.cpp.

1211  {
1212  /// \todo If the packet size differs from the frame data size, we need to replace the
1213  /// entire packet.
1214  uint32_t frameLength = getFrameLength();
1215  typedef boost::shared_array<uint32_t> WordSharedArray;
1216  // walk the bitstream and find the (full) FDRI write packet
1217  Virtex7::iterator p = begin();
1218  Virtex7::iterator e = end();
1219  while(p < e) {
1220  const VirtexPacket& packet = *p++;
1221  if(packet.isType2() && packet.isWrite()) {
1222  WordSharedArray words = packet.getWords();
1223  uint32_t* ptr = words.get();
1224  for(uint32_t block = 0; block < 8; block++) {
1225  for(uint32_t frame = 0; frame < mBlockFrameIndexBounds[block]; frame++) {
1226  const VirtexFrameBlocks::word_t* words
1227  = mFrameBlocks.mBlock[block][frame]->getWords();
1228  for(uint32_t index = 0; index < frameLength; index++) *ptr++ = *words++;
1229  }
1230  }
1231  }
1232  }
1233  }
VirtexFrameBlocks mFrameBlocks
Input Frame blocks.
boost::uint32_t uint32_t
Imported type name.
Definition: Virtex7.hpp:49
virtual uint32_t getFrameLength(void) const
Return the frame length for the current device.
Definition: Virtex7.hpp:304
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
uint32_t mBlockFrameIndexBounds[Virtex7::eFarBlockTypeCount]
Array to hold frame index boundaries for blocks.
Definition: Virtex7.hpp:421

+ Here is the call 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

std::ostream& operator<< ( std::ostream &  os,
const Virtex7 rhs 
)
friend

Insert the bitstream header into and output stream.

Definition at line 1139 of file bitstream/OutputStreamHelpers.cpp.

1139  {
1140  // insert the bitstream header
1141  os << static_cast<const Bitstream>(rhs) << std::endl;
1142  uint32_t cumulativeWordLength = 0;
1143 
1144  // iterate over the packets
1146  VirtexPacketVector::const_iterator p = rhs.begin();
1147  VirtexPacketVector::const_iterator e = rhs.end();
1148  bool synchronized = false;
1149  bool newColumn = false;
1150  bool newRow = false;
1151  bool newTop = false;
1152  bool newBlock = false;
1153  uint32_t oldColumnValue = 0;
1154  uint32_t oldRowValue = 0;
1155  uint32_t oldTopValue = 0;
1156  uint32_t oldBlockValue = 0;
1157  uint32_t currentColumnValue = 0;
1158  uint32_t currentRowValue = 0;
1159  uint32_t currentTopValue = 0;
1160  uint32_t currentBlockValue = 0;
1161  while(p < e) {
1162 
1163  // insert the byte address
1164  os << " " << Hex32(rhs.getHeaderByteLength() + (cumulativeWordLength << 2)) << ": ";
1165  // look up the packet
1166  const VirtexPacket& packet = *p++;
1167  cumulativeWordLength += packet.getWordSize();
1168 
1169  // catch bus sync words
1170  if(!synchronized) {
1171  if(packet.isBusWidthSyncWord()) {
1172  os << "BUS WIDTH SYNC" << std::endl;
1173  continue;
1174  } else if(packet.isBusWidthDetectWord()) {
1175  os << "BUS WIDTH DETECT" << std::endl;
1176  continue;
1177  }
1178  }
1179 
1180  // handle dummy words
1181  if(packet.isDummyWord()) {
1182  os << "DUMMY" << std::endl;
1183 
1184  // handle sync words
1185  } else if(packet.isSyncWord()) {
1186  os << "SYNC" << std::endl;
1187 
1188  // handle reserved packets
1189  } else if(packet.isReserved()) {
1190  os << Virtex7::sOpcodeName[packet.getOpcode()] << std::endl;
1191 
1192  // handle NOP packets
1193  } else if(packet.isNop()) {
1194  int nops = 1;
1195  while(p < e && p->isNop()) { nops++; p++; }
1196  cumulativeWordLength += nops - 1;
1197  os << "NOP x " << nops << std::endl;
1198 
1199  // handle regular type 1 or type 2 packets
1200  } else {
1201 
1202  // look up the packet details
1203  Virtex7::EPacketType type = packet.getType();
1204  Virtex7::EOpcode opcode = packet.getOpcode();
1205  uint32_t wordCount = packet.getWordCount();
1206  const uint32_t word = packet[1];
1207  // account for the packet type
1208  os << Virtex7::sPacketTypeName[type];
1209  switch(type) {
1210  case Virtex7::ePacketType1:
1211  address = Virtex7::ERegister(packet.getAddress());
1212  break;
1213  case Virtex7::ePacketType2:
1214  break;
1215  default:
1216  os << std::endl;
1217  continue;
1218  }
1219 
1220  // handle read packets
1221  if(opcode == packet.isRead()) {
1222  os << " READ " << Virtex7::sRegisterName[address];
1223 
1224  // handle write packets
1225  } else if(opcode == Virtex7::eOpcodeWrite) {
1226  os << " WRITE " << Virtex7::sRegisterName[address];
1227  // process according to register address
1228  switch(address) {
1230  os << ": " << Hex32(wordCount) << " words";
1231  break;
1232  case Virtex7::eRegisterCMD:
1233  os << " " << Virtex7::sCommandName[word];
1234  break;
1236  os << ": " << Hex32(word);
1238  break;
1240  os << ": " << Hex32(word);
1242  break;
1244  os << ": " << Hex32(word);
1246  break;
1248  os << ": " << Hex32(word);
1250  break;
1252  os << ": " << Hex32(word);
1254  break;
1256  os << ": " << Hex32(word);
1257  // we need to snoop the next packet, because the documented mask subfields
1258  // apply to CTL0 only, and not to CTL1 which is completely undefined
1259  if(p < e) {
1260  const VirtexPacket& nextPacket = *p;
1261  if(nextPacket.isType1() && nextPacket.isWrite()
1262  && nextPacket.getAddress() == Virtex7::eRegisterCTL1) {
1263  os << " ()";
1264  break;
1265  }
1266  }
1268  break;
1270  os << ": " << Hex32(word);
1272  break;
1274  os << ": " << Hex32(word);
1276  break;
1278  os << ": " << Hex32(word);
1280  break;
1281  // Added to make frame mapping debug easier
1283  oldColumnValue = currentColumnValue;
1284  oldRowValue = currentRowValue;
1285  oldTopValue = currentTopValue;
1286  oldBlockValue = currentBlockValue;
1287  currentColumnValue = (word & Virtex7::eFarMaskMajor);
1288  currentRowValue = (word & Virtex7::eFarMaskRow);
1289  currentTopValue = (word & Virtex7::eFarMaskTopBottom);
1290  currentBlockValue = (word & Virtex7::eFarMaskBlockType);
1291  newColumn = (currentColumnValue != oldColumnValue);
1292  newRow = (currentRowValue != oldRowValue);
1293  newTop = (currentTopValue != oldTopValue);
1294  newBlock = (currentBlockValue != oldBlockValue);
1295  os << ": " << Hex32(word);
1296  if(newColumn) std::cout << "\t\t\t!!!New Column!!!";
1297  if(newRow) std::cout << "\t\t\t$$$New Row$$$";
1298  if(newTop) std::cout << "\t\t\t&&&New Top&&&";
1299  if(newBlock) std::cout << "\t\t\t\t\t***New Block***" << Hex32(currentBlockValue);
1300  break;
1301  default:
1302  // output the register contents
1303  os << ": " << Hex32(word);
1304  break;
1305  }
1306 
1307  os << std::endl;
1308  }
1309 
1310  }
1311 
1312  }
1313 
1314  // return the stream reference
1315  return os;
1316  }
EOpcode
Packet opcode enumeration.
boost::uint32_t uint32_t
Imported type name.
Definition: Virtex7.hpp:49
static const Subfield sMASK0[]
Control Mask Register (MASK) subfields.
Definition: Virtex7.hpp:132
static const Subfield sSTAT[]
Status Register (STAT) subfields.
Definition: Virtex7.hpp:126
static const Subfield sBOOTSTS[]
Boot History Status Register (BOOTSTS) subfields.
Definition: Virtex7.hpp:138
ERegister
Configuration register enumeration.
Definition: Virtex7.hpp:55
static const Subfield sTIMER[]
Watchdog Timer Register (TIMER) subfields.
Definition: Virtex7.hpp:136
static const Subfield sWBSTAR[]
Warm Boot Start Address Register (WBSTAR) subfields.
Definition: Virtex7.hpp:134
static const Subfield sCOR1[]
Configurations Options Register 1 (COR) subfields.
Definition: Virtex7.hpp:124
static void writeSubfieldSettings(std::ostream &inStream, uint32_t inWord, const Subfield *inSubfields)
Insert 32 bit subfield settings into an output stream.
Definition: Bitstream.cpp:26
static const char * sPacketTypeName[ePacketTypeCount]
Configuration controller registers.
Definition: Virtex7.hpp:114
static const char * sCommandName[eCommandCount]
Configuration Command names.
Definition: Virtex7.hpp:120
static const Subfield sCTL1[]
Control Register 1 (CTL) subfields.
Definition: Virtex7.hpp:130
static const char * sRegisterName[eRegisterCount]
Configuration Register names.
Definition: Virtex7.hpp:118
static const Subfield sCTL0[]
Control Register 0 (CTL) subfields.
Definition: Virtex7.hpp:128
static const char * sOpcodeName[eOpcodeCount]
Packet Opcode names.
Definition: Virtex7.hpp:116
EPacketType
Packet type enumeration.
static const Subfield sCOR0[]
Configurations Options Register 0 (COR) subfields.
Definition: Virtex7.hpp:122
void torc::bitstream::bitstream::testVirtex7Device ( const std::string &  inDeviceName,
const boost::filesystem::path &  inWorkingPath 
)
friend
friend class torc::bitstream::bitstream::Virtex7FarUnitTest
friend

Definition at line 42 of file Virtex7.hpp.

friend class torc::bitstream::bitstream::Virtex7UnitTest
friend

Definition at line 41 of file Virtex7.hpp.

friend class torc::bitstream::bitstream::Zynq7000DebugUnitTest
friend

Definition at line 43 of file Virtex7.hpp.

Field Documentation

IndexVector torc::bitstream::Virtex7::mBitColumnIndexes[Virtex7::eFarBlockTypeCount]
protected

Vector to store frame indexes of XDL columns.

Definition at line 417 of file Virtex7.hpp.

BitColumnToXdlColumn torc::bitstream::Virtex7::mBitColumnToXdlColumn
protected

Map of bitstream column indexes to XDL column indexes.

Definition at line 423 of file Virtex7.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::Virtex7::mBlockFrameIndexBounds[Virtex7::eFarBlockTypeCount]
protected

Array to hold frame index boundaries for blocks.

Definition at line 421 of file Virtex7.hpp.

uint32_t torc::bitstream::Virtex7::mBottomRowCount
protected

The number of bottom bitstream rows.

Definition at line 142 of file Virtex7.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::Virtex7::mFrameAddressToIndex
protected

Map of frame addresses to frame indexes.

Definition at line 415 of file Virtex7.hpp.

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

Input Frame blocks.

Definition at line 65 of file VirtexBitstream.hpp.

FrameIndexToAddress torc::bitstream::Virtex7::mFrameIndexToAddress
protected

Map of frame indexes to frame addresses.

Definition at line 413 of file Virtex7.hpp.

uint32_t torc::bitstream::Virtex7::mFrameRowCount
protected

Number of frame rows.

Definition at line 425 of file Virtex7.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.

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.

uint32_t torc::bitstream::Virtex7::mTopRowCount
protected

The number of top bitstream rows.

Definition at line 140 of file Virtex7.hpp.

IndexVector torc::bitstream::Virtex7::mXdlColumnIndexes[Virtex7::eFarBlockTypeCount]
protected

Vector to store frame indexes of Bitstream columns.

Definition at line 419 of file Virtex7.hpp.

FrameRowDesignatorVector torc::bitstream::Virtex7::mXdlRowToFrameRowDesignator
protected

Vector of FrameRowDesignator entries for each XDL row.

Definition at line 427 of file Virtex7.hpp.

const Bitstream::Subfield torc::bitstream::Virtex7::sBOOTSTS
staticprotected

Boot History Status Register (BOOTSTS) subfields.

See Also
BOOTSTS Register Description: UG470, v1.1, March 28, 2011, Table 5-35.

Definition at line 138 of file Virtex7.hpp.

const char * torc::bitstream::Virtex7::sCommandName
staticprotected
Initial value:
= {
"NULL", "WCFG", "MFW", "DGHIGH/LFRM", "RCFG", "START", "RCAP", "RCRC",
"AGHIGH", "SWITCH", "GRESTORE", "SHUTDOWN", "GCAPTURE", "DESYNCH", "Reserved",
"IPROG", "CRCC", "LTIMER"
}

Configuration Command names.

Definition at line 120 of file Virtex7.hpp.

const Bitstream::Subfield torc::bitstream::Virtex7::sCOR0
staticprotected

Configurations Options Register 0 (COR) subfields.

See Also
Configurations Options Register 0 (COR0): UG470, v1.1, March 28, 2011, Table 5-27.

Definition at line 122 of file Virtex7.hpp.

const Bitstream::Subfield torc::bitstream::Virtex7::sCOR1
staticprotected
Initial value:
= {
{0x00000003, 0, "BPI_page_size", "BPI_PAGE_SIZE", 0,
VALUES{"1", "4", "8", "Reserved", 0}},
{0x0000000C, 2, "BPI_1st_read_cycle", "BPI_1ST_READ_CYCLES", 0,
VALUES{"1", "2", "3", "4", 0}},
{0x00000100, 8, "ContinuousReadbackCRC", "RBCRC_EN", 0,
VALUES{"Enabled", "disabled", 0}},
{0x00000200, 9, "InitAsCRCErrorPin", "RBCRC_NO_PIN", 0,
VALUES{"Disabled", "Enabled", 0}},
{0x00018000, 15, "ActionReadbackCRC", "RBCRC_ACTION", 0,
VALUES{"Continue", "Halt", "CorrectAndHalt", "CorrectAndContinue", 0}},
{0x00020000, 17, "PersistDeassertAtDesynch", "PERSIST_DEASSERT_AT_DESYNCH", 0,
VALUES{"Disabled", "Enabled", 0}},
{0, 0, 0, 0, 0, 0}
}

Configurations Options Register 1 (COR) subfields.

See Also
Configurations Options Register 1 (COR1): UG470 v1.1, March 28, 2011, Table 5-29 .

Definition at line 124 of file Virtex7.hpp.

const Bitstream::Subfield torc::bitstream::Virtex7::sCTL0
staticprotected

Control Register 0 (CTL) subfields.

See Also
Control Register 0 (CTL0): UG470, v1.1, March 28, 2011, Table 5-23

Definition at line 128 of file Virtex7.hpp.

const Bitstream::Subfield torc::bitstream::Virtex7::sCTL1
staticprotected
Initial value:
= {
{0, 0, 0, 0, 0, 0}
}

Control Register 1 (CTL) subfields.

See Also
Control Register 1 (CTL1): UG470, v1.1, March 28, 2011, Table 5-36

Definition at line 130 of file Virtex7.hpp.

const Bitstream::Subfield torc::bitstream::Virtex7::sMASK0
staticprotected
Initial value:
= {
{0x00000001, 0, "GTS_USER_B", "GTS_USER_B", 0, VALUES{"Protected", "Writable", 0}},
{0x00000008, 3, "Persist", "PERSIST", 0, VALUES{"Protected", "Writable", 0}},
{0x00000030, 4, "Security", "SBITS", 0,
VALUES{"Protected", "[UNKNOWN 1]", "[UNKNOWN 2]", "Writable", 0}},
{0x00000040, 6, "Encrypt", "DEC", 0, VALUES{"Protected", "Writable", 0}},
{0x00000080, 7, "FARSRC", "FARSRC", 0, VALUES{"Protected", "Writable", 0}},
{0x00000100, 8, "GLUTMASK", "GLUTMASK", 0, VALUES{"Protected", "Writable", 0}},
{0x00001000, 12, "OverTempPowerDown", "OverTempPowerDown", 0,
VALUES{"Protected", "Writable", 0}},
{0x40000000, 30, "ICAP_sel", "ICAP_SEL", 0, VALUES{"Protected", "Writable", 0}},
{0x80000000, 31, "EFUSE_key", "EFUSE_KEY", 0, VALUES{"Protected", "Writable", 0}},
{0, 0, 0, 0, 0, 0}
}

Control Mask Register (MASK) subfields.

See Also
Control Register 0 (CTL0): UG470, v1.1, March 28, 2011, Table 5-22.

Definition at line 132 of file Virtex7.hpp.

const char * torc::bitstream::Virtex7::sOpcodeName
staticprotected
Initial value:
= {
"NOP", "READ", "WRITE", "RESERVED"
}

Packet Opcode names.

Definition at line 116 of file Virtex7.hpp.

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

Configuration controller registers.

Packet Type names.

Definition at line 114 of file Virtex7.hpp.

const char * torc::bitstream::Virtex7::sRegisterName
staticprotected
Initial value:
= {
"CRC", "FAR", "FDRI", "FDRO", "CMD", "CTL0", "MASK", "STAT", "LOUT", "COR0",
"MFWR", "CBC", "IDCODE", "AXSS", "COR1", "[UNKNOWN REG 15]","WBSTAR", "TIMER",
"[UNKNOWN REG 18]","[UNKNOWN REG 19]", "[UNKNOWN REG 20]", "[UNKNOWN REG 21]",
"BOOTSTS", "[UNKNOWN REG 23]", "CTL1"
}

Configuration Register names.

Definition at line 118 of file Virtex7.hpp.

const Bitstream::Subfield torc::bitstream::Virtex7::sSTAT
staticprotected

Status Register (STAT) subfields.

See Also
Status Register Description: UG470, v1.1, March 28, 2011, Table 5-25.

Definition at line 126 of file Virtex7.hpp.

const Bitstream::Subfield torc::bitstream::Virtex7::sTIMER
staticprotected
Initial value:
= {
{0x40000000, 30, "TimerForConfig", "TIMER_CFG_MON", 0,
VALUES{"Disabled", "Enabled", 0}},
{0x80000000, 31, "TimerForUser", "TIMER_USR_MON", 0,
VALUES{"Disabled", "Enabled", 0}},
{0, 0, 0, 0, 0, 0}
}

Watchdog Timer Register (TIMER) subfields.

See Also
TIMER Register Description: UG470, v1.1, March 28, 2011, Table 5-33.

Definition at line 136 of file Virtex7.hpp.

const Bitstream::Subfield torc::bitstream::Virtex7::sWBSTAR
staticprotected
Initial value:
= {
{0x40000000, 30, "NextRevisionSelect", "RS[1:0]", 0,
VALUES{"00", "01", "10", "11", 0}},
{0x20000000, 29, "RevisionSelectTristate", "RS_TS_B", 0,
VALUES{"Disabled", "Enabled", 0}},
{0, 0, 0, 0, 0, 0}
}

Warm Boot Start Address Register (WBSTAR) subfields.

See Also
WBSTAR Register Descrption: UG470, v1.1, March 28, 2011, Table 5-31.

Definition at line 134 of file Virtex7.hpp.


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