| // 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", | |
| "hw/dv/tools/dvsim/testplans/stress_all_with_reset_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: dai_access_partition_walk | |
| desc: ''' | |
| Similar to UVM's memory walk test, this test ensures every address in each partition | |
| can be accessed successfully via DAI and TLUL interfacs according to its access policy. | |
| ''' | |
| milestone: V2 | |
| tests: ["otp_ctrl_partition_walk"] | |
| } | |
| { | |
| name: partition_check | |
| 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 | |
| Note that due to limited simulation time, for background checks, this test only write | |
| random value that is less than 'd20 to the check period. | |
| ''' | |
| milestone: V2 | |
| tests: ["otp_ctrl_check_fail", "otp_ctrl_background_chks"] | |
| } | |
| { | |
| name: init_fail | |
| desc: ''' | |
| This test is based on OTP_CTRL smoke test and creats OTP_CTRL's initialization failure: | |
| - Write and read OTP memory via DAI interface | |
| - Randomly issue DAI digest command to lock HW partitions | |
| - Keep writing to OTP memory via DAI interface | |
| - If digests are not locked, backdoor inject ECC correctable or uncorrectable errors | |
| - Issue reset and power initialization | |
| If fatal alert is triggered, this test will check: | |
| - Otp_initialization failure triggers fatal alert | |
| - Status register reflects the correct error | |
| - Otp_ctrl's power init output stays 0 | |
| If OTP init finished without fatal alert, this test will check: | |
| - OTP init finishes with power init output goes to 1 | |
| - Status and interrupt registers reflect the correct ecc correctable error | |
| ''' | |
| milestone: V2 | |
| tests: ["otp_ctrl_init_fail"] | |
| } | |
| { | |
| 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. | |
| Based on the DAI access sequence, this test will run key requests sequence in | |
| parallel, and check if generated keys are correct. | |
| ''' | |
| milestone: V2 | |
| tests: ["otp_ctrl_parallel_key_req"] | |
| } | |
| { | |
| name: lc_interactions | |
| desc: ''' | |
| This test check otp and life_cycle interactions. Based on the DAI access sequence, | |
| this test will run the following sequences in parallel: | |
| - State transitions via the programming interface | |
| - Token hashing | |
| - Trigger escalation_en | |
| ''' | |
| milestone: V2 | |
| tests: ["otp_ctrl_parallel_lc_req", "otp_ctrl_parallel_lc_esc"] | |
| } | |
| { 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: ["otp_ctrl_macro_errs"] | |
| } | |
| { | |
| 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: ["otp_ctrl_parallel_lc_esc", "otp_ctrl_check_fail"] | |
| } | |
| { | |
| 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: ["otp_ctrl_test_access"] | |
| } | |
| { | |
| 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: ["otp_ctrl_stress_all"] | |
| } | |
| ] | |
| } |