Testplan

Testpoints

Stage V1 Testpoints

smoke

Test: sram_ctrl_smoke

This test performs basic SRAM initialization procedure and tests basic memory function:

  • Initialize SRAM memory to zero
  • Perform some random memory operations, verify that they all succeed with an all-zero key and nonce
  • Request a new scrambling key from the OTP interface and verify that:
    • A valid key is received
    • The key seed used by OTP is valid
  • Perform a number of random memory accesses to the SRAM, verify that all accesses were executed correctly using the mem_bkdr_util

csr_hw_reset

Test: sram_ctrl_csr_hw_reset

Verify the reset values as indicated in the RAL specification.

  • Write all CSRs with a random value.
  • Apply reset to the DUT as well as the RAL model.
  • Read each CSR and compare it against the reset value. it is mandatory to replicate this test for each reset that affects all or a subset of the CSRs.
  • It is mandatory to run this test for all available interfaces the CSRs are accessible from.
  • Shuffle the list of CSRs first to remove the effect of ordering.

csr_rw

Test: sram_ctrl_csr_rw

Verify accessibility of CSRs as indicated in the RAL specification.

  • Loop through each CSR to write it with a random value.
  • Read the CSR back and check for correctness while adhering to its access policies.
  • It is mandatory to run this test for all available interfaces the CSRs are accessible from.
  • Shuffle the list of CSRs first to remove the effect of ordering.

csr_bit_bash

Test: sram_ctrl_csr_bit_bash

Verify no aliasing within individual bits of a CSR.

  • Walk a 1 through each CSR by flipping 1 bit at a time.
  • Read the CSR back and check for correctness while adhering to its access policies.
  • This verify that writing a specific bit within the CSR did not affect any of the other bits.
  • It is mandatory to run this test for all available interfaces the CSRs are accessible from.
  • Shuffle the list of CSRs first to remove the effect of ordering.

csr_aliasing

Test: sram_ctrl_csr_aliasing

Verify no aliasing within the CSR address space.

  • Loop through each CSR to write it with a random value
  • Shuffle and read ALL CSRs back.
  • All CSRs except for the one that was written in this iteration should read back the previous value.
  • The CSR that was written in this iteration is checked for correctness while adhering to its access policies.
  • It is mandatory to run this test for all available interfaces the CSRs are accessible from.
  • Shuffle the list of CSRs first to remove the effect of ordering.

csr_mem_rw_with_rand_reset

Test: sram_ctrl_csr_mem_rw_with_rand_reset

Verify random reset during CSR/memory access.

  • Run csr_rw sequence to randomly access CSRs
  • If memory exists, run mem_partial_access in parallel with csr_rw
  • Randomly issue reset and then use hw_reset sequence to check all CSRs are reset to default value
  • It is mandatory to run this test for all available interfaces the CSRs are accessible from.

regwen_csr_and_corresponding_lockable_csr

Tests:

  • sram_ctrl_csr_rw
  • sram_ctrl_csr_aliasing

Verify regwen CSR and its corresponding lockable CSRs.

  • Randomly access all CSRs
  • Test when regwen CSR is set, its corresponding lockable CSRs become read-only registers

Note:

  • If regwen CSR is HW read-only, this feature can be fully tested by common CSR tests - csr_rw and csr_aliasing.
  • If regwen CSR is HW updated, a separate test should be created to test it.

This is only applicable if the block contains regwen and locakable CSRs.

mem_walk

Test: sram_ctrl_mem_walk

Verify accessibility of all memories in the design.

  • Run the standard UVM mem walk sequence on all memories in the RAL model.
  • It is mandatory to run this test from all available interfaces the memories are accessible from.

mem_partial_access

Test: sram_ctrl_mem_partial_access

Verify partial-accessibility of all memories in the design.

  • Do partial reads and writes into the memories and verify the outcome for correctness.
  • Also test outstanding access on memories

Stage V2 Testpoints

multiple_keys

Test: sram_ctrl_multiple_keys

In this test we request multiple scrambling keys from OTP and verify that the memory scrambling is performed correctly even with multiple seeds. Perform the following steps:

  • Initialize the memory to zero
  • Perform some random memory operations, verify that they succeed with an all-zero key and nonce
  • Repeat the following steps a number of times:
    • Get a scrambling key from the OTP interface
    • Perform a number of random memory accesses to the SRAM
  • Verify that all memory access succeed even if the scrambling key changes at arbitrary intervals

stress_pipeline

Test: sram_ctrl_stress_pipeline

This test is the same as the multiple_keys_test but we now do a series of back-to-back memory accesses at each random address in order to create read/write conflicts and stress the encryption pipeline.

