[kmac] Move to D2 (except security)
KMAC HWIP moves to D2 except the security. The security features will be
addressed at the later stage.
Signed-off-by: Eunchan Kim <eunchan@opentitan.org>
diff --git a/hw/ip/kmac/doc/checklist.md b/hw/ip/kmac/doc/checklist.md
index b65f9d0..8d4cc81 100644
--- a/hw/ip/kmac/doc/checklist.md
+++ b/hw/ip/kmac/doc/checklist.md
@@ -35,17 +35,17 @@
Type | Item | Resolution | Note/Collaterals
--------------|-------------------------|-------------|------------------
-Documentation | [NEW_FEATURES][] | In Progress |
+Documentation | [NEW_FEATURES][] | Done |
Documentation | [BLOCK_DIAGRAM][] | Done |
Documentation | [DOC_INTERFACE][] | Done |
Documentation | [MISSING_FUNC][] | N/A |
Documentation | [FEATURE_FROZEN][] | Done |
-RTL | [FEATURE_COMPLETE][] | In Progress |
+RTL | [FEATURE_COMPLETE][] | Done |
RTL | [AREA_CHECK][] | Done |
RTL | [PORT_FROZEN][] | Done |
RTL | [ARCHITECTURE_FROZEN][] | Done |
-RTL | [REVIEW_TODO][] | Not Started |
-RTL | [STYLE_X][] | Not Started |
+RTL | [REVIEW_TODO][] | Done |
+RTL | [STYLE_X][] | Done |
Code Quality | [LINT_PASS][] | Done |
Code Quality | [CDC_SETUP][] | N/A |
Code Quality | [FPGA_TIMING][] | Done |
diff --git a/hw/ip/kmac/rtl/kmac.sv b/hw/ip/kmac/rtl/kmac.sv
index 49ce25b..18e15dd 100644
--- a/hw/ip/kmac/rtl/kmac.sv
+++ b/hw/ip/kmac/rtl/kmac.sv
@@ -90,8 +90,7 @@
kmac_reg2hw_t reg2hw;
kmac_hw2reg_t hw2reg;
- // devmode signals comes from LifeCycle.
- // TODO: Implement
+ // devmode ties to 1 as KMAC should be operated at the beginning for ROM_CTRL.
logic devmode;
assign devmode = 1'b 1;
@@ -265,7 +264,6 @@
end
// Command signals
- // TODO: Make the entire logic to use enum rather than signal
assign sw_cmd = (reg2hw.cmd.cmd.qe) ? kmac_cmd_e'(reg2hw.cmd.cmd.q) : CmdNone;
`ASSERT_KNOWN(KmacCmd_A, sw_cmd)
always_comb begin
@@ -296,7 +294,6 @@
end
default: begin
- // TODO: Raise an error here
end
endcase
end
@@ -310,7 +307,6 @@
assign hw2reg.status.sha3_squeeze.d = sha3_fsm == sha3_pkg::StSqueeze;
// FIFO related status
- // TODO: handle if register width of `depth` is not same to MsgFifoDepthW
assign hw2reg.status.fifo_depth.d[MsgFifoDepthW-1:0] = msgfifo_depth;
if ($bits(hw2reg.status.fifo_depth.d) != MsgFifoDepthW) begin : gen_fifo_depth_tie
assign hw2reg.status.fifo_depth.d[$bits(hw2reg.status.fifo_depth.d)-1:MsgFifoDepthW] = '0;
diff --git a/hw/ip/kmac/rtl/kmac_app.sv b/hw/ip/kmac/rtl/kmac_app.sv
index ec31c1b..25d3a4c 100644
--- a/hw/ip/kmac/rtl/kmac_app.sv
+++ b/hw/ip/kmac/rtl/kmac_app.sv
@@ -470,7 +470,6 @@
StError: begin
// In this state, the state machine flush out the request
- // TODO: Check err_processed then move to StIdle
st_d = StError;
fsm_data_ready = 1'b 1;
diff --git a/hw/ip/kmac/rtl/kmac_entropy.sv b/hw/ip/kmac/rtl/kmac_entropy.sv
index e6ee539..34773ec 100644
--- a/hw/ip/kmac/rtl/kmac_entropy.sv
+++ b/hw/ip/kmac/rtl/kmac_entropy.sv
@@ -290,7 +290,6 @@
always_comb begin
unique case (mode_q)
EntropyModeNone: lfsr_seed = '0;
- // TODO: Check EDN Bus width
EntropyModeEdn: lfsr_seed = entropy_data_i;
EntropyModeSw: lfsr_seed = seed_data_i;
default: lfsr_seed = '0;
@@ -327,7 +326,6 @@
end
end
end
- // TODO: Should the consumed entropy be discarded?
end
//// Index
@@ -412,8 +410,6 @@
// lfsr_en: Let LFSR run
// To save power, this logic enables LFSR when it needs entropy expansion.
- // TODO: Check if random LFSR run while staying in ready state to obsfucate
- // LFSR value?
lfsr_en = 1'b 0;
// lfsr_seed_en: Signal to update LFSR seed
@@ -512,7 +508,6 @@
rand_valid_clear = 1'b 1;
storage_idx_clear = 1'b 1;
- // TODO: check fips?
end else if (rand_consumed_i) begin
// Somehow, while waiting the EDN entropy, the KMAC or SHA3 logic
// consumed the remained entropy. This can happen when the previous
@@ -583,7 +578,6 @@
if (err_processed_i) begin
st_d = StRandReset;
- // TODO: Reset as much as
end else begin
st_d = StRandErr;
end
diff --git a/hw/ip/kmac/rtl/sha3.sv b/hw/ip/kmac/rtl/sha3.sv
index 3354b9d..31050d3 100644
--- a/hw/ip/kmac/rtl/sha3.sv
+++ b/hw/ip/kmac/rtl/sha3.sv
@@ -206,7 +206,6 @@
st_d = StAbsorb;
keccak_process = 1'b 1;
- // TODO: Software Cancellation here? in case of absorbed not asserted
end else if (absorbed) begin
st_d = StSqueeze;
end else begin
@@ -234,7 +233,6 @@
end
StManualRun: begin
- // TODO: Software cancellation here?
if (keccak_complete) begin
st_d = StSqueeze;
end else begin
diff --git a/hw/ip/kmac/rtl/sha3pad.sv b/hw/ip/kmac/rtl/sha3pad.sv
index 80a50b8..397a956 100644
--- a/hw/ip/kmac/rtl/sha3pad.sv
+++ b/hw/ip/kmac/rtl/sha3pad.sv
@@ -221,11 +221,8 @@
always_ff @(posedge clk_i or negedge rst_ni) begin
if (!rst_ni) begin
process_latched <= 1'b 0;
- // TODO: Reconsider the set condition, what if process_i comes without
- // `start_i` ?
end else if (process_i) begin
process_latched <= 1'b 1;
- // TODO: Reconsider the clear indicator, done_i is good enough?
end else if (done_i) begin
process_latched <= 1'b0;
end
@@ -245,7 +242,6 @@
// `end_of_block` indicates current beat is end of the block
// It shall set when the address reaches to the end of the block. End address
// is set by the strength_i, which is `block_addr_limit`.
- // TODO: Decide if it needs to compare with the FSM in {StPad, StPad01} or not
logic end_of_block;
assign end_of_block = ((sent_message + 1'b1) == block_addr_limit) ? 1'b 1 : 1'b 0;
@@ -286,7 +282,6 @@
StPadIdle: begin
if (start_i) begin
// If cSHAKE, move to Prefix state
- // TODO: Reset sent_message to count on next states
if (mode_eq_cshake) begin
st_d = StPrefix;
end else begin
@@ -310,7 +305,6 @@
if (sent_blocksize) begin
st_d = StPrefixWait;
- // TODO: Set keccak to run, drop the keccak valid
keccak_run_o = 1'b 1;
fsm_keccak_valid = 1'b 0;
clr_sentmsg = 1'b 1;
@@ -413,7 +407,6 @@
st_d = StPadFlush;
fsm_keccak_valid = 1'b 0;
- // TODO: Trigger keccak_round
keccak_run_o = 1'b 1;
clr_sentmsg = 1'b 1;
end else begin
@@ -432,7 +425,6 @@
st_d = StPadIdle;
absorbed_d = 1'b 1;
- // TODO: Clear internal variables to fresh start
end else begin
st_d = StPadFlush;
end
@@ -548,7 +540,6 @@
endcase
end
- // TODO: keccak_valid_o mux
always_comb begin
unique case (sel_mux)
MuxFifo: keccak_valid_o = msg_valid_i & ~hold_msg & ~en_msgbuf;
@@ -561,7 +552,6 @@
endcase
end
- // TODO: msg_ready_o mux
always_comb begin
unique case (sel_mux)
MuxFifo: msg_ready_o = en_msgbuf | (keccak_ready_i & ~hold_msg);