aboutsummaryrefslogtreecommitdiff
path: root/src/tb
diff options
context:
space:
mode:
authorJoachim StroĢˆmbergson <joachim@secworks.se>2018-07-05 09:58:39 +0200
committerJoachim StroĢˆmbergson <joachim@secworks.se>2018-07-05 09:58:39 +0200
commit6b15816bff4c0c3ab22bf6d8185da48a263f7727 (patch)
tree0679fd463f258dde0a56cb19fcb6256b4d3a695e /src/tb
parent84164cf6ae48923dfd0bd8a4d818642cd39a4e93 (diff)
Fixed memory word order. Fixed a number of bugs. First block encrypted correctly. A state is wrong and memory is read too far.
Diffstat (limited to 'src/tb')
-rw-r--r--src/tb/tb_keywrap.v22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/tb/tb_keywrap.v b/src/tb/tb_keywrap.v
index 6b553ab..2cabca3 100644
--- a/src/tb/tb_keywrap.v
+++ b/src/tb/tb_keywrap.v
@@ -223,7 +223,7 @@ module tb_keywrap();
task dump_mem(integer n);
begin : dump_mem
integer i;
- for (i = 0 ; i < n ; i = i + 2)
+ for (i = 0 ; i < n ; i = i + 1)
$display("mem0[0x%06x] = 0x%08x mem1[0x%06x] = 0x%08x",
i, dut.core.mem.mem0[i], i, dut.core.mem.mem1[i]);
$display("");
@@ -247,7 +247,7 @@ module tb_keywrap();
$display("top level state:");
$display("init_reg = 0x%x next_reg = 0x%x", dut.init_reg, dut.next_reg);
$display("endec_reg = 0x%x keylen_reg = 0x%x", dut.encdec_reg, dut.keylen_reg);
- $display("rlen_reg = 0x%06x", dut.rlen_reg);
+ $display("rlen_reg = 0x%06x r_bank_reg = 0x%06x", dut.rlen_reg, dut.r_bank_reg);
$display("a0_reg = 0x%08x a1_reg = 0x%08x", dut.a0_reg, dut.a1_reg);
$display("");
end
@@ -257,22 +257,33 @@ module tb_keywrap();
$display("core level state:");
$display("init = 0x%0x next = 0x%0x ready = 0x%0x valid = 0x%0x",
dut.core.init, dut.core.next, dut.core.ready, dut.core.valid);
+ $display("api_we = 0x%0x api_addr = 0x%0x api_wr_data = 0x%0x api_rd_data = 0x%0x",
+ dut.core.api_we, dut.core.api_addr, dut.core.api_wr_data, dut.core.api_rd_data);
$display("rlen = 0x%0x", dut.core.rlen);
$display("key = 0x%0x", dut.core.key);
$display("a_init = 0x%0x a_result = 0x%0x", dut.core.a_init, dut.core.a_result);
$display("");
+
$display("update_state = 0x%0x", dut.core.update_state);
$display("a_reg = 0x%0x a_new = 0x%0x a_we = 0x%0x",
dut.core.a_reg, dut.core.a_new, dut.core.a_we);
- $display("aes_block = 0x%0x aes_result = 0x%0x",
- dut.core.aes_block, dut.core.aes_result);
$display("core_we = 0x%0x core_addr = 0x%0x",
dut.core.core_we, dut.core.block_ctr_reg);
$display("core_rd_data = 0x%0x core_wr_data = 0x%0x ",
dut.core.core_rd_data, dut.core.core_wr_data);
$display("");
+
+ $display("aes_ready = 0x%0x aes_valid = 0x%0x",
+ dut.core.aes_ready, dut.core.aes_valid);
+ $display("aes_init = 0x%0x aes_next = 0x%0x",
+ dut.core.aes_init, dut.core.aes_next);
+ $display("aes_block = 0x%0x aes_result = 0x%0x",
+ dut.core.aes_block, dut.core.aes_result);
+ $display("");
+
+
$display("block_ctr_reg = 0x%0x iteration_ctr_reg = 0x%0x",
dut.core.block_ctr_reg, dut.core.iteration_ctr_reg);
$display("keywrap_core_ctrl_reg = 0x%0x", dut.core.keywrap_core_ctrl_reg);
@@ -363,9 +374,6 @@ module tb_keywrap();
write_word(ADDR_KEY3, 32'ha8d77e3d);
write_word(ADDR_CONFIG, 32'h00000001);
- $display("* State after key has been set:");
- dump_dut_state();
-
// Initialize the AES engine (to expand the key).
// Wait for init to complete.