From f74e8a4f79a2037993c89af54e7b1be616a6f813 Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Fri, 18 Oct 2019 16:41:05 +1100 Subject: [PATCH] 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 --- icache_tb.vhdl | 24 ++++++++++++++++++++---- icache_test.bin | Bin 0 -> 1024 bytes scripts/gen_icache_tb.py | 9 +++++++++ 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 icache_test.bin create mode 100755 scripts/gen_icache_tb.py 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 0000000000000000000000000000000000000000..c458a23992bd53a7cafcaf61bd95df187c729c80 GIT binary patch literal 1024 zcmWN=0~8eo006+BZQHhOo2!;>+xC`idwJR1vTfUTckf*w5C{Y@sKE?w2tyjm(1tOr z;S6sCBO1xbMlq_M0~^}N#x}93&1`N9TiVLjwy~}4Y;OlU+R4s#v8&zeZV!9f%ii{} zul?-r00%nA!47e#!yN7iM>@*U{^j3}ajfGU?*u10$;nP}s?(hA3}-sa+0JpU^PKMj z7rMyBE^(>LT6^qyM_e&2Dk4+uZIBce=~n?s2dC-0uModdS26 z=l>q@sK-3+2~T>;)1L9H=REHPFM7$#Uh%5eyzUKeddu71@vis0?*kwD$j3hMsn2}w e3t#%m*S_(s?|knEKl;hfe(|f{{O%8b`pe(9_J4r@ literal 0 HcmV?d00001 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() +