km_csr

Wrap the PeakRDL-generated km_csr_reg block with the Key Manager control/status (KMCSR) hardware logic.

Custom logic around the register block:

  • IRQ aggregation: combines the twelve sticky interrupt sources (ROM and SRAM parity errors, ROM write error, SRAM write-lock violation, AXI SLVERR and DECERR, DRBG error, wipe, OTP change, OTP signal-integrity error, execute and ROM access violations) with per-source enable masking into the single CPU interrupt km_irq_o; IRQ_SET sets any source for testing.
  • Scrambler lock: write-once lock for the SCRAMBLER_KEY and SCRAMBLER_CTRL registers; once locked, SCRAMBLER_KEY reads return zero and ignores writes, SCRAMBLER_CTRL reads show lock and enable set, and scrambler_key_o keeps the key held at lock time.
  • OTP data capture and read-through: OTP register values reflect the registered differential values, read as zero for any field locked in OTP_READ_LOCK or OTP_READ_LOCK_COLD; encoded changes and dual-rail signal-integrity errors raise sticky status and interrupts.
  • Soft reset: generation guarded by the magic code 0x53525354 in SOFT_RST_CODE.
  • Virtual UART and test protocol register plumbing.

Reset domains:

  • cold_rst_ni (AASD) resets the SRAM scrambler lock/key/enable (SCRAMBLER_CTRL.lock, SCRAMBLER_KEY), the VUART edge detect, the OTP captures and decoders, and the entire regblock via arst_n. Cold reset always implies warm reset.
  • warm_rst_ni (synchronous) resets soft_rst_q, the OTP identity and class-key captures, and the regblock CPUIF plus all warm-tagged fields via WARM_RST_N, including IRQ_STATUS/IRQ_ENABLE/IRQ_SET, SOFT_RST_CODE, RECOVERABLE_ERR, BOOT_STATUS, SRAM_LOCK (write-lock bits), SRAM_WRITE_LOCK_VIOLATION, SRAM_EXEC_MODE (execute-permission whitelist mode), IRQ_ENTRY_ADDR/IRQ_ENTRY_LOCK, OTP_READ_LOCK, OTP_CHANGE_STATUS, the VUART registers, and the firmware test-bench registers. The OTP life-cycle and demotion captures and OTP_READ_LOCK_COLD survive warm reset. Warm reset breaks the soft reset trigger loop and quiesces the AXI CPUIF state machine.

Ports

Table 1. Ports
NameDirectionTypeDescription
clk_iinputlogicSystem clock.
cold_rst_niinputlogicCold reset: async-assert/sync-deassert (AASD).
warm_rst_niinputlogicWarm reset: fully synchronous (from km_reset_conditioner).
axil_req_iinputaxil_req_tAXI4-Lite slave request from the crossbar.
axil_resp_ooutputaxil_resp_tAXI4-Lite slave response to the crossbar.
rom_parity_err_iinputlogicIRQ event: ROM parity error (pulse).
sram_parity_err_iinputlogicIRQ event: SRAM parity error (pulse).
rom_write_err_iinputlogicIRQ event: ROM write attempt detected (pulse).
axi_slverr_iinputlogicIRQ event: AXI SLVERR error (pulse).
axi_decerr_iinputlogicIRQ event: AXI DECERR error (pulse).
drbg_err_iinputlogicIRQ event: DRBG sampler error (pulse).
wipe_state_iinputlogicIRQ event: wipe state; sets the sticky IRQ while high.
scrambler_key_ooutputlogic [31:0]Scrambler key; frozen at its lock-time value once locked.
scrambler_enable_ooutputlogicSRAM scrambler enable to the CPU wrapper, from SCRAMBLER_CTRL.ENABLE; forced high once locked.
scrambler_lock_ooutputlogicScrambler lock status.
sram_lock_bits_ooutputlogic [31:0]Write-1-only SRAM write-lock bits to the SRAM interface; bit[i]=1 locks region i.
sram_write_lock_violation_region_iinputlogic [31:0]SRAM write-lock violation from the SRAM interface: one-hot region that had an attempted write while locked.
sram_exec_mode_ooutputlogicSRAM execute-permission mode to the CPU wrapper: 0=ROM-only whitelist, 1=write-locked-SRAM whitelist.
exec_violation_iinputlogicExecute-permission whitelist violation from the CPU wrapper: pulse when a fetch is outside the whitelist.
rom_access_violation_iinputlogicROM lockout violation from the CPU wrapper: pulse on a ROM fetch or read after lockout engages.
km_irq_ooutputlogicAggregated IRQ output to the CPU: OR of IRQ_STATUS masked by IRQ_ENABLE.
irq_entry_addr_ooutputlogic [31:0]Programmable IRQ entry address to the CPU wrapper (PicoRV32); write-locked by IRQ_ENTRY_LOCK.
soft_rst_ooutputlogicSoft reset output to the conditioner, active-low; goes low once SOFT_RST_CODE holds the magic code and returns high on warm reset.
recoverable_err_ooutputlogicRecoverable-error level from the firmware-written RECOVERABLE_ERR register.
vuart_tx_data_ooutputlogic [7:0]Virtual UART TX byte data; firmware writes the byte and the testbench captures it.
vuart_tx_valid_ooutputlogicVirtual UART TX data valid strobe, one cycle on each rising edge of VUART_TX.DATA_VALID.
vuart_rx_data_iinputlogic [7:0]Virtual UART RX byte; the testbench writes it and firmware reads it.
vuart_rx_valid_iinputlogicVirtual UART RX data valid, mirrored into VUART_RX and VUART_STATUS.
tb_result_ooutputlogic [31:0]Test protocol, firmware to testbench: test result (0=fail, 1=pass).
tb_signature_ooutputlogic [31:0]Test protocol: test completion signature.
tb_errcode_ooutputlogic [31:0]Test protocol: error code.
tb_subtest_ooutputlogic [31:0]Test protocol: current subtest number.
tb_cmd_ooutputlogic [31:0]Test protocol: command from firmware.
tb_cmd_arg_ooutputlogic [31:0]Test protocol: command argument from firmware.
tb_cmd_next_iinputlogic [31:0]Test protocol, testbench to firmware: loaded into TB_CMD on every cycle without a firmware write, so the testbench clears a command by driving zero.
tb_cmd_status_iinputlogic [31:0]Test protocol: command status from the testbench.
tb_cmd_result_iinputlogic [31:0]Test protocol: command result from the testbench.
otp_data_iinputkm_otp_data_tDifferentially encoded SEP OTP data, registered before decode and readback.