Skip to content

WIP Compressed bitstream support - #1

Closed
hansfbaier wants to merge 23 commits into
openXC7:masterfrom
hansfbaier:compressed-bitstream
Closed

WIP Compressed bitstream support#1
hansfbaier wants to merge 23 commits into
openXC7:masterfrom
hansfbaier:compressed-bitstream

Conversation

@hansfbaier

Copy link
Copy Markdown

This is a temporary PR to run the CI for f4pga#2060

hansfbaier and others added 23 commits December 14, 2022 05:15
Signed-off-by: Hans Baier <hansfbaier@gmail.com>
Signed-off-by: Hans Baier <hansfbaier@gmail.com>
…duces specimens to 40

Signed-off-by: Hans Baier <hansfbaier@gmail.com>
…e banks

Signed-off-by: Hans Baier <hansfbaier@gmail.com>
Signed-off-by: Hans Baier <hansfbaier@gmail.com>
…4pga#2075)

Bumps [third_party/abseil-cpp](https://github.com/abseil/abseil-cpp) from `522606b` to `71927b4`.
- [Release notes](https://github.com/abseil/abseil-cpp/releases)
- [Commits](abseil/abseil-cpp@522606b...71927b4)

---
updated-dependencies:
- dependency-name: third_party/abseil-cpp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…4pga#2074)

Bumps [third_party/googletest](https://github.com/google/googletest) from `1f643f7` to `3fa7f98`.
- [Release notes](https://github.com/google/googletest/releases)
- [Commits](google/googletest@1f643f7...3fa7f98)

---
updated-dependencies:
- dependency-name: third_party/googletest
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…a#2079)

Bumps [third_party/yosys](https://github.com/YosysHQ/yosys) from `7ad7b55` to `3ebc50d`.
- [Release notes](https://github.com/YosysHQ/yosys/releases)
- [Commits](YosysHQ/yosys@7ad7b55...3ebc50d)

---
updated-dependencies:
- dependency-name: third_party/yosys
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…4pga#2081)

Bumps [third_party/abseil-cpp](https://github.com/abseil/abseil-cpp) from `71927b4` to `6abc195`.
- [Release notes](https://github.com/abseil/abseil-cpp/releases)
- [Commits](abseil/abseil-cpp@71927b4...6abc195)

---
updated-dependencies:
- dependency-name: third_party/abseil-cpp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [third_party/sanitizers-cmake](https://github.com/arsenm/sanitizers-cmake) from `99e159e` to `a6748f4`.
- [Release notes](https://github.com/arsenm/sanitizers-cmake/releases)
- [Commits](arsenm/sanitizers-cmake@99e159e...a6748f4)

---
updated-dependencies:
- dependency-name: third_party/sanitizers-cmake
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…a#2083)

Bumps [third_party/yosys](https://github.com/YosysHQ/yosys) from `3ebc50d` to `f2c6894`.
- [Release notes](https://github.com/YosysHQ/yosys/releases)
- [Commits](YosysHQ/yosys@3ebc50d...f2c6894)

---
updated-dependencies:
- dependency-name: third_party/yosys
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…4pga#2085)

Bumps [third_party/abseil-cpp](https://github.com/abseil/abseil-cpp) from `6abc195` to `625a180`.
- [Release notes](https://github.com/abseil/abseil-cpp/releases)
- [Commits](abseil/abseil-cpp@6abc195...625a180)

---
updated-dependencies:
- dependency-name: third_party/abseil-cpp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…a#2088)

Bumps [third_party/yosys](https://github.com/YosysHQ/yosys) from `f2c6894` to `956c4e4`.
- [Release notes](https://github.com/YosysHQ/yosys/releases)
- [Commits](YosysHQ/yosys@f2c6894...956c4e4)

---
updated-dependencies:
- dependency-name: third_party/yosys
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…4pga#2087)

Bumps [third_party/googletest](https://github.com/google/googletest) from `3fa7f98` to `356fc30`.
- [Release notes](https://github.com/google/googletest/releases)
- [Commits](google/googletest@3fa7f98...356fc30)

---
updated-dependencies:
- dependency-name: third_party/googletest
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…4pga#2086)

Bumps [third_party/abseil-cpp](https://github.com/abseil/abseil-cpp) from `625a180` to `bb63a76`.
- [Release notes](https://github.com/abseil/abseil-cpp/releases)
- [Commits](abseil/abseil-cpp@625a180...bb63a76)

---
updated-dependencies:
- dependency-name: third_party/abseil-cpp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…a#2092)

Bumps [third_party/yosys](https://github.com/YosysHQ/yosys) from `956c4e4` to `611f71c`.
- [Release notes](https://github.com/YosysHQ/yosys/releases)
- [Commits](YosysHQ/yosys@956c4e4...611f71c)

---
updated-dependencies:
- dependency-name: third_party/yosys
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…4pga#2091)

Bumps [third_party/googletest](https://github.com/google/googletest) from `356fc30` to `ec25eea`.
- [Release notes](https://github.com/google/googletest/releases)
- [Commits](google/googletest@356fc30...ec25eea)

---
updated-dependencies:
- dependency-name: third_party/googletest
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…4pga#2090)

Bumps [third_party/abseil-cpp](https://github.com/abseil/abseil-cpp) from `bb63a76` to `4eef161`.
- [Release notes](https://github.com/abseil/abseil-cpp/releases)
- [Commits](abseil/abseil-cpp@bb63a76...4eef161)

---
updated-dependencies:
- dependency-name: third_party/abseil-cpp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Lakira Ashley <lakridesagain@gmail.com>
Signed-off-by: Lakira Ashley <lakridesagain@gmail.com>
Signed-off-by: Lakira Ashley <lakridesagain@gmail.com>
Signed-off-by: Lakira Ashley <lakridesagain@gmail.com>
@hansfbaier hansfbaier closed this Jan 26, 2023
@hansfbaier
hansfbaier deleted the compressed-bitstream branch January 26, 2023 07:43
colin-rushton-qss added a commit to Quantum-Serendipity/prjxray that referenced this pull request Aug 15, 2026
Every full bitstream this writer emits is a CRC-DISABLED bitstream, and
nothing said so. createConfigurationPackage()'s finalization sequence puts
two CMD:RCRC writes in the two positions where a Vivado full bitstream puts
two writes to the CRC register:

    ... frame data ...  CRC <= v1  CMD:GRESTORE  CMD:DGHIGH
    CMD:START  FAR <= 0x03be0000  MASK  CTL0  CRC <= v2  CMD:DESYNC

Read out of Vivado 2025.2's own pt_v2_soc_fn.bit for 7a100tfgg484: two CRC
words, 0x10c41b1c and 0x615009a6, in exactly those two slots. Substituting
CMD:RCRC for each is not a different stream shape -- it is bit-for-bit what
BITSTREAM.GENERAL.CRC=DISABLE does, the same two-word substitution the
partial path already documents (0x30000001,<crc> <-> 0x30008001,0x00000007).

So the device's own configuration-integrity check never runs on anything
this tool writes, and the cost of that is measured rather than argued. On
an XC7A100T (Alchitry Pt V2, fgg484), a single flipped configuration bit in
a 3.8 MB stream -- one byte, one bit, with the frame ECC left stale --
loaded to DONE=1 with "No CRC error" and "No ID error", and the resulting
design ran at 11,525.6 B/s against a same-board control of 292.5 B/s. One
bit, accepted, 39x wrong.

  --emit_crc replaces each of those two CMD:RCRC writes, in place, with a
  Type-1 write of computeStreamCrc() over everything that precedes it.

computeStreamCrc() is the existing Series7 model added for the partial path:
reflected CRC-32C (0x82F63B78), data[31:0] then addr[4:0] LSB-first, every
register write accumulated except a write to the CRC register, a CRC write
resets the accumulator, CMD:RCRC resets and consumes its own write. It is
called at the moment of emission rather than precomputed, because a CRC
write is itself a reset and the second value therefore covers only what
follows the first.

Evidence that the value is right and not merely plausible: the same model,
replayed by an independent implementation, reproduces BOTH of Vivado's own
full-bitstream CRC words on this die (2/2) and its partial-bitstream CRC on
three reference modules (1/1 in 3 of 3). Emitting a 3.8 MB bitstream with
--emit_crc and replaying it gives 2 CRC words, 2/2 observed == computed;
flipping one configuration bit in the frame data gives 1/2, with the first
CRC mismatching and the second -- which accumulates nothing before it --
still matching.

OFF BY DEFAULT, and that is a decision rather than caution. Turning it on
changes the payload of every full bitstream the toolchain builds, and
hundreds of recorded payload hashes identify artefacts by exactly that
payload. Measured: without the flag, this build reproduces an existing
3,825,977-byte artefact byte-for-byte from the sync word
(bde03029d76fcff4cbdcf8c0ffbfd010e1493f3df40adba98a7b0bc3ebf292a3); with
it, 4 of 956,435 payload words move and they are the two substitutions.

--crc {compute,disable} keeps steering the PARTIAL path only and its help
text now says so. --emit_crc together with --partial_bitstream is refused
rather than ignored: a flag that silently does nothing is a check that
never runs.

createConfigurationPackage() gains a `bool emit_crc` parameter on all four
architecture specializations. xc7patch passes false, so its output does not
move.

Three tests, in lib/xilinx/tests/xc7series/configuration_test.cc:

  FullPackageCrcEmissionIsATwoWordSubstitution -- with and against without,
      exactly 2 register-sequence entries differ, each CRC against
      CMD:RCRC; the CRC-disabled package still carries 3 CMD:RCRC writes
      and the CRC-enabled one carries 1.
  FullPackageCrcIsTheAccumulatorAtEachWrite -- each emitted CRC equals
      computeStreamCrc() of the packets that precede it, there are exactly
      two, and they differ from each other.
  FullPackageCrcMovesWhenOneFrameWordMoves -- flip one bit of frame data:
      CRC openXC7#1 must move and CRC openXC7#2 must not.

The last two were seen to FAIL, not merely to pass: replacing the computed
value with a constant leaves the substitution test green and turns both of
the others red, which is the split of duties they were written to have.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants