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

Subversion Repositories lxp32

[/] [lxp32/] [trunk/] [verify/] [lxp32/] [src/] [tb/] [tb.vhd] - Diff between revs 6 and 9

Only display areas with differences | Details | Blame | View Log

Rev 6 Rev 9
---------------------------------------------------------------------
---------------------------------------------------------------------
-- LXP32 verification environment (self-checking testbench)
-- LXP32 verification environment (self-checking testbench)
--
--
-- Part of the LXP32 testbench
-- Part of the LXP32 testbench
--
--
-- Copyright (c) 2016 by Alex I. Kuznetsov
-- Copyright (c) 2016 by Alex I. Kuznetsov
--
--
-- Simulates LXP32 test platform, verifies results.
-- Simulates LXP32 test platform, verifies results.
--
--
-- Parameters:
-- Parameters:
--     CPU_DBUS_RMW:    DBUS_RMW CPU generic
--     CPU_DBUS_RMW:    DBUS_RMW CPU generic
--     CPU_MUL_ARCH:    MUL_ARCH CPU generic
--     CPU_MUL_ARCH:    MUL_ARCH CPU generic
--     MODEL_LXP32C:    when true, simulates LXP32C variant (with
--     MODEL_LXP32C:    when true, simulates LXP32C variant (with
--                      instruction cache), otherwise LXP32U
--                      instruction cache), otherwise LXP32U
--     TEST_CASE:       If non-empty, selects a test case to run.
--     TEST_CASE:       If non-empty, selects a test case to run.
--                      If empty, all tests are executed.
--                      If empty, all tests are executed.
--     THROTTLE_IBUS:   perform pseudo-random instruction bus
--     THROTTLE_IBUS:   perform pseudo-random instruction bus
--                      throttling
--                      throttling
--     THROTTLE_DBUS:   perform pseudo-random data bus throttling
--     THROTTLE_DBUS:   perform pseudo-random data bus throttling
--     VERBOSE:         report everything that is written to the
--     VERBOSE:         report everything that is written to the
--                      test monitor address space
--                      test monitor address space
---------------------------------------------------------------------
---------------------------------------------------------------------
 
 
use std.textio.all;
use std.textio.all;
 
 
library ieee;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.numeric_std.all;
 
 
use work.tb_pkg.all;
use work.tb_pkg.all;
 
 
entity tb is
entity tb is
        generic(
        generic(
                CPU_DBUS_RMW: boolean:=false;
                CPU_DBUS_RMW: boolean:=false;
                CPU_MUL_ARCH: string:="dsp";
                CPU_MUL_ARCH: string:="dsp";
                MODEL_LXP32C: boolean:=true;
                MODEL_LXP32C: boolean:=true;
                TEST_CASE: string:="";
                TEST_CASE: string:="";
                THROTTLE_DBUS: boolean:=true;
                THROTTLE_DBUS: boolean:=true;
                THROTTLE_IBUS: boolean:=true;
                THROTTLE_IBUS: boolean:=true;
                VERBOSE: boolean:=false
                VERBOSE: boolean:=false
        );
        );
