From 9c66245ee6304146b107e1dd13b9b125e7609142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Stro=CC=88mbergson?= Date: Tue, 30 Oct 2018 15:13:35 +0100 Subject: Integrated the DUT into the testbench and update Makefile to build the sim target- --- src/tb/tb_keywrap_mkmif.v | 58 +++++++++++++++++++++++++++++++---------------- toolruns/Makefile | 15 ++++++++++-- 2 files changed, 52 insertions(+), 21 deletions(-) diff --git a/src/tb/tb_keywrap_mkmif.v b/src/tb/tb_keywrap_mkmif.v index 09fe652..8d42c6d 100644 --- a/src/tb/tb_keywrap_mkmif.v +++ b/src/tb/tb_keywrap_mkmif.v @@ -55,8 +55,21 @@ module tb_keywrap_mkm(); integer error_ctr; integer tc_ctr; - reg tb_clk; - reg tb_reset_n; + reg tb_clk; + reg tb_reset_n; + wire tb_mkm_spi_sclk; + wire tb_mkm_spi_cs_n; + reg tb_mkm_spi_do; + wire tb_mkm_spi_di; + reg tb_init; + reg tb_read; + reg tb_write; + reg tb_key_status; + wire tb_ready; + reg [31 : 0] tb_wr_status; + wire [31 : 0] tb_rd_status; + reg [255 : 0] tb_wr_key; + wire [255 : 0] tb_rd_key; //---------------------------------------------------------------- @@ -66,21 +79,21 @@ module tb_keywrap_mkm(); .clk(tb_clk), .reset_n(tb_reset_n), - .mkm_spi_sclk(), - .mkm_spi_cs_n(), - .mkm_spi_do(), - .mkm_spi_di(), - - .init(), - .read(), - .write(), - .key_status(), - .ready(), - - .wr_status(), - .rd_status(), - .wr_key(), - .rd_key + .mkm_spi_sclk(tb_mkm_spi_sclk), + .mkm_spi_cs_n(tb_mkm_spi_cs_n), + .mkm_spi_do(tb_mkm_spi_do), + .mkm_spi_di(tb_mkm_spi_di), + + .init(tb_init), + .read(tb_read), + .write(tb_write), + .key_status(tb_key_status), + .ready(tb_ready), + + .wr_status(tb_wr_status), + .rd_status(tb_rd_status), + .wr_key(tb_wr_key), + .rd_key(tb_rd_key) ); @@ -122,8 +135,15 @@ module tb_keywrap_mkm(); error_ctr = 0; tc_ctr = 0; - tb_clk = 1'h0; - tb_reset_n = 1'h1 + tb_clk = 1'h0; + tb_reset_n = 1'h1; + tb_mkm_spi_do = 1'h0; + tb_init = 1'h0; + tb_read = 1'h0; + tb_write = 1'h0; + tb_key_status = 1'h0; + tb_wr_status = 32'h0; + tb_wr_key = 256'h0; #(CLK_PERIOD); end diff --git a/toolruns/Makefile b/toolruns/Makefile index 4ca1d54..a6dcf00 100755 --- a/toolruns/Makefile +++ b/toolruns/Makefile @@ -46,7 +46,10 @@ AES_SRC = $(AES_PATH)/aes_core.v $(AES_PATH)/aes_decipher_block.v $(AES_PATH)/ae MEM_SRC = ../src/rtl/keywrap_mem.v TB_MEM_SRC = ../src/tb/tb_keywrap_mem.v -CORE_SRC = ../src/rtl/keywrap_core.v ../src/rtl/keywrap_mkmif.v $(AES_SRC) $(MEM_SRC) $(MKMIF_SRC) +KEYWRAP_MKMIF_SRC = ../src/rtl/keywrap_mkmif.v +TB_KEYWRAP_MKMIF_SRC = ../src/tb/tb_keywrap_mkmif.v + +CORE_SRC = ../src/rtl/keywrap_core.v $(KEYWRAP_MKMIF_SRC) $(AES_SRC) $(MEM_SRC) $(MKMIF_SRC) TB_CORE_SRC = ../src/tb/tb_keywrap_core.v TOP_SRC = ../src/rtl/keywrap.v $(CORE_SRC) @@ -58,7 +61,7 @@ CC_FLAGS = -Wall LINT = verilator LINT_FLAGS = +1364-2001ext+ --lint-only -Wall -Wno-fatal -Wno-DECLFILENAME -all: top.sim core.sim mem.sim +all: top.sim core.sim mem.sim mkmif.sim top.sim: $(TB_TOP_SRC) $(TOP_SRC) @@ -73,6 +76,10 @@ mem.sim: $(TB_MEM_SRC) $(MEM_SRC) $(CC) $(CC_FLAGS) -o mem.sim $(TB_MEM_SRC) $(MEM_SRC) +mkmif.sim: $(TB_KEYWRAP_MKMIF_SRC) $(KEYWRAP_MKMIF_SRC) $(MKMIF_SRC) + $(CC) $(CC_FLAGS) -o mkmif.sim $(TB_KEYWRAP_MKMIF_SRC) $(KEYWRAP_MKMIF_SRC) $(MKMIF_SRC) + + sim-top: top.sim ./top.sim @@ -85,6 +92,10 @@ sim-mem: mem.sim ./mem.sim +sim-mkmif: mkmif.sim + ./mkmif.sim + + lint: $(TOP_SRC) $(LINT) $(LINT_FLAGS) $(TOP_SRC) -- cgit v1.2.3