| // Copyright lowRISC contributors. |
| // Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| // SPDX-License-Identifier: Apache-2.0 |
| { |
| name: "otp_ctrl" |
| import_testplans: ["hw/dv/tools/dvsim/testplans/csr_testplan.hjson", |
| "hw/dv/tools/dvsim/testplans/mem_testplan.hjson", |
| "hw/dv/tools/dvsim/testplans/intr_test_testplan.hjson", |
| "hw/dv/tools/dvsim/testplans/alert_test_testplan.hjson", |
| "hw/dv/tools/dvsim/testplans/tl_device_access_types_testplan.hjson"] |
| entries: [ |
| { |
| name: wake_up |
| desc: ''' |
| Wake_up test walks through otp_ctrl's power-on initialization, read, program, and |
| digest functionalities. |
| |
| - Drive pwrmgr's request pin to trigger OTP initialization after reset, check status |
| after OTP initialization |
| - Write all-ones to a random address within OTP partition 0, wait until this operation |
| completes |
| - Read out the random selected write address, check if the readout value is all-ones |
| - Trigger a digest calculation for a Software partition, check if the OtpError |
| interrupt is set |
| - Trigger a digest calculation for a non-software partition, expect operation completes |
| without the OtpError interrupt |
| - Read out secrets through the hardware interfaces |
| ''' |
| milestone: V1 |
| tests: ["otp_ctrl_wake_up"] |
| } |
| { |
| name: smoke |
| desc: ''' |
| Otp_ctrl smoke test to provision and lock partitions. |
| |
| - Drive pwrmgr's request pin to trigger OTP initialization after reset, check status |
| after OTP initialization |
| - Read out keys from key_manager, flash, SRAM, OTBN |
| - Write random values to random addresses within each OTP partition |
| - Read out the random selected write addresses, check if the readout values are expected |
| - During read and write operations, check if direct_access_regwen is correctly set by HW |
| - Perform a system-level reset and check corresponding CSRs are set correctly |
| - Lock all partitions except life_cycle by triggering digest calculations |
| - Read back and verify the digest |
| - Perform a system-level reset to verify the corresponding CSRs exposing the digests |
| have been populated |
| ''' |
| milestone: V1 |
| tests: ["otp_ctrl_smoke"] |
| } |
| { |
| name: all_partitions |
| desc: ''' |
| Based on the smoke test, this test ensures every address in each partition can be accessed |
| successfully within its access policy. |
| ''' |
| milestone: V2 |
| tests: [] |
| } |
| { |
| name: partition_check_failure |
| desc: ''' |
| Randomly program partition check related registers including: `check_timeout`, |
| `integrity_check_period`, `consistency_check_period`, and `check_trigger`. |
| Then backdoor write OTP_macro to create parity, digest, and OTP memory errors |
| |
| - Check if the corresponding alerts are triggered |
| - Check if the error_code register is set correctly |
| ''' |
| milestone: V2 |
| tests: [] |
| } |
| { |
| name: regwen_during_otp_init |
| desc: ''' |
| DIRECT_ACCESS_REGWEN is RO reg and it gates bunch of write access of other registers, |
| which isn't tested in common CSR tests. HW will set this register to 0 when OTP_CTRL's |
| DAI interface is busy. |
| |
| Stimulus and checks: |
| - Random read DIRECT_ACCESS_REGWEN and ensure the value is set to 0 during OTP init. |
| - Test accessing registers gated by DIRECT_ACCESS_REGWEN is ignored during OTP init. |
| ''' |
| milestone: V2 |
| tests: ["otp_ctrl_regwen"] |
| } |
| { |
| name: partition_lock |
| desc: ''' |
| This test will cover two methods of locking read and write: digest calculation and CSR |
| write. After locking the partitions, issue read or program sequences and check if the |
| operations are locked correctly, and check if the `AccessError` is set. |
| ''' |
| milestone: V2 |
| tests: ["otp_ctrl_dai_lock"] |
| } |
| { |
| name: interface_key_check |
| desc: ''' |
| OTP_CTRL will generate keys to flash, sram, and OTBN upon their requests. |
| This test will randomly issue key requests from the above modules either before or |
| after partitions are locked, and check if generated keys are correct. |
| ''' |
| milestone: V2 |
| tests: ["otp_ctrl_rand_key_rsp"] |
| } |
| { |
| name: lc_interactions |
| desc: ''' |
| This test check otp and life_cycle interactions. |
| |
| - Initialize life_cycle, secret0, and secret2 partitions |
| - Check if `otp_lc_data_o` is asserted correctly |
| - Randomly issue the following three sequences: |
| - Seq 1. State transitions via the programming interface |
| - Seq 2. Token hashing |
| - Seq 3. Trigger escalation_en |
| ''' |
| milestone: V2 |
| tests: ["otp_ctrl_lc"] |
| } |
| { name: otp_dai_errors |
| desc: ''' |
| This test will randomly run the following OTP errors: |
| - DAI interface write non-blank OTP address |
| - DAI interface access LC partition |
| - DAI interface write HW digests |
| |
| The test will check: |
| - The value of err_code and status registers |
| ''' |
| milestone: V2 |
| tests: ["otp_ctrl_dai_errs"] |
| } |
| { name: otp_macro_errors |
| desc: ''' |
| This test will randomly run the following OTP errors: |
| - MacroError |
| - MacroEccCorrError |
| - MacroEccUncorrError |
| |
| The test will check: |
| - The value of err_code and status registers |
| - If error is unrecoverable, ensure that OTP entered terminal state |
| ''' |
| milestone: V2 |
| tests: [] |
| } |
| { |
| name: otp_ctrl_errors |
| desc: ''' |
| This test will randomly run the following OTP errors: |
| - CheckFailError |
| - FsmStateError |
| |
| The test will check: |
| - The value of err_code and status registers |
| - If error is unrecoverable, ensure that OTP entered terminal state |
| ''' |
| milestone: V2 |
| tests: [] |
| } |
| { |
| name: test_access |
| desc: ''' |
| This test checks if the test access to OTP macro is connected correctly. |
| |
| - Read out from the test access window and ensure no error occurs |
| ''' |
| milestone: V2 |
| tests: [] |
| } |
| { |
| name: stress_all |
| desc: ''' |
| - Combine above sequences in one test to run sequentially, except csr sequence |
| - Randomly add reset between each sequence |
| ''' |
| milestone: V2 |
| tests: [] |
| } |
| ] |
| } |