Skip to content

Commit

Permalink
skdecode error (#33)
Browse files Browse the repository at this point in the history
* fixed skdecode tb

* added random test and error test

* added skdecode_error and randomized tb

* MICROSOFT AUTOMATED PIPELINE: Stamp 'mojtaba-msft-skdecode' with updated timestamp and hash after successful run

---------

Co-authored-by: Mojtaba Bisheh Niasar <“[email protected]”>
  • Loading branch information
mojtaba-bisheh and Mojtaba Bisheh Niasar authored Nov 12, 2024
1 parent 2e46835 commit 856429e
Show file tree
Hide file tree
Showing 12 changed files with 292 additions and 7,389 deletions.
2 changes: 1 addition & 1 deletion .github/workflow_metadata/pr_hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8228e7ec4ec4d34b04381d60d78531d4272ad45a40e512452b4bba66638e4ed80982600151ac84f9ba2a11d22d72ff03
9d54d1866a9a7563c427dba608a89fa1cdeab27298e11cce32798132b333fd96251f7a0025c0ff63a0701065c057d481
2 changes: 1 addition & 1 deletion .github/workflow_metadata/pr_timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1731347747
1731448024
5 changes: 3 additions & 2 deletions src/mldsa_top/rtl/mldsa_ctrl.sv
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ module mldsa_ctrl
input mem_if_t [1:0] skdecode_keymem_if_i,
output logic [1:0][DATA_WIDTH-1:0] skdecode_rd_data_o,
input logic skdecode_done_i,
input logic skdecode_error_i,

output logic makehint_enable_o,
input logic makehint_invalid_i,
Expand Down Expand Up @@ -400,7 +401,7 @@ always_comb mldsa_privkey_lock = '0;
assign notif_intr = mldsa_reg_hwif_out.intr_block_rf.notif_global_intr_r.intr;

always_comb begin
mldsa_reg_hwif_in.intr_block_rf.error_internal_intr_r.error_internal_sts.hwset = '0; //TODO
mldsa_reg_hwif_in.intr_block_rf.error_internal_intr_r.error_internal_sts.hwset = error_flag_edge; //TODO
mldsa_reg_hwif_in.intr_block_rf.notif_internal_intr_r.notif_cmd_done_sts.hwset = mldsa_status_done_p;
end

Expand Down Expand Up @@ -986,7 +987,7 @@ always_comb mldsa_privkey_lock = '0;
always_comb subcomponent_busy = !(ctrl_fsm_ns inside {MLDSA_CTRL_IDLE, MLDSA_CTRL_MSG_WAIT}) |
sampler_busy_i |
ntt_busy_i[0];
always_comb error_flag_edge = 0;
always_comb error_flag_edge = skdecode_error_i;
always_comb seq_en = 1;
//program counter
always_ff @(posedge clk or negedge rst_b) begin
Expand Down
4 changes: 3 additions & 1 deletion src/mldsa_top/rtl/mldsa_top.sv
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ module mldsa_top
logic [1:0][DATA_WIDTH-1:0] skdecode_rd_data;
mem_if_t [1:0] skdecode_mem_wr_req;
logic [1:0][MLDSA_MEM_DATA_WIDTH-1:0] skdecode_mem_wr_data;
logic skdecode_error;

logic makehint_enable, makehint_done;
logic makehint_invalid;
Expand Down Expand Up @@ -339,6 +340,7 @@ mldsa_ctrl mldsa_ctrl_inst
.skdecode_keymem_if_i(skdecode_keymem_if),
.skdecode_rd_data_o(skdecode_rd_data),
.skdecode_done_i(skdecode_done),
.skdecode_error_i(skdecode_error),

.skencode_enable_o(skencode_enable),
.skencode_keymem_if_i(skencode_keymem_if),
Expand Down Expand Up @@ -642,7 +644,7 @@ skdecode_inst
.s1_done(),
.s2_done(),
.t0_done(),
.skdecode_error()
.skdecode_error(skdecode_error)
);

makehint
Expand Down
6 changes: 2 additions & 4 deletions src/sk_decode/rtl/skdecode_s1s2_unpack.sv
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ module skdecode_s1s2_unpack
3'h3: data_o = MLDSA_Q-1;
3'h4: data_o = MLDSA_Q-2;
default: begin
//TODO uncomment these when error validation is ready
// data_o = 'h0;
// error_o = 'b1;
data_o = MLDSA_Q + eta_minus_data;
data_o = 'h0;
error_o = 'b1;
end
endcase

Expand Down
168 changes: 0 additions & 168 deletions src/sk_decode/tb/s1_bytes.hex

This file was deleted.

Loading

0 comments on commit 856429e

Please sign in to comment.