19 #include <boost/test/unit_test.hpp>
34 BOOST_AUTO_TEST_SUITE(bitstream)
40 /
"torc" /
"bitstream" /
"Spartan6UnitTest.reference.bit";
41 BOOST_CHECK(checkCRC<Spartan6>(regressionPath,
true));
49 /
"torc" /
"bitstream" /
"Spartan6UnitTest.reference.bit";
51 /
"regression" /
"Spartan6BistreamUnitTest.generated.bit";
54 std::fstream fileStream1(referencePath.string().c_str(), std::ios::binary | std::ios::in);
55 BOOST_REQUIRE(fileStream1.good());
57 bitstream1.
read(fileStream1,
false);
60 Spartan6::const_iterator p = bitstream1.begin();
61 Spartan6::const_iterator e = bitstream1.end();
63 if(p->isType2() && !p->isSyncWord1() && p->isWrite()) { frameContents = *p;
break; }
70 bitstream.
setDesignName(
"Spartan6UnitTest.reference.ncd;UserID=0xFFFFFFFF");
80 bitstream.insert(bitstream.end(), 8, dummy);
87 bitstream.push_back(nop);
125 bitstream.insert(bitstream.end(), 17, nop);
175 bitstream.push_back(nop);
176 bitstream.push_back(nop);
191 bitstream.push_back(frameContents);
193 uint16_t crcEndWord = 0x0015;
197 uint16_t* buffer =
new uint16_t[length];
198 uint16_t* ptr = buffer + length - 1;
199 while(ptr >= buffer) *ptr-- = 0x2000;
202 bitstream.insert(bitstream.end(), 9, nop);
210 bitstream.insert(bitstream.end(), 4, nop);
239 bitstream.insert(bitstream.end(), 14, nop);
242 std::fstream outputStream(generatedPath.string().c_str(), std::ios::binary | std::ios::out);
243 BOOST_REQUIRE(outputStream.good());
244 bitstream.
write(outputStream);
245 outputStream.flush();
248 std::fstream fileStream2(generatedPath.string().c_str(), std::ios::binary | std::ios::in);
249 BOOST_REQUIRE(fileStream2.good());
251 bitstream2.
read(fileStream2,
false);
253 std::cout << bitstream2 << std::endl;
254 std::cerr <<
"TYPEOF BITSTREAM: " <<
typeid(bitstream2).name() << std::endl;
261 BOOST_AUTO_TEST_SUITE_END()
void setDesignTime(const string &inDesignTime)
Set the design time.
Header for torc::bitstream output stream helpers.
Header for the Spartan6Bitstream class.
Header for the DirectoryTree class.
Bitstream packet for Spartan 16 bit class architectures.
Header for the DeviceDesignator class.
static uint16_t makeHeader(EPacketType inType, EOpcode inOpcode, uint16_t inAddress, uint32_t inCount)
Construct a packet header.
static Spartan6Packet makeType1Write(uint16_t inAddress, uint16_t inWord)
Construct a type 1 write packet.
Header for Boost.Test helper functions.
Header for Boost.Test helper functions.
Header for the Spartan6 class.
void setDesignName(const string &inDesignName)
Set the design name.
void setDesignDate(const string &inDesignDate)
Set the design date.
static uint16_t makeSubfield(ERegister inRegister, const std::string &inSubfield, const std::string &inSetting)
Return the masked value for a subfield of the specified register.
static Spartan6Packet makeType1Write32(uint16_t inAddress, uint32_t inWord)
Construct a type 1 write packet for two words.
boost::filesystem::path path
Header for the Spartan6Packet class.
void write(std::ostream &inStream, uint8_t inVal)
Write a uint8_t to the stream.
BOOST_AUTO_TEST_CASE(hexCharacterToDec)
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.
static const boost::filesystem::path & getExecutablePath(void)
Returns the absolute path to the executable directory.