From: Benjamin Herrenschmidt Date: Fri, 18 Oct 2019 05:41:05 +0000 (+1100) Subject: icache_tb: Improve test and include test file X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f74e8a4f79a2037993c89af54e7b1be616a6f813;p=microwatt.git icache_tb: Improve test and include test file The icache_test.bin file was missing. This adds it (along with a python3 script to generate it). We also add better reporting on errors Signed-off-by: Benjamin Herrenschmidt --- diff --git a/icache_tb.vhdl b/icache_tb.vhdl index 7aeb69c..a82912e 100644 --- a/icache_tb.vhdl +++ b/icache_tb.vhdl @@ -77,7 +77,11 @@ begin wait for 30*clk_period; assert i_in.valid = '1'; - assert i_in.insn = x"00000001"; + assert i_in.insn = x"00000001" + report "insn @" & to_hstring(i_out.nia) & + "=" & to_hstring(i_in.insn) & + " expected 00000001" + severity failure; i_out.req <= '0'; @@ -88,7 +92,11 @@ begin i_out.nia <= x"0000000000000008"; wait for clk_period; assert i_in.valid = '1'; - assert i_in.insn = x"00000002"; + assert i_in.insn = x"00000002" + report "insn @" & to_hstring(i_out.nia) & + "=" & to_hstring(i_in.insn) & + " expected 00000002" + severity failure; wait for clk_period; -- another miss @@ -98,7 +106,11 @@ begin wait for 30*clk_period; assert i_in.valid = '1'; - assert i_in.insn = x"00000010"; + assert i_in.insn = x"00000010" + report "insn @" & to_hstring(i_out.nia) & + "=" & to_hstring(i_in.insn) & + " expected 00000010" + severity failure; -- test something that aliases i_out.req <= '1'; @@ -110,7 +122,11 @@ begin wait for 30*clk_period; assert i_in.valid = '1'; - assert i_in.insn = x"00000040"; + assert i_in.insn = x"00000040" + report "insn @" & to_hstring(i_out.nia) & + "=" & to_hstring(i_in.insn) & + " expected 00000040" + severity failure; i_out.req <= '0'; diff --git a/icache_test.bin b/icache_test.bin new file mode 100644 index 0000000..c458a23 Binary files /dev/null and b/icache_test.bin differ diff --git a/scripts/gen_icache_tb.py b/scripts/gen_icache_tb.py new file mode 100755 index 0000000..93b1a1c --- /dev/null +++ b/scripts/gen_icache_tb.py @@ -0,0 +1,9 @@ +#!/usr/bin/python3 + +b = bytearray() +for i in range(0x100): + b = b + i.to_bytes(4, 'little') +f = open('icache_test.bin', 'w+b') +f.write(b) +f.close() +