19 #ifndef TORC_BITSTREAM_BITSTREAM_HPP
20 #define TORC_BITSTREAM_BITSTREAM_HPP
37 namespace bitstream {
class BitstreamUnitTest; }
69 inStream.write((
char*) &actual,
sizeof(actual));
74 inStream.write((
char*) &actual,
sizeof(actual));
79 inStream.write((
char*) &actual,
sizeof(actual));
84 uint16_t length = inString.length() + 1;
86 inStream.write(inString.c_str(), length);
92 inStream.read((
char*) &actual,
sizeof(actual));
94 return inExpected == actual;
100 inStream.read((
char*) &actual,
sizeof(actual));
102 return inExpected == ntohs(actual);
108 inStream.read((
char*) &actual,
sizeof(actual));
110 return inExpected == ntohl(actual);
127 inStream.read((
char*) &length,
sizeof(length));
128 length = ntohs(length);
131 char* buffer =
new char[length];
133 inStream.read(buffer, length);
135 outString.assign(buffer, length - 1);
142 static bool readHeader(std::istream& inStream,
string& outDesignName,
143 string& outDeviceName,
string& outDesignDate,
string& outDesignTime,
174 inStream.read((
char*) &outBitstreamLength,
sizeof(outBitstreamLength));
175 outBitstreamLength = ntohl(outBitstreamLength);
177 outHeaderLength = 34 + outDesignName.length() + outDeviceName.length()
178 + outDesignDate.length() + outDesignTime.length();
266 virtual void read(std::istream& inStream,
bool inCleanDateAndTime =
true) {
280 virtual void write(std::ostream& inStream) {
350 #endif // TORC_BITSTREAM_BITSTREAM_HPP
void setDesignTime(const string &inDesignTime)
Set the design time.
ColumnDefVector mColumnDefs
Column type widths.
static bool expect(std::istream &inStream, uint32_t inExpected)
Look for the expected uint32_t in the stream and return true if it matches.
void write(std::ostream &inStream, uint16_t inVal)
Write a uint16_t to the stream.
virtual void readHeader(std::istream &inStream)
Read the bitstream header.
const string & getDesignDate(void) const
Return the design date.
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.
TileTypeNameToColumnType mTileTypeNameToColumnType
static EDevice getDeviceEnum(const string &inName)
Returns the device enumeration corresponding to the given device name.
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.
EDevice
Enumeration of all supported devices.
torc::common::EDevice EDevice
Imported type name.
static bool expect(std::istream &inStream, uint16_t inExpected)
Look for the expected uint16_t in the stream and return true if it matches.
EFrameInclude
The frames to include in a partial bitstream. Use eFrameIncludeOnlyDirtyFrames to include only dirty...
string mDesignName
Header design name.
TileTypeIndexToColumnType mTileTypeIndexToColumnType
Static device information class for Xilinx bitstreams. This class facilitates the creation of frame ...
const string & getDesignTime(void) const
Return the design time.
virtual void write(std::ostream &inStream)
Write the bitstream header and packets to a stream.
void cleanDateAndTime(void)
Clean up the header date and time by replacing embedded spaces with zeros.
const string & getDeviceName(void) const
Return the device name.
uint32_t mDefault
The default subfield value.
EDevice mDevice
Bitstream device enumeration.
boost::uint8_t uint8_t
Imported type name.
friend std::ostream & operator<<(std::ostream &os, const Bitstream &rhs)
Insert the bitstream header into an output stream.
uint32_t mShift
The subfield LSB position.
virtual void updatePacketLength(void)
Update the header packet length.
static bool expect(std::istream &inStream, uint8_t inExpected)
Look for the expected uint8_t in the stream and return true if it matches.
const char * mConfigGuideName
The subfield name documented in the configuration guide.
const string & getDesignName(void) const
Return the design name.
boost::uint32_t uint32_t
Imported type name.
void write(std::ostream &inStream, uint32_t inVal)
Write a uint32_t to the stream.
void setDesignName(const string &inDesignName)
Set the design name.
void setDesignDate(const string &inDesignDate)
Set the design date.
Xilinx bitstream base class.
uint32_t mMask
The subfield bit mask.
string mDeviceName
Header device name.
DeviceInfo mDeviceInfo
Device information.
virtual void initializeDeviceInfo(const std::string &inDeviceName)
Initialize the maps between frame indexes and frame addresses. This is generally only useful for int...
static void readHeaderString(std::istream &inStream, string &outString)
Read and return a bitstream header string.
virtual void initializeFrameMaps(void)
Initialize the maps between frame indexes and frame addresses. This is generally only useful for int...
static void writeSubfieldSettings(std::ostream &inStream, uint32_t inWord, const Subfield *inSubfields)
Insert 32 bit subfield settings into an output stream.
friend class torc::bitstream::bitstream::BitstreamUnitTest
EBitstreamType
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.
Column definition vector.
Header for the Devices class.
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.
std::map< std::string, uint32_t > TileTypeNameToColumnType
Mapping from tile type names to column types.
virtual void readPackets(std::istream &inStream)
Read the bitstream packets.
const char * mBitgenName
The subfield name documented in bitgen.
void write(std::ostream &inStream, uint8_t inVal)
Write a uint8_t to the stream.
virtual uint32_t getFrameLength(void) const
Return the frame length for the current device.
std::string string
Imported type name.
boost::uint16_t uint16_t
Imported type name.
Bitstream(void)
Basic constructor.
virtual void preflightPackets(void)
Preflight the packets.
void setDeviceInfo(const DeviceInfo &rhs)
Assign static device information for the current bitstream.
std::map< uint16_t, uint32_t > TileTypeIndexToColumnType
Mapping from tile indexes to column types.
virtual void read(std::istream &inStream, bool inCleanDateAndTime=true)
Read the bitstream header and packets from a stream.
void setDeviceName(const string &inDeviceName)
Set the device name.
const char ** mValues
The allowable subfield values.
uint32_t getBitstreamByteLength(void) const
Return the bitstream packet length in bytes.
virtual void writeDeviceInfo(std::ostream &inStream, const std::string &inDeviceName)
Output static device information to a stream.
virtual ~Bitstream(void)
Virtual destructor.
Header for the EncapsulatedInteger template.
Header for endian conversion.
virtual void writeHeader(std::ostream &inStream)
Write the bitstream header to the stream.
virtual void writePackets(std::ostream &inStream)
Write the bitstream packets.
uint32_t getHeaderByteLength(void) const
Return the bitstream header length in bytes.
Header for the DeviceInfo class.