19 #ifndef TORC_BITSTREAM_VIRTEXPACKET_HPP
20 #define TORC_BITSTREAM_VIRTEXPACKET_HPP
23 #include <boost/smart_ptr.hpp>
32 namespace bitstream {
class VirtexPacketUnitTest; }
140 inStream.
read((
char*) &header,
sizeof(header));
141 header = ntohl(header);
164 inStream.read((
char*) &word,
sizeof(word));
166 }
else if(count > 1) {
168 inStream.read((
char*) raw_words, count << 2);
170 for(
uint32_t i = 0; i < count; i++, wordPtr++) *wordPtr = ntohl(*wordPtr);
176 void write(std::ostream& inStream)
const {
178 for(
uint32_t i = 0; i < size; i++) {
179 uint32_t word = htonl(
operator[](i));
180 inStream.write((
char*) &word,
sizeof(word));
199 inCount, 0, inWords);
235 if(inIndex == 0)
return mHeader;
270 #endif // TORC_BITSTREAM_VIRTEXPACKET_HPP
void write(std::ostream &inStream) const
Write a packet.
VirtexPacket(void)
Null constructor.
VirtexPacket(uint32_t inHeader, uint32_t inCount, uint32_t inWord, uint32_t *inWords)
Full constructor.
static VirtexPacket makeNullType1Write(uint32_t inAddress)
Construct a null type 1 write packet.
EOpcode
Packet opcode enumeration.
friend class torc::bitstream::bitstream::VirtexPacketUnitTest
boost::shared_array< uint32_t > WordSharedArray
Word shared array type.
uint32_t getWordSize(void) const
Returns the total number of words in the packet, including the header word.
static VirtexPacket makeType2Write(uint32_t inCount, uint32_t *inWords)
Construct a type 2 write packet.
VirtexPacket(uint32_t inHeader, uint32_t inWord)
Header plus single word constructor.
uint32_t getWordCount(void) const
Returns the number of payload words in the packet, excluding the header word.
VirtexPacket(const VirtexPacket &rhs)
Copy constructor.
static const char * sPacketTypeName[ePacketTypeCount]
Packet type names.
int getAddress(void) const
static const char * sOpcodeName[eOpcodeCount]
Packet opcode names.
bool isBusWidthSyncWord(void) const
bool isReserved(void) const
bool isDummyWord(void) const
Bitstream packet constants for Virtex class architectures.
std::vector< VirtexPacket > VirtexPacketVector
Vector of Virtex packets.
ESynchronization
Synchronization words.
bool isSyncWord(void) const
static VirtexPacket makeType1Write(uint32_t inAddress, uint32_t inWord)
Construct a type 1 write packet.
const WordSharedArray getWords(void) const
brief Returns the raw packet words, including the header word.
static VirtexPacket read(std::istream &inStream)
Read a packet.
EOpcode getOpcode(void) const
boost::uint32_t uint32_t
Imported type name.
EPacketType
Packet type enumeration.
EPacketType getType(void) const
bool isBusWidthDetectWord(void) const
Bitstream packet for Virtex class architectures.
static uint32_t makeHeader(EPacketType inType, EOpcode inOpcode, uint32_t inAddress, uint32_t inCount)
Construct a packet header.
uint32_t operator[](size_t inIndex) const
uint32_t getHeader(void) const
Header for endian conversion.
VirtexPacket(uint32_t inHeader)
Header only constructor.
static VirtexPacket makeType1Write(uint32_t inAddress, uint32_t inCount, uint32_t *inWords)
Construct a multi-word type 1 write packet.