bijection

Test: sram_ctrl_bijection

In this test we iterate through each address in the SRAM memory. For each address write the current address to the SRAM.

After this is done, read every address and check that the stored data is equivalent to the current address.

This will verify that the SRAM encryption mechanism is actually bijective, and will not cause any address collisions.

e.g. if the encryption scheme causes addresses 0x1 and 0x2 to collide and we write 0x1 and 0x2 respectively, we will see a return value of 0x2 when we read from 0x1, instead of the expected 0x1.

This process will be repeated for a number of new key seeds.

access_during_key_req

Test: sram_ctrl_access_during_key_req

This test is the same as the multiple_keys test, except we make sure to sequence some memory transactions while a key request to OTP is still pending. Verify that these transactions are completely ignored by the memory.

lc_escalation

Test: sram_ctrl_lc_escalation

This test is the same as the multiple_keys test, except we now randomly assert the lifecycle escalation signal. Upon sending an escalation request, we verify that the DUT has properly latched it, and all scrambling state has been reset. In this state, we perform some memory accesses, they should all be blocked and not go through. We then issue a reset to the SRAM to get it out of the terminal state, and issue a couple of memory accesses just to make sure everything is still in working order.

executable

Test: sram_ctrl_executable

This test is intended to test the “execute from SRAM” feature, in which TLUL memory transactions tagged with the InstrType value in the user bits are allowed to be handled by the SRAM memory.

This behavior is enabled by either setting the exec CSR to 1 or by driving a second lifecycle input to On - both of these are muxed between with a otp_en_sram_ifetch_i input from the OTP controller.

If this functionality is disabled, any memory transaction NOT tagged as DataType should error out, however DataType transactions should be successful when the SRAM is configured to be executable.

partial_access

Tests:

  • sram_ctrl_partial_access
  • sram_ctrl_partial_access_b2b

This test is intended to test a lot of partial accesses with random addresses or back-to-back accesses.

Reuse the smoke and stress_pipeline by setting partial_access_pct = 90%

max_throughput

Tests:

  • sram_ctrl_max_throughput
  • sram_ctrl_throughput_w_partial_write

This test is intended to test the max throughput of the SRAM.

Without partial write, if driver doesn’t introduce any delay, it takes N+1 cycles to finish N SRAM read/write accesses. With partial write, it needs 2 extra cycles per partial write.

regwen

Test: sram_ctrl_regwen

This test is intended to test exec_regwen, ctrl_regwen, and readback_regwen as well as their related CSRs.

ctrl_regwen related CSRs (renew_scr_key and init) are excluded from CSR tests as they affects other CSRs. readback_regwen related CSRs are excluded from CSR tests as they affect other CSRs. exec_regwen and its related CSRs are tested in CSR tests, but this exec relates to other sram inputs (en_sram_ifetch and hw_debug_en), so also test it in this test.

Both exec_regwen and ctrl_regwen as well as their related CSRs will be programmed at the beginning of each iteration. So when regwen is cleared, the related CSRs will be locked.

ram_cfg

Test: sram_ctrl_ram_cfg

Test cfg_i connectivity between sram_ctrl and prim_ram_1p.

Randomly set dut.cfg_i and check its value is propagated to prim_mem_1p.

stress_all

Test: sram_ctrl_stress_all

  • Combine above sequences in one test to run sequentially, except csr sequence and sequences that require zero_delays or invoke reset (such as lc_escalation).
  • Randomly add reset between each sequence

alert_test

Test: sram_ctrl_alert_test

Verify common alert_test CSR that allows SW to mock-inject alert requests.

  • Enable a random set of alert requests by writing random value to alert_test CSR.
  • Check each alert_tx.alert_p pin to verify that only the requested alerts are triggered.
  • During alert_handshakes, write alert_test CSR again to verify that: If alert_test writes to current ongoing alert handshake, the alert_test request will be ignored. If alert_test writes to current idle alert handshake, a new alert_handshake should be triggered.
  • Wait for the alert handshakes to finish and verify alert_tx.alert_p pins all sets back to 0.
  • Repeat the above steps a bunch of times.

tl_d_oob_addr_access

Test: sram_ctrl_tl_errors

Access out of bounds address and verify correctness of response / behavior

tl_d_illegal_access

Test: sram_ctrl_tl_errors

