260 std::fstream fileStream(referencePath.string().c_str(), std::ios::binary | std::ios::in);
261 std::cerr <<
"Trying to read: " << referencePath << std::endl;
262 BOOST_REQUIRE(fileStream.good());
264 bitstream.read(fileStream,
false);
269 typedef std::map<Virtex7::FrameAddress, Virtex7::FrameAddress> FrameAddressMap;
270 FrameAddressMap fars;
272 Virtex7::const_iterator p = bitstream.begin();
273 Virtex7::const_iterator e = bitstream.end();
274 uint32_t header = VirtexPacket::makeHeader(VirtexPacket::ePacketType1,
275 VirtexPacket::eOpcodeWrite, Virtex7::eRegisterLOUT, 1);
277 const VirtexPacket& packet = *p++;
278 if(packet.getHeader() != header)
continue;
279 Virtex7::FrameAddress far = packet[1];
280 Virtex7::FrameAddress base = far;
282 fars[base] = std::max(fars[base], far);
285 FrameAddressMap::const_iterator fp = fars.begin();
286 FrameAddressMap::const_iterator fe = fars.end();
288 const FrameAddressMap::value_type& value = *fp++;
297 bitstream.initializeDeviceInfo(inDeviceName);
298 bitstream.initializeFrameMaps();
302 Virtex7::FrameAddressToIndex farRemaining = bitstream.mFrameAddressToIndex;
303 Virtex7::FrameAddressToIndex farVisited;
305 bool enabled =
false;
306 Virtex7::const_iterator p = bitstream.begin();
307 Virtex7::const_iterator e = bitstream.end();
308 uint32_t header = VirtexPacket::makeHeader(VirtexPacket::ePacketType1,
309 VirtexPacket::eOpcodeWrite, Virtex7::eRegisterLOUT, 1);
310 uint32_t enable = VirtexPacket::makeHeader(VirtexPacket::ePacketType1,
311 VirtexPacket::eOpcodeWrite, Virtex7::eRegisterCMD, 1);
313 const VirtexPacket& packet = *p++;
314 if(packet.getHeader() == enable) enabled =
true;
315 if(!enabled)
continue;
316 if(packet.getHeader() != header)
continue;
317 Virtex7::FrameAddress far = packet[1];
319 Virtex7::FrameAddressToIndex::iterator found = farRemaining.find(far);
320 if(found != farRemaining.end()) {
321 farRemaining.erase(found);
323 std::cerr <<
"missing " << far <<
" ";
328 Virtex7::FrameAddressToIndex::const_iterator p = farRemaining.begin();
329 Virtex7::FrameAddressToIndex::const_iterator e = farRemaining.end();
331 std::cerr <<
"remaining " << (*p++).first <<
" ";
333 std::cerr << std::endl;
336 std::cout <<
"Device: " << inDeviceName << std::endl;
337 std::cout <<
"Size of farRemaining: " << farRemaining.size() << std::endl;
338 std::cout <<
"Size of farVisited: " << farVisited.size() << std::endl;
339 BOOST_CHECK_EQUAL(farRemaining.size(), 0u);
340 BOOST_CHECK_EQUAL(farVisited.size(), bitstream.mFrameAddressToIndex.size());
344 for(
int half = 0; half < 2; half++) {
346 for(uint32_t row = 0; row < 2; row++) {
347 typedef std::map<uint32_t, uint32_t> ColumnMaxFrame;
348 ColumnMaxFrame maxFrames[Virtex7::eFarBlockTypeCount];
349 Virtex7::const_iterator p = bitstream.begin();
350 Virtex7::const_iterator e = bitstream.end();
351 uint32_t header = VirtexPacket::makeHeader(VirtexPacket::ePacketType1,
352 VirtexPacket::eOpcodeWrite, Virtex7::eRegisterLOUT, 1);
354 const VirtexPacket& packet = *p++;
355 if(packet.getHeader() != header)
continue;
356 Virtex7::FrameAddress far = packet[1];
359 if(far.mTopBottom == half && far.mRow == row) {
361 ColumnMaxFrame::iterator i = maxFrames[far.mBlockType].find(far.mMajor);
362 if(i == maxFrames[far.mBlockType].end()) {
363 maxFrames[far.mBlockType][far.mMajor] = 0;
365 if(maxFrames[far.mBlockType][far.mMajor] < far.mMinor)
366 maxFrames[far.mBlockType][far.mMajor] = far.mMinor;
370 std::cerr << std::endl;
371 uint32_t frameCount = 0;
372 for(uint32_t i = 0; i < Virtex7::eFarBlockTypeCount; i++) {
373 Virtex7::EFarBlockType blockType = Virtex7::EFarBlockType(i);
374 uint32_t majorCount = maxFrames[blockType].size();
375 for(uint32_t major = 0; major < majorCount; major++) {
376 frameCount += maxFrames[blockType][major] + 1;
377 std::cerr << blockType <<
"(" << major <<
"): "
378 << (maxFrames[blockType][major] + 1) <<
" (" << frameCount <<
")"
boost::filesystem::path path