aboutsummaryrefslogtreecommitdiff
path: root/src/tb/tb_keywrap_mem.v
diff options
context:
space:
mode:
authorJoachim StroĢˆmbergson <joachim@secworks.se>2018-07-03 09:45:19 +0200
committerJoachim StroĢˆmbergson <joachim@secworks.se>2018-07-03 09:45:19 +0200
commitef107e0aae06a658e1353dbf0856103cddfcf1c4 (patch)
tree8dd8352e53de15caa775690295bfc97f0fd2e92f /src/tb/tb_keywrap_mem.v
parentbdc6e6712f23e0457912b7bc0f226f9aed8d5ffc (diff)
Adding additional test code to verify that core read-modify-write and api rread works correctly.
Diffstat (limited to 'src/tb/tb_keywrap_mem.v')
-rw-r--r--src/tb/tb_keywrap_mem.v74
1 files changed, 69 insertions, 5 deletions
diff --git a/src/tb/tb_keywrap_mem.v b/src/tb/tb_keywrap_mem.v
index 726e638..000bd16 100644
--- a/src/tb/tb_keywrap_mem.v
+++ b/src/tb/tb_keywrap_mem.v
@@ -132,12 +132,29 @@ module tb_keywrap_mem();
endtask // init_sim
+ //----------------------------------------------------------------
+ // dump_api_mem;
+ //----------------------------------------------------------------
+ task dump_api_mem;
+ begin : dump_api_mem
+
+ reg [13 : 0] addr_ctr;
+
+ for (addr_ctr = 0 ; addr_ctr < API_ADDR_MAX ; addr_ctr = addr_ctr + 1)
+ begin
+ tb_api_addr = addr_ctr;
+ #(CLK_PERIOD);
+ $display("api_mem [0x%05x] = 0x%08x", addr_ctr, tb_api_rd_data);
+ end
+ end
+ endtask // dump_api_mem
+
//----------------------------------------------------------------
- // dump_mem;
+ // dump_core_mem;
//----------------------------------------------------------------
- task dump_mem;
- begin : dump_mem
+ task dump_core_mem;
+ begin : dump_core_mem
reg [12 : 0] addr_ctr;
@@ -148,7 +165,33 @@ module tb_keywrap_mem();
$display("core_mem [0x%04x] = 0x%016x", addr_ctr, tb_core_rd_data);
end
end
- endtask // dump_mem
+ endtask // dump_core_mem
+
+
+ //----------------------------------------------------------------
+ // test_core_rmw
+ //----------------------------------------------------------------
+ task test_core_rmw;
+ begin : test_core_rmw
+ reg [12 : 0] addr_ctr;
+
+ $display("** TC CORE RMW START");
+
+ for (addr_ctr = 0 ; addr_ctr < CORE_ADDR_MAX ; addr_ctr = addr_ctr + 1)
+ begin
+ tb_core_addr = addr_ctr;
+ #(CLK_PERIOD);
+ tb_core_we = 1;
+ tb_core_wr_data = ~tb_core_rd_data;
+ #(CLK_PERIOD);
+ tb_core_we = 0;
+ end
+
+ dump_core_mem();
+
+ $display("** TC CORE RMW END\n");
+ end
+ endtask // test_core_rmw
//----------------------------------------------------------------
@@ -158,6 +201,8 @@ module tb_keywrap_mem();
begin : test_api_write
reg [13 : 0] addr_ctr;
+ $display("** TC API WRITE START");
+
for (addr_ctr = 0 ; addr_ctr < API_ADDR_MAX ; addr_ctr = addr_ctr + 1)
begin
tb_api_we = 1;
@@ -168,12 +213,29 @@ module tb_keywrap_mem();
end
#(CLK_PERIOD);
- dump_mem();
+ dump_core_mem();
+
+ $display("** TC API WRITE END\n");
end
endtask // api_write
//----------------------------------------------------------------
+ // test_api_read;
+ //----------------------------------------------------------------
+ task test_api_read;
+ begin : test_api_reaqd
+
+ $display("** TC API READ START");
+
+ dump_api_mem();
+
+ $display("** TC API READ END\n");
+ end
+ endtask // api_read
+
+
+ //----------------------------------------------------------------
// main
//----------------------------------------------------------------
initial
@@ -184,6 +246,8 @@ module tb_keywrap_mem();
init_sim();
test_api_write();
+ test_core_rmw();
+ test_api_read();
$display("");
$display("*** Keywrap memory simulation done. ***");