Drive unsupported requests via TL interface and verify correctness of response / behavior. Below error cases are tested bases on the TLUL spec

  • TL-UL protocol error cases
    • invalid opcode
    • some mask bits not set when opcode is PutFullData
    • mask does not match the transfer size, e.g. a_address = 0x00, a_size = 0, a_mask = 'b0010
    • mask and address misaligned, e.g. a_address = 0x01, a_mask = 'b0001
    • address and size aren’t aligned, e.g. a_address = 0x01, a_size != 0
    • size is greater than 2
  • OpenTitan defined error cases
    • access unmapped address, expect d_error = 1
    • write a CSR with unaligned address, e.g. a_address[1:0] != 0
    • write a CSR less than its width, e.g. when CSR is 2 bytes wide, only write 1 byte
    • write a memory with a_mask != '1 when it doesn’t support partial accesses
    • read a WO (write-only) memory
    • write a RO (read-only) memory
    • write with instr_type = True

tl_d_outstanding_access

Tests:

  • sram_ctrl_csr_hw_reset
  • sram_ctrl_csr_rw
  • sram_ctrl_csr_aliasing
  • sram_ctrl_same_csr_outstanding

Drive back-to-back requests without waiting for response to ensure there is one transaction outstanding within the TL device. Also, verify one outstanding when back- to-back accesses are made to the same address.

tl_d_partial_access

Tests:

  • sram_ctrl_csr_hw_reset
  • sram_ctrl_csr_rw
  • sram_ctrl_csr_aliasing
  • sram_ctrl_same_csr_outstanding

Access CSR with one or more bytes of data. For read, expect to return all word value of the CSR. For write, enabling bytes should cover all CSR valid fields.

Stage V2S Testpoints

passthru_mem_tl_intg_err

Test: sram_ctrl_passthru_mem_tl_intg_err

Verify data integrity is stored in the passthru memory rather than generated after a read.

  • Randomly read a memory location and check the data integrity is correct.
  • Backdoor inject fault into this location.
  • Check the data integrity is incorrect but there is no d_error as the memory block should just pass the stored data and integrity to the processor where the integrity is compared.
  • Above sequences will be run with csr_rw_vseq to ensure it won’t affect CSR accesses.

tl_intg_err

Tests:

  • sram_ctrl_tl_intg_err
  • sram_ctrl_sec_cm

Verify that the data integrity check violation generates an alert.

  • Randomly inject errors on the control, data, or the ECC bits during CSR accesses. Verify that triggers the correct fatal alert.
  • Inject a fault at the onehot check in u_reg.u_prim_reg_we_check and verify the corresponding fatal alert occurs

prim_count_check

Test: sram_ctrl_sec_cm

Verify that violating prim_count counter properties generate a fatal alert.

Stimulus:

  • At the falling edge (non-active edge), force the counter to a different value than expected.
  • Randomly force the counter back to a normal value to ensure the error is latched and won’t go away until reset.
  • Within the next few cycles, the violation of hardened counter property should generate a fatal alert.
  • Repeat for ALL prim_count instances in the DUT.

Checks:

  • Check that fatal alert is triggered.
  • Check that err_code/fault_status is updated correctly and preserved until reset.
  • Verify any operations that follow fail (as applicable).

sec_cm_bus_integrity

Test: sram_ctrl_tl_intg_err

Verify the countermeasure(s) BUS.INTEGRITY.

sec_cm_ctrl_config_regwen

Test: sram_ctrl_regwen

Verify the countermeasure(s) CTRL.CONFIG.REGWEN.

The ctrl CSR is excluded in CSR tests, add another test to verify:

  • When ctrl_regwen is 1, writing to ctrl can take effect.
  • When ctrl_regwen is 0, writing to ctrl has no effect.

sec_cm_readback_config_regwen

Test: sram_ctrl_regwen

Verify the countermeasure(s) READBACK.CONFIG.REGWEN.

The readback CSR is excluded in CSR tests, add another test to verify:

  • When readback_regwen is 1, writing to readback can take effect.
  • When readback_regwen is 0, writing to readback has no effect.

sec_cm_exec_config_regwen

Test: sram_ctrl_csr_rw

Verify the countermeasure(s) EXEC.CONFIG.REGWEN.

sec_cm_exec_config_mubi

Test: sram_ctrl_executable

Verify the countermeasure(s) EXEC.CONFIG.MUBI.

Refer to the testpoint executable for the detail scenario.

sec_cm_exec_intersig_mubi

Test: sram_ctrl_executable

Verify the countermeasure(s) EXEC.INTERSIG.MUBI.

Refer to the testpoint executable for the detail scenario. cip_mubi_cov_if is bound to this port.

sec_cm_lc_hw_debug_en_intersig_mubi

Test: sram_ctrl_executable

Verify the countermeasure(s) LC_HW_DEBUG_EN.INTERSIG.MUBI.

Refer to the testpoint executable for the detail scenario. cip_mubi_cov_if is bound to this port.

