diff options
Diffstat (limited to 'src/tb')
-rw-r--r-- | src/tb/tb_keywrap_mem.v | 74 |
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. ***"); |