Skip to content

Commit 49d4e53

Browse files
committed
[keymgr/rtl] Raise error for any operation in Invalid state
The keymgr specification states that no operation is allowed in the Invalid state. Prior to this commit, keymgr did not raise an *invalid operation* error, raise an alert, nor update the `OP_STATUS` and `ERR_CODE` CSRs. This commit fixes keymgr to do all these things. Signed-off-by: Andreas Kurth <[email protected]>
1 parent 4979b02 commit 49d4e53

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

hw/ip/keymgr/dv/env/keymgr_scoreboard.sv

+10-1
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,16 @@ class keymgr_scoreboard extends cip_base_scoreboard #(
586586
end
587587
void'(ral.intr_state.predict(.value(1 << int'(IntrOpDone))));
588588
end
589-
default: begin // other than StReset and StDisabled
589+
keymgr_pkg::StInvalid: begin
590+
// No operation is allowed in this state. Expect a recoverable alert, that the
591+
// operation status is *failed*, that the `err_code` CSR has `invalid_op` set, and
592+
// that the `op_done` IRQ gets raised.
593+
set_exp_alert("recov_operation_err");
594+
current_op_status = keymgr_pkg::OpDoneFail;
595+
void'(ral.err_code.invalid_op.predict(.value(1'b1)));
596+
void'(ral.intr_state.predict(.value(1 << int'(IntrOpDone))));
597+
end
598+
default: begin // other than StReset and StInvalid
590599
bit good_key;
591600
bit good_data;
592601

hw/ip/keymgr/rtl/keymgr_ctrl.sv

+1-1
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ module keymgr_ctrl
633633
end
634634

635635
StCtrlInvalid: begin
636-
op_req = op_start_i;
636+
invalid_op = op_start_i;
637637
invalid = 1'b1;
638638
end
639639

0 commit comments

Comments
 (0)