1 |
9 |
ring0_mipt |
---------------------------------------------------------------------
|
2 |
|
|
-- LXP32 verification environment (self-checking testbench)
|
3 |
|
|
--
|
4 |
|
|
-- Part of the LXP32 testbench
|
5 |
|
|
--
|
6 |
|
|
-- Copyright (c) 2016 by Alex I. Kuznetsov
|
7 |
|
|
--
|
8 |
|
|
-- Simulates LXP32 test platform, verifies results.
|
9 |
|
|
--
|
10 |
|
|
-- Parameters:
|
11 |
|
|
-- CPU_DBUS_RMW: DBUS_RMW CPU generic
|
12 |
|
|
-- CPU_MUL_ARCH: MUL_ARCH CPU generic
|
13 |
|
|
-- MODEL_LXP32C: when true, simulates LXP32C variant (with
|
14 |
|
|
-- instruction cache), otherwise LXP32U
|
15 |
|
|
-- TEST_CASE: If non-empty, selects a test case to run.
|
16 |
|
|
-- If empty, all tests are executed.
|
17 |
|
|
-- THROTTLE_IBUS: perform pseudo-random instruction bus
|
18 |
|
|
-- throttling
|
19 |
|
|
-- THROTTLE_DBUS: perform pseudo-random data bus throttling
|
20 |
|
|
-- VERBOSE: report everything that is written to the
|
21 |
|
|
-- test monitor address space
|
22 |
|
|
---------------------------------------------------------------------
|
23 |
|
|
|
24 |
|
|
use std.textio.all;
|
25 |
|
|
|
26 |
|
|
library ieee;
|
27 |
|
|
use ieee.std_logic_1164.all;
|
28 |
|
|
use ieee.numeric_std.all;
|
29 |
|
|
|
30 |
|
|
use work.tb_pkg.all;
|
31 |
|
|
|
32 |
|
|
entity tb is
|
33 |
|
|
generic(
|
34 |
|
|
CPU_DBUS_RMW: boolean:=false;
|
35 |
|
|
CPU_MUL_ARCH: string:="dsp";
|
36 |
|
|
MODEL_LXP32C: boolean:=true;
|
37 |
|
|
TEST_CASE: string:="";
|
38 |
|
|
THROTTLE_DBUS: boolean:=true;
|
39 |
|
|
THROTTLE_IBUS: boolean:=true;
|
40 |
|
|
VERBOSE: boolean:=false
|
41 |
|
|
);
|
42 |
|
|
end entity;
|
43 |
|
|
|
44 |
|
|
architecture testbench of tb is
|
45 |
|
|
|
46 |
|
|
signal clk: std_logic:='0';
|
47 |
|
|
|
48 |
|
|
signal globals: soc_globals_type:=(others=>'1');
|
49 |
|
|
signal soc_wbs_in: soc_wbs_in_type;
|
50 |
|
|
signal soc_wbs_out: soc_wbs_out_type;
|
51 |
|
|
signal soc_wbm_in: soc_wbm_in_type;
|
52 |
|
|
signal soc_wbm_out: soc_wbm_out_type;
|
53 |
|
|
|
54 |
|
|
signal monitor_out: monitor_out_type;
|
55 |
|
|
|
56 |
|
|
signal finish: std_logic:='0';
|
57 |
|
|
|
58 |
|
|
begin
|
59 |
|
|
|
60 |
|
|
dut: entity work.platform(rtl)
|
61 |
|
|
generic map(
|
62 |
|
|
CPU_DBUS_RMW=>CPU_DBUS_RMW,
|
63 |
|
|
CPU_MUL_ARCH=>CPU_MUL_ARCH,
|
64 |
|
|
MODEL_LXP32C=>MODEL_LXP32C,
|
65 |
|
|
THROTTLE_DBUS=>THROTTLE_DBUS,
|
66 |
|
|
THROTTLE_IBUS=>THROTTLE_IBUS
|
67 |
|
|
)
|
68 |
|
|
port map(
|
69 |
|
|
clk_i=>clk,
|
70 |
|
|
rst_i=>globals.rst_i,
|
71 |
|
|
cpu_rst_i=>globals.cpu_rst_i,
|
72 |
|
|
|
73 |
|
|
wbm_cyc_o=>soc_wbm_out.cyc,
|
74 |
|
|
wbm_stb_o=>soc_wbm_out.stb,
|
75 |
|
|
wbm_we_o=>soc_wbm_out.we,
|
76 |
|
|
wbm_sel_o=>soc_wbm_out.sel,
|
77 |
|
|
wbm_ack_i=>soc_wbm_in.ack,
|
78 |
|
|
wbm_adr_o=>soc_wbm_out.adr,
|
79 |
|
|
wbm_dat_o=>soc_wbm_out.dat,
|
80 |
|
|
wbm_dat_i=>soc_wbm_in.dat,
|
81 |
|
|
|
82 |
|
|
wbs_cyc_i=>soc_wbs_in.cyc,
|
83 |
|
|
wbs_stb_i=>soc_wbs_in.stb,
|
84 |
|
|
wbs_we_i=>soc_wbs_in.we,
|
85 |
|
|
wbs_sel_i=>soc_wbs_in.sel,
|
86 |
|
|
wbs_ack_o=>soc_wbs_out.ack,
|
87 |
|
|
wbs_adr_i=>soc_wbs_in.adr,
|
88 |
|
|
wbs_dat_i=>soc_wbs_in.dat,
|
89 |
|
|
wbs_dat_o=>soc_wbs_out.dat
|
90 |
|
|
);
|
91 |
|
|
|
92 |
|
|
monitor_inst: entity work.monitor(sim)
|
93 |
|
|
generic map(
|
94 |
|
|
VERBOSE=>VERBOSE
|
95 |
|
|
)
|
96 |
|
|
port map(
|
97 |
|
|
clk_i=>clk,
|
98 |
|
|
rst_i=>globals.rst_i,
|
99 |
|
|
|
100 |
|
|
wbs_cyc_i=>soc_wbm_out.cyc,
|
101 |
|
|
wbs_stb_i=>soc_wbm_out.stb,
|
102 |
|
|
wbs_we_i=>soc_wbm_out.we,
|
103 |
|
|
wbs_sel_i=>soc_wbm_out.sel,
|
104 |
|
|
wbs_ack_o=>soc_wbm_in.ack,
|
105 |
|
|
wbs_adr_i=>soc_wbm_out.adr,
|
106 |
|
|
wbs_dat_i=>soc_wbm_out.dat,
|
107 |
|
|
wbs_dat_o=>soc_wbm_in.dat,
|
108 |
|
|
|
109 |
|
|
finished_o=>monitor_out.valid,
|
110 |
|
|
result_o=>monitor_out.data
|
111 |
|
|
);
|
112 |
|
|
|
113 |
|
|
clk<=not clk and not finish after 5 ns;
|
114 |
|
|
|
115 |
|
|
process is
|
116 |
|
|
begin
|
117 |
|
|
if TEST_CASE'length=0 then
|
118 |
|
|
run_test("test001.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
119 |
|
|
run_test("test002.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
120 |
|
|
run_test("test003.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
121 |
|
|
run_test("test004.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
122 |
|
|
run_test("test005.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
123 |
|
|
run_test("test006.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
124 |
|
|
run_test("test007.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
125 |
|
|
run_test("test008.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
126 |
|
|
run_test("test009.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
127 |
|
|
run_test("test010.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
128 |
|
|
run_test("test011.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
129 |
|
|
run_test("test012.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
130 |
|
|
run_test("test013.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
131 |
|
|
run_test("test014.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
132 |
|
|
run_test("test015.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
133 |
|
|
run_test("test016.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
134 |
|
|
run_test("test017.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
135 |
|
|
run_test("test018.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
136 |
|
|
run_test("test019.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
137 |
|
|
run_test("test020.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
138 |
|
|
else
|
139 |
|
|
run_test(TEST_CASE,clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
|
140 |
|
|
end if;
|
141 |
|
|
|
142 |
|
|
report "ALL TESTS WERE COMPLETED SUCCESSFULLY";
|
143 |
|
|
finish<='1';
|
144 |
|
|
wait;
|
145 |
|
|
end process;
|
146 |
|
|
|
147 |
|
|
end architecture;
|