sec_cm_lc_escalate_en_intersig_mubi

Test: sram_ctrl_lc_escalation

Verify the countermeasure(s) LC_ESCALATE_EN.INTERSIG.MUBI.

Refer to the testpoint lc_escalation for the detail scenario. cip_lc_tx_cov_if is bound to this port.

sec_cm_mem_integrity

Test: sram_ctrl_passthru_mem_tl_intg_err

Verify the countermeasure(s) MEM.INTEGRITY.

sec_cm_mem_readback

Test: sram_ctrl_readback_err

Verify the countermeasure(s) MEM.READBACK.

Injects bit-flips during memory reads/writes and checks whether an error is triggered.

sec_cm_mem_scramble

Test: sram_ctrl_smoke

Verify the countermeasure(s) MEM.SCRAMBLE.

This is verified in all non-CSR tests.

sec_cm_addr_scramble

Test: sram_ctrl_smoke

Verify the countermeasure(s) ADDR.SCRAMBLE.

This is verified in all non-CSR tests.

sec_cm_instr_bus_lc_gated

Test: sram_ctrl_executable

Verify the countermeasure(s) INSTR.BUS.LC_GATED.“

Refer to the testpoint executable for the detail scenario.

sec_cm_ram_tl_lc_gate_fsm_sparse

Test: sram_ctrl_sec_cm

Verify the countermeasure(s) RAM_TL_LC_GATE.FSM.SPARSE.

sec_cm_key_global_esc

Test: sram_ctrl_lc_escalation

Verify the countermeasure(s) KEY.GLOBAL_ESC.

sec_cm_key_local_esc

Test: sram_ctrl_sec_cm

Verify the countermeasure(s) KEY.LOCAL_ESC.

Besides the stimulus and checks mentioned in `prim_count_check``, also have following checks:

  • Check internal key/nonce are reset to the default values.
  • Check SRAM access is blocked after a fault injection.

sec_cm_init_ctr_redun

Test: sram_ctrl_sec_cm

Verify the countermeasure(s) INIT.CTR.REDUN.

Besides the stimulus and checks mentioned in prim_count_check and sec_cm_key_local_esc, also have following checks:

  • Check alert and status.init_error is set.

sec_cm_scramble_key_sideload

Test: sram_ctrl_smoke

Verify the countermeasure(s) SCRAMBLE.KEY.SIDELOAD.

Simulation can’t really prove that the sideload key is unreachable by SW. However, from defined CSRs and memory returned data, there is no way to read scramble key by SW.

sec_cm_tlul_fifo_ctr_redun

Test: sram_ctrl_sec_cm

Verify the countermeasure(s) TLUL_FIFO.CTR.REDUN.

Stage V3 Testpoints

stress_all_with_rand_reset

Test: sram_ctrl_stress_all_with_rand_reset

This test runs 3 parallel threads - stress_all, tl_errors and random reset. After reset is asserted, the test will read and check all valid CSR registers.

Covergroups

access_during_key_req_cg

Covers that SRAM handles memory accesses during key requests.

b2b_access_types_cg

  • Covers that any combination of access types (R/R, R/W, W/R, W/W) can be present in b2b transaction scenarios.
  • Covers b2b access with the same address.
  • Covers b2b access with partial access or not.
  • Cross all above cases.

executable_cg

Covers the various important scenarios that can enable SRAM executability. Crosses CSR exec, input lc_hw_debug_en and input sram_ifetch.

key_seed_valid_cg

Covers SRAM receiving a key from OTP in Off/On states, with both valid and invalid key seeds.

lc_escalation_idle_cg

Covers the assertion of LC escalation occurs during idle or SRAM memory access.

regwen_val_when_new_value_written_cg

Cover each lockable reg field with these 2 cases:

  • When regwen = 1, a different value is written to the lockable CSR field, and a read occurs after that.
  • When regwen = 0, a different value is written to the lockable CSR field, and a read occurs after that.

This is only applicable if the block contains regwen and locakable CSRs.

subword_access_cg

Covers that all possible types of subword accesses (both reads and writes) have been performed.

tl_errors_cg

Cover the following error cases on TL-UL bus:

  • TL-UL protocol error cases.
  • OpenTitan defined error cases, refer to testpoint tl_d_illegal_access.

tl_intg_err_cg

Cover all kinds of integrity errors (command, data or both) and cover number of error bits on each integrity check.

Cover the kinds of integrity errors with byte enabled write on memory if applicable: Some memories store the integrity values. When there is a subword write, design re-calculate the integrity with full word data and update integrity in the memory. This coverage ensures that memory byte write has been issued and the related design logic has been verfied.