[otbn,rtl] Fix timing of locking signal from controller
Commit 2aa877f *still* didn't quite get the timing of the locking
signal right. It squashed the single-cycle glitch at the start of the
secure wipe, but left another one at the end. This simple patch sorts
things out at both ends.
Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
diff --git a/hw/ip/otbn/rtl/otbn_controller.sv b/hw/ip/otbn/rtl/otbn_controller.sv
index d8d139c..1f10ff1 100644
--- a/hw/ip/otbn/rtl/otbn_controller.sv
+++ b/hw/ip/otbn/rtl/otbn_controller.sv
@@ -288,12 +288,14 @@
logic [4:0] insn_bignum_rd_addr_a_q, insn_bignum_rd_addr_b_q, insn_bignum_wr_addr_q;
- logic secure_wipe_running_q;
+ logic secure_wipe_running_q, secure_wipe_running_d;
+ assign secure_wipe_running_d = (start_secure_wipe_o |
+ (secure_wipe_running_q & ~secure_wipe_done_i));
always_ff @(posedge clk_i or negedge rst_ni) begin
if (!rst_ni) begin
secure_wipe_running_q <= 1'b0;
end else begin
- secure_wipe_running_q <= start_secure_wipe_o | (secure_wipe_running_q & ~secure_wipe_done_i);
+ secure_wipe_running_q <= secure_wipe_running_d;
end
end
@@ -322,7 +324,7 @@
assign executing = (state_q == OtbnStateRun) ||
(state_q == OtbnStateStall);
- assign locking_o = (state_d == OtbnStateLocked) & ~(start_secure_wipe_o | secure_wipe_running_q);
+ assign locking_o = (state_d == OtbnStateLocked) & ~secure_wipe_running_d;
assign start_secure_wipe_o = executing & (done_complete | err) & ~secure_wipe_running_q;
assign jump_or_branch = (insn_valid_i &