diff options
author | Joachim StroĢmbergson <joachim@secworks.se> | 2018-09-04 13:17:56 +0200 |
---|---|---|
committer | Joachim StroĢmbergson <joachim@secworks.se> | 2018-09-04 13:17:56 +0200 |
commit | 2fb042d7158d4bd5315ef7b716334a7f45aa0928 (patch) | |
tree | c51e86b90c3e96c2ecd4584c0088d696e9dc0b28 /src | |
parent | 8836e5db9c8c8cdcf7e0a144f8d9a42f73d212f6 (diff) |
Updated testbench to handle parameterized core.
Diffstat (limited to 'src')
-rw-r--r-- | src/tb/tb_keywrap_core.v | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/src/tb/tb_keywrap_core.v b/src/tb/tb_keywrap_core.v index 8d055fe..17c8f30 100644 --- a/src/tb/tb_keywrap_core.v +++ b/src/tb/tb_keywrap_core.v @@ -42,38 +42,47 @@ module tb_keywrap_core(); //---------------------------------------------------------------- // Parameters. //---------------------------------------------------------------- + parameter DEBUG = 1; + parameter CLK_HALF_PERIOD = 1; parameter CLK_PERIOD = 2 * CLK_HALF_PERIOD; + parameter API_ADDR_BITS = 8; + parameter RLEN_BITS = API_ADDR_BITS - 1; + parameter CORE_ADDR_BITS = API_ADDR_BITS - 1; + parameter API_ADDR_MAX = (2 ** API_ADDR_BITS) - 1; + parameter CORE_ADDR_MAX = (2 ** CORE_ADDR_BITS) - 1; //---------------------------------------------------------------- // Variables, regs and wires. //---------------------------------------------------------------- integer cycle_ctr; - - reg tb_clk; - reg tb_reset_n; - - reg tb_init; - reg tb_next; - reg tb_encdec; - wire tb_ready; - wire tb_valid; - reg [12 : 0] tb_rlen; - reg [255 : 0] tb_key; - reg tb_keylen; - reg [63 : 0] tb_a_init; - wire [63 : 0] tb_a_result; - reg tb_api_we; - reg [13 : 0] tb_api_addr; - reg [31 : 0] tb_api_wr_data; - wire [31 : 0] tb_api_rd_data; + reg [31 : 0] error_ctr; + reg [31 : 0] tc_ctr; + + reg tb_clk; + reg tb_reset_n; + reg tb_init; + reg tb_next; + reg tb_encdec; + wire tb_ready; + wire tb_valid; + reg [(RLEN_BITS - 1) : 0] tb_rlen; + reg [255 : 0] tb_key; + reg tb_keylen; + reg [63 : 0] tb_a_init; + wire [63 : 0] tb_a_result; + reg tb_api_we; + reg [(API_ADDR_BITS - 1) : 0] tb_api_addr; + reg [31 : 0] tb_api_wr_data; + wire [31 : 0] tb_api_rd_data; //---------------------------------------------------------------- // Device Under Test. //---------------------------------------------------------------- - keywrap_core dut( + keywrap_core #(.MEM_BITS(API_ADDR_BITS)) + dut( .clk(tb_clk), .reset_n(tb_reset_n), |