From 6222be77d33d3b92bb8b7f272ff456750d81dbdf Mon Sep 17 00:00:00 2001 From: Rick Altherr Date: Thu, 4 Jan 2018 15:14:08 -0800 Subject: [PATCH] lib: xc7series: Account for padding between rows in bitstreams There seem to be 2 frames of padding between rows in a bitstream. For single-frame writes, these are parsed as type 0 packets and ignored. Normal bitstreams use a single FDRI write that apparently includes this padding and needs to be ignored in the auto-increment handling. Signed-off-by: Rick Altherr --- .../prjxray/xilinx/xc7series/configuration.h | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/include/prjxray/xilinx/xc7series/configuration.h b/lib/include/prjxray/xilinx/xc7series/configuration.h index 8d9984a5..2ed63e38 100644 --- a/lib/include/prjxray/xilinx/xc7series/configuration.h +++ b/lib/include/prjxray/xilinx/xc7series/configuration.h @@ -112,20 +112,25 @@ absl::optional Configuration::InitWithPackets( // 7-series frames are 101-words long. Writes to this // register can be multiples of that to do // auto-incrementing block writes. - int frames_written = packet.data().size() / - kWordsPerFrame; - - for (int ii = 0; ii < frames_written; ++ii) { + for (size_t ii = 0; + ii < packet.data().size(); + ii += kWordsPerFrame) { frames[current_frame_address] = packet.data().subspan( - ii * kWordsPerFrame, - kWordsPerFrame); + ii, kWordsPerFrame); + auto next_address = part.GetNextConfigurationFrameAddress( current_frame_address); - if (next_address) { - current_frame_address = *next_address; + if (!next_address) break; + + // Bitstreams appear to have 2 frames of + // padding between rows. + if (next_address->row_address() != + current_frame_address.row_address()) { + ii += 2 * kWordsPerFrame; } + current_frame_address = *next_address; } break; }