diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rtl/keywrap_core.v | 18 | ||||
-rw-r--r-- | src/tb/tb_keywrap.v | 1 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/rtl/keywrap_core.v b/src/rtl/keywrap_core.v index 35bdfa6..1e8ac5b 100644 --- a/src/rtl/keywrap_core.v +++ b/src/rtl/keywrap_core.v @@ -233,10 +233,10 @@ module keywrap_core ( a_new = 64'h0; a_we = 1'h0; - core_addr = block_ctr_reg - 1'h1; + core_addr = block_ctr_reg; core_we = 1'h0; - xor_val = (rlen * iteration_ctr_reg) + {51'h0, block_ctr_reg}; + xor_val = (rlen * iteration_ctr_reg) + {51'h0, (block_ctr_reg + 1'h1)}; if (encdec) aes_block = {a_reg, core_rd_data}; @@ -274,13 +274,13 @@ module keywrap_core ( if (block_ctr_rst) begin - block_ctr_new = 13'h1; + block_ctr_new = 13'h0; block_ctr_we = 1'h1; end if (block_ctr_set) begin - block_ctr_new = rlen; + block_ctr_new = (rlen - 1); block_ctr_we = 1'h1; end @@ -320,7 +320,7 @@ module keywrap_core ( if (iteration_ctr_dec) begin - iteration_ctr_new = iteration_ctr_reg + 1'h1; + iteration_ctr_new = iteration_ctr_reg - 1'h1; iteration_ctr_we = 1'h1; end @@ -458,7 +458,7 @@ module keywrap_core ( CTRL_NEXT_WCHECK: begin - if (block_ctr_reg < rlen) + if (block_ctr_reg < (rlen - 1)) begin block_ctr_inc = 1'h1; keywrap_core_ctrl_new = CTRL_NEXT_LOOP0; @@ -483,10 +483,10 @@ module keywrap_core ( CTRL_NEXT_UCHECK: begin - if (block_ctr_reg > 1) + if (block_ctr_reg > 0) begin block_ctr_dec = 1'h1; - keywrap_core_ctrl_new = CTRL_NEXT_LOOP; + keywrap_core_ctrl_new = CTRL_NEXT_LOOP0; keywrap_core_ctrl_we = 1'h1; end @@ -494,7 +494,7 @@ module keywrap_core ( begin block_ctr_set = 1'h1; iteration_ctr_dec = 1'h1; - keywrap_core_ctrl_new = CTRL_NEXT_LOOP; + keywrap_core_ctrl_new = CTRL_NEXT_LOOP0; keywrap_core_ctrl_we = 1'h1; end diff --git a/src/tb/tb_keywrap.v b/src/tb/tb_keywrap.v index a13521c..edbbbcf 100644 --- a/src/tb/tb_keywrap.v +++ b/src/tb/tb_keywrap.v @@ -272,6 +272,7 @@ module tb_keywrap(); dut.core.core_we, dut.core.core_addr); $display("core_rd_data = 0x%0x core_wr_data = 0x%0x ", dut.core.core_rd_data, dut.core.core_wr_data); + $display("xor_val = 0x%0x", dut.core.keywrap_logic.xor_val); $display(""); |