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