lowRISC / opentitan

OpenTitan: Open source silicon root of trust
https://www.opentitan.org
Apache License 2.0
2.59k stars 779 forks source link

[bitstreams] Detecting different bitstreams via the `usr_access` field #15818

Open milesdai opened 2 years ago

milesdai commented 2 years ago

We currently use the usr_access field in the bitstream to identify different versions of bitstreams (e.g. bitstreams with different ROMs or OTPs spliced in) when programming. By default, it contains the timestamp of the Vivado build, and currently, when we splice in different components, we update usr_access to contain the timestamp of the splicing operation.

The problem is that when Bazel splices multiple bitstreams simultaneously, these operations can end within one second of one another, leading to multiple spliced bitstreams with the same value. This can cause tests to fail due to opentitantool skipping the bitstream programming when it observes identical usr_access values.

There are a couple approaches we are considering to resolve this in the long run:

  1. Use a 32-bit hash of the bitstream (with the usr_access field zeroed out) as the new usr_access.
  2. Maintain the use of the time stamp for "official"/released bitstreams (i.e. RMA with testROM/ROM), and we force the usr_access values for the other bitstreams to be 0 (and set the rom_kind field in cw310_params to None to force a bitstream reprogramming).
milesdai commented 2 years ago

Note that I have assigned this to the Backlog Milestone since we can temporarily use #15758 (which implements option 1 above) to unblock E2E tests.

milesdai commented 2 years ago

CC: @cfrantz @alphan @dmcardle