OpenCores
URL https://opencores.org/ocsvn/lxp32/lxp32/trunk

Subversion Repositories lxp32

[/] [lxp32/] [trunk/] [verify/] [lxp32/] [src/] [tb/] [tb.vhd] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.