opentitan icon indicating copy to clipboard operation
opentitan copied to clipboard

[chip,dv] How should the chip-level csr_rw tests understand regwen signals?

Open rswarbrick opened this issue 5 years ago • 7 comments

While trying to connect rom_ctrl to KMAC in #6373, I've stumbled into (yet) another problem. The chip-level csr_rw test is writing to KMAC's entropy_seed_lower register and then trying to read it back. Unfortunately, this is at the same time as rom_ctrl is using KMAC to do some processing.

This means that the write-enable signal for KMAC's registers is false. The result is that the write seems to go through, but has no effect. When we happen to read that register back a little later, we get the reset value instead of the value we were expecting, failing the test.

Presumably chip-level tests haven't seen this before because nothing was ever causing the write enable signal to be false on any blocks.

Approaches I can see to fix things:

  1. Disable all CSR tests for KMAC at chip level.
  2. Snoop on the write-enable signal somehow and factor that in to our calculation about whether a write should have any effect.
  3. Change the design to fail a bus transaction that writes when a write-enable is false.
  4. ... something else?

@sriyerg, @udinator, @cindychip, @weicaiyang: Any ideas?

At the moment, this is blocking rom_ctrl integration, so it's kind of urgent.

rswarbrick avatar May 27 '21 16:05 rswarbrick

Is entropy_seed_lower the only register that will cause this trouble? If so, maybe we can exclude writing this register?

cindychip avatar May 27 '21 16:05 cindychip

If a regwen is HW-controlled, the test has no way of predicting events that will cause it to trigger. If it is SW-controlled, then the our UVM reg extensions handle it.

The main question here is what's causing the ROM ctrl to use KMAC for processing? Is it the initial ROM checker kicking into action? If yes, then we should either:

  • Wait until ROM checker is complete before starting the CSR test
  • If its some previous write to a ROM ctrl CSR that triggered a repeat KMAC operation, then exclude that bit from writes
  • Force the kmac_cmd_o output of the ROM ctrl to 0 for the sake of this test (I dont prefer this).

The CSR tests are relatively dumb - their purpose is to only test whether the SW interface is solid. Any writes that cause side effects resulting in other CSRs being updated (or put the HW in state where the test cannot reliably complete successfully), those fields need to be excluded.

sriyerg avatar May 27 '21 16:05 sriyerg

I think we should either prevent the ROM from triggering a KMAC operation in the chip level automation tests (if possible), or try to wait until the ROM has finished using KMAC to access KMAC registers.

udinator avatar May 27 '21 16:05 udinator

You're right, this KMAC operation is triggered by rom_ctrl at start-up. I don't think that you'll be able to stop rom_ctrl from starting a KMAC operation without lots of hacky forced signals. Let's try postponing the csr_rw tests until it's done.

rswarbrick avatar May 28 '21 08:05 rswarbrick

I've just amended #6373 to wait as discussed. Let's close this issue once that's merged and seems to be working.

rswarbrick avatar May 28 '21 13:05 rswarbrick

Can this issue be closed now?

sriyerg avatar Aug 17 '21 04:08 sriyerg

Yes! Sorry for forgetting it.

rswarbrick avatar Aug 17 '21 10:08 rswarbrick