end entity;
end entity;
 
 
architecture testbench of tb is
architecture testbench of tb is
 
 
signal clk: std_logic:='0';
signal clk: std_logic:='0';
 
 
signal globals: soc_globals_type:=(others=>'1');
signal globals: soc_globals_type:=(others=>'1');
signal soc_wbs_in: soc_wbs_in_type;
signal soc_wbs_in: soc_wbs_in_type;
signal soc_wbs_out: soc_wbs_out_type;
signal soc_wbs_out: soc_wbs_out_type;
signal soc_wbm_in: soc_wbm_in_type;
signal soc_wbm_in: soc_wbm_in_type;
signal soc_wbm_out: soc_wbm_out_type;
signal soc_wbm_out: soc_wbm_out_type;
 
 
signal monitor_out: monitor_out_type;
signal monitor_out: monitor_out_type;
 
 
signal finish: std_logic:='0';
signal finish: std_logic:='0';
 
 
begin
begin
 
 
dut: entity work.platform(rtl)
dut: entity work.platform(rtl)
        generic map(
        generic map(
                CPU_DBUS_RMW=>CPU_DBUS_RMW,
                CPU_DBUS_RMW=>CPU_DBUS_RMW,
                CPU_MUL_ARCH=>CPU_MUL_ARCH,
                CPU_MUL_ARCH=>CPU_MUL_ARCH,
                MODEL_LXP32C=>MODEL_LXP32C,
                MODEL_LXP32C=>MODEL_LXP32C,
                THROTTLE_DBUS=>THROTTLE_DBUS,
                THROTTLE_DBUS=>THROTTLE_DBUS,
                THROTTLE_IBUS=>THROTTLE_IBUS
                THROTTLE_IBUS=>THROTTLE_IBUS
        )
        )
        port map(
        port map(
                clk_i=>clk,
                clk_i=>clk,
                rst_i=>globals.rst_i,
                rst_i=>globals.rst_i,
                cpu_rst_i=>globals.cpu_rst_i,
                cpu_rst_i=>globals.cpu_rst_i,
 
 
                wbm_cyc_o=>soc_wbm_out.cyc,
                wbm_cyc_o=>soc_wbm_out.cyc,
                wbm_stb_o=>soc_wbm_out.stb,
                wbm_stb_o=>soc_wbm_out.stb,
                wbm_we_o=>soc_wbm_out.we,
                wbm_we_o=>soc_wbm_out.we,
                wbm_sel_o=>soc_wbm_out.sel,
                wbm_sel_o=>soc_wbm_out.sel,
                wbm_ack_i=>soc_wbm_in.ack,
                wbm_ack_i=>soc_wbm_in.ack,
                wbm_adr_o=>soc_wbm_out.adr,
                wbm_adr_o=>soc_wbm_out.adr,
                wbm_dat_o=>soc_wbm_out.dat,
                wbm_dat_o=>soc_wbm_out.dat,
                wbm_dat_i=>soc_wbm_in.dat,
                wbm_dat_i=>soc_wbm_in.dat,
 
 
                wbs_cyc_i=>soc_wbs_in.cyc,
                wbs_cyc_i=>soc_wbs_in.cyc,
                wbs_stb_i=>soc_wbs_in.stb,
                wbs_stb_i=>soc_wbs_in.stb,
                wbs_we_i=>soc_wbs_in.we,
                wbs_we_i=>soc_wbs_in.we,
                wbs_sel_i=>soc_wbs_in.sel,
                wbs_sel_i=>soc_wbs_in.sel,
                wbs_ack_o=>soc_wbs_out.ack,
                wbs_ack_o=>soc_wbs_out.ack,
                wbs_adr_i=>soc_wbs_in.adr,
                wbs_adr_i=>soc_wbs_in.adr,
                wbs_dat_i=>soc_wbs_in.dat,
                wbs_dat_i=>soc_wbs_in.dat,
                wbs_dat_o=>soc_wbs_out.dat
                wbs_dat_o=>soc_wbs_out.dat
        );
        );
 
 
monitor_inst: entity work.monitor(sim)
monitor_inst: entity work.monitor(sim)
        generic map(
        generic map(
                VERBOSE=>VERBOSE
                VERBOSE=>VERBOSE
        )
        )
        port map(
        port map(
                clk_i=>clk,
                clk_i=>clk,
                rst_i=>globals.rst_i,
                rst_i=>globals.rst_i,
 
 
                wbs_cyc_i=>soc_wbm_out.cyc,
                wbs_cyc_i=>soc_wbm_out.cyc,
                wbs_stb_i=>soc_wbm_out.stb,
                wbs_stb_i=>soc_wbm_out.stb,
                wbs_we_i=>soc_wbm_out.we,
                wbs_we_i=>soc_wbm_out.we,
                wbs_sel_i=>soc_wbm_out.sel,
                wbs_sel_i=>soc_wbm_out.sel,
                wbs_ack_o=>soc_wbm_in.ack,
                wbs_ack_o=>soc_wbm_in.ack,
                wbs_adr_i=>soc_wbm_out.adr,
                wbs_adr_i=>soc_wbm_out.adr,
                wbs_dat_i=>soc_wbm_out.dat,
                wbs_dat_i=>soc_wbm_out.dat,
                wbs_dat_o=>soc_wbm_in.dat,
                wbs_dat_o=>soc_wbm_in.dat,
 
 
                finished_o=>monitor_out.valid,
                finished_o=>monitor_out.valid,
                result_o=>monitor_out.data
                result_o=>monitor_out.data
        );
        );
 
 
clk<=not clk and not finish after 5 ns;
clk<=not clk and not finish after 5 ns;
 
 
process is
process is
begin
begin
        if TEST_CASE'length=0 then
        if TEST_CASE'length=0 then
                run_test("test001.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test001.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test002.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test002.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test003.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test003.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test004.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test004.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test005.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test005.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test006.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test006.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test007.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test007.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test008.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test008.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test009.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test009.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test010.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test010.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test011.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test011.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test012.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test012.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test013.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test013.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test014.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test014.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test015.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test015.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test016.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test016.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test017.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test017.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test018.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test018.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test019.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test019.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test020.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test("test020.ram",clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
        else
        else
                run_test(TEST_CASE,clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
                run_test(TEST_CASE,clk,globals,soc_wbs_in,soc_wbs_out,monitor_out);
        end if;
        end if;
 
 
        report "ALL TESTS WERE COMPLETED SUCCESSFULLY";
        report "ALL TESTS WERE COMPLETED SUCCESSFULLY";
        finish<='1';
        finish<='1';
        wait;
        wait;
end process;
end process;
 
 
end architecture;
end architecture;
 
 

powered by: WebSVN 2.1.0

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