From 87d9538af92fa4c2d4814e0dd736415450ad94ae Mon Sep 17 00:00:00 2001 From: Rick Altherr Date: Mon, 22 Jan 2018 13:31:32 -0800 Subject: [PATCH] Return zero-fill packets when reading bitstreams Zero-fill packets are required in certain conditions to create valid bitstreams. When reading a bitstream, make sure they are yielded and printed. Signed-off-by: Rick Altherr --- lib/xilinx/xc7series/configuration_packet.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/xilinx/xc7series/configuration_packet.cc b/lib/xilinx/xc7series/configuration_packet.cc index f95fc4ae..bb241715 100644 --- a/lib/xilinx/xc7series/configuration_packet.cc +++ b/lib/xilinx/xc7series/configuration_packet.cc @@ -25,7 +25,11 @@ ConfigurationPacket::InitWithWords(absl::Span words, // NOPs. Since Type 0 packets don't exist according to // UG470 and they seem to be zero-filled, just consume // the bytes without generating a packet. - return {words.subspan(1), {}}; + return {words.subspan(1), + {{header_type, + Opcode::NOP, + ConfigurationRegister::CRC, + {}}}}; case 0x1: { Opcode opcode = static_cast( bit_field_get(words[0], 28, 27)); @@ -73,6 +77,10 @@ ConfigurationPacket::InitWithWords(absl::Span words, } std::ostream& operator<<(std::ostream& o, const ConfigurationPacket& packet) { + if (packet.header_type() == 0x0) { + return o << "[Zero-pad]" << std::endl; + } + switch (packet.opcode()) { case ConfigurationPacket::Opcode::NOP: o << "[NOP]" << std::endl;