diff options
Diffstat (limited to 'src/tb/tb_mixer.v')
-rw-r--r-- | src/tb/tb_mixer.v | 82 |
1 files changed, 80 insertions, 2 deletions
diff --git a/src/tb/tb_mixer.v b/src/tb/tb_mixer.v index b08533a..3964197 100644 --- a/src/tb/tb_mixer.v +++ b/src/tb/tb_mixer.v @@ -66,7 +66,18 @@ module tb_mixer(); reg tb_clk; reg tb_reset_n; reg tb_enable; + + reg tb_cs; + reg tb_we; + reg [7 : 0] tb_address; + reg [31 : 0] tb_write_data; + wire [31 : 0] tb_read_data; + wire tb_error; + + reg tb_discard; + reg tb_test_mode; reg tb_more_seed; + wire tb_security_error; reg tb_entropy0_enabled; reg tb_entropy0_syn; @@ -87,6 +98,8 @@ module tb_mixer(); wire tb_syn; reg tb_ack; + reg [31 : 0] read_data; + //---------------------------------------------------------------- // Device Under Test. @@ -95,7 +108,17 @@ module tb_mixer(); .clk(tb_clk), .reset_n(tb_reset_n), - .enable(tb_enable), + .cs(tb_cs), + .we(tb_we), + .address(tb_address), + .write_data(tb_write_data), + .read_data(tb_read_data), + .error(tb_error), + + .discard(tb_discard), + .test_mode(tb_test_mode), + .security_error(tb_security_error), + .more_seed(tb_more_seed), .entropy0_enabled(tb_entropy0_enabled), @@ -166,6 +189,56 @@ module tb_mixer(); //---------------------------------------------------------------- + // write_word() + // + // Write the given word to the DUT using the DUT interface. + //---------------------------------------------------------------- + task write_word(input [11 : 0] address, + input [31 : 0] word); + begin + if (DEBUG) + begin + $display("*** Writing 0x%08x to 0x%02x.", word, address); + $display(""); + end + + tb_address = address; + tb_write_data = word; + tb_cs = 1; + tb_we = 1; + #(2 * CLK_PERIOD); + tb_cs = 0; + tb_we = 0; + end + endtask // write_word + + + //---------------------------------------------------------------- + // read_word() + // + // Read a data word from the given address in the DUT. + // the word read will be available in the global variable + // read_data. + //---------------------------------------------------------------- + task read_word(input [11 : 0] address); + begin + tb_address = address; + tb_cs = 1; + tb_we = 0; + #(CLK_PERIOD); + read_data = tb_read_data; + tb_cs = 0; + + if (DEBUG) + begin + $display("*** Reading 0x%08x from 0x%02x.", read_data, address); + $display(""); + end + end + endtask // read_word + + + //---------------------------------------------------------------- // reset_dut() // // Toggle reset to put the DUT into a well known state. @@ -216,8 +289,13 @@ module tb_mixer(); tb_clk = 0; tb_reset_n = 1; + tb_cs = 0; + tb_we = 0; + tb_address = 8'h00; + tb_write_data = 32'h00000000; - tb_enable = 0; + tb_discard = 0; + tb_test_mode = 0; tb_more_seed = 0; tb_entropy0_enabled = 0; |