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

Subversion Repositories c16

[/] [c16/] [trunk/] [vhdl/] [test.vhd] - Diff between revs 9 and 26

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 9 Rev 26
 
 
-- VHDL Test Bench Created from source file cpu_engine.vhd -- 12:41:11 06/20/2003
-- VHDL Test Bench Created from source file cpu_engine.vhd -- 12:41:11 06/20/2003
--
--
-- Notes: 
-- Notes: 
-- This testbench has been automatically generated using types std_logic and
-- This testbench has been automatically generated using types std_logic and
-- std_logic_vector for the ports of the unit under test.  Xilinx recommends 
-- std_logic_vector for the ports of the unit under test.  Xilinx recommends 
-- that these types always be used for the top-level I/O of a design in order 
-- that these types always be used for the top-level I/O of a design in order 
-- to guarantee that the testbench will bind correctly to the post-implementation 
-- to guarantee that the testbench will bind correctly to the post-implementation 
-- simulation model.
-- simulation model.
--
--
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.cpu_pack.ALL;
use work.cpu_pack.ALL;
 
 
ENTITY testbench IS
ENTITY testbench IS
END testbench;
END testbench;
 
 
ARCHITECTURE behavior OF testbench IS
ARCHITECTURE behavior OF testbench IS
 
 
        COMPONENT cpu_engine
        COMPONENT cpu_engine
        PORT(
        PORT(
                clk_i : IN std_logic;
                clk_i : IN std_logic;
                dat_i : IN std_logic_vector(7 downto 0);
                dat_i : IN std_logic_vector(7 downto 0);
                rst_i : IN std_logic;
                rst_i : IN std_logic;
                ack_i : IN std_logic;
                ack_i : IN std_logic;
                int : IN std_logic;
                int : IN std_logic;
                dat_o : OUT std_logic_vector(7 downto 0);
                dat_o : OUT std_logic_vector(7 downto 0);
                adr_o : OUT std_logic_vector(15 downto 0);
                adr_o : OUT std_logic_vector(15 downto 0);
                cyc_o : OUT std_logic;
                cyc_o : OUT std_logic;
                stb_o : OUT std_logic;
                stb_o : OUT std_logic;
                tga_o : OUT std_logic_vector(0 to 0);
                tga_o : OUT std_logic_vector(0 to 0);
                we_o : OUT std_logic;
                we_o : OUT std_logic;
                halt : OUT std_logic;
                halt : OUT std_logic;
                q_pc : OUT std_logic_vector(15 downto 0);
                q_pc : OUT std_logic_vector(15 downto 0);
                q_opc : OUT std_logic_vector(7 downto 0);
                q_opc : OUT std_logic_vector(7 downto 0);
                q_cat : OUT op_category;
                q_cat : OUT op_category;
                q_imm : OUT std_logic_vector(15 downto 0);
                q_imm : OUT std_logic_vector(15 downto 0);
                q_cyc : OUT cycle;
                q_cyc : OUT cycle;
                q_sx : OUT std_logic_vector(1 downto 0);
                q_sx : OUT std_logic_vector(1 downto 0);
                q_sy : OUT std_logic_vector(3 downto 0);
                q_sy : OUT std_logic_vector(3 downto 0);
                q_op : OUT std_logic_vector(4 downto 0);
                q_op : OUT std_logic_vector(4 downto 0);
                q_sa : OUT std_logic_vector(4 downto 0);
                q_sa : OUT std_logic_vector(4 downto 0);
                q_smq : OUT std_logic;
                q_smq : OUT std_logic;
                q_we_rr : OUT std_logic;
                q_we_rr : OUT std_logic;
                q_we_ll : OUT std_logic;
                q_we_ll : OUT std_logic;
                q_we_sp : OUT SP_OP;
                q_we_sp : OUT SP_OP;
                q_rr : OUT std_logic_vector(15 downto 0);
                q_rr : OUT std_logic_vector(15 downto 0);
                q_ll : OUT std_logic_vector(15 downto 0);
                q_ll : OUT std_logic_vector(15 downto 0);
                q_sp : OUT std_logic_vector(15 downto 0)
                q_sp : OUT std_logic_vector(15 downto 0)
                );
                );
        END COMPONENT;
        END COMPONENT;
 
 
        signal  CLK_I   : std_logic;
        signal  CLK_I   : std_logic;
        signal  DAT_I   : std_logic_vector( 7 downto 0);
        signal  DAT_I   : std_logic_vector( 7 downto 0);
        signal  DAT_O   : std_logic_vector( 7 downto 0);
        signal  DAT_O   : std_logic_vector( 7 downto 0);
        signal  RST_I   : std_logic;
        signal  RST_I   : std_logic;
        signal  ACK_I   : std_logic;
        signal  ACK_I   : std_logic;
        signal  ADR_O   : std_logic_vector(15 downto 0);
        signal  ADR_O   : std_logic_vector(15 downto 0);
        signal  CYC_O   : std_logic;
        signal  CYC_O   : std_logic;
        signal  STB_O   : std_logic;
        signal  STB_O   : std_logic;
        signal  TGA_O   : std_logic_vector( 0 downto 0);          -- '1' if I/O
        signal  TGA_O   : std_logic_vector( 0 downto 0);          -- '1' if I/O
        signal  WE_O    : std_logic;
        signal  WE_O    : std_logic;
 
 
        signal  INT     : std_logic;
        signal  INT     : std_logic;
        signal  HALT    : std_logic;
        signal  HALT    : std_logic;
 
 
                        -- debug signals
                        -- debug signals
                        --
                        --
        signal  Q_PC    : std_logic_vector(15 downto 0);
        signal  Q_PC    : std_logic_vector(15 downto 0);
        signal  Q_OPC   : std_logic_vector( 7 downto 0);
        signal  Q_OPC   : std_logic_vector( 7 downto 0);
        signal  Q_CAT   : op_category;
        signal  Q_CAT   : op_category;
        signal  Q_IMM   : std_logic_vector(15 downto 0);
        signal  Q_IMM   : std_logic_vector(15 downto 0);
        signal  Q_CYC   : cycle;
        signal  Q_CYC   : cycle;
 
 
                        -- select signals
                        -- select signals
        signal  Q_SX    : std_logic_vector(1 downto 0);
        signal  Q_SX    : std_logic_vector(1 downto 0);
        signal  Q_SY    : std_logic_vector(3 downto 0);
        signal  Q_SY    : std_logic_vector(3 downto 0);
        signal  Q_OP    : std_logic_vector(4 downto 0);
        signal  Q_OP    : std_logic_vector(4 downto 0);
        signal  Q_SA    : std_logic_vector(4 downto 0);
        signal  Q_SA    : std_logic_vector(4 downto 0);
        signal  Q_SMQ   : std_logic;
        signal  Q_SMQ   : std_logic;
 
 
                        -- write enable/select signal
                        -- write enable/select signal
        signal  Q_WE_RR : std_logic;
        signal  Q_WE_RR : std_logic;
        signal  Q_WE_LL : std_logic;
        signal  Q_WE_LL : std_logic;
        signal  Q_WE_SP : SP_OP;
        signal  Q_WE_SP : SP_OP;
 
 
        signal  Q_RR    : std_logic_vector(15 downto 0);
        signal  Q_RR    : std_logic_vector(15 downto 0);
        signal  Q_LL    : std_logic_vector(15 downto 0);
        signal  Q_LL    : std_logic_vector(15 downto 0);
        signal  Q_SP    : std_logic_vector(15 downto 0);
        signal  Q_SP    : std_logic_vector(15 downto 0);
 
 
        signal  clk_counter : INTEGER := 0;
        signal  clk_counter : INTEGER := 0;
 
 
BEGIN
BEGIN
 
 
        uut: cpu_engine
        uut: cpu_engine
        PORT MAP(
        PORT MAP(
                clk_i => clk_i,
                clk_i => clk_i,
                dat_i => dat_i,
                dat_i => dat_i,
                dat_o => dat_o,
                dat_o => dat_o,
                rst_i => rst_i,
                rst_i => rst_i,
                ack_i => ack_i,
                ack_i => ack_i,
                adr_o => adr_o,
                adr_o => adr_o,
                cyc_o => cyc_o,
                cyc_o => cyc_o,
                stb_o => stb_o,
                stb_o => stb_o,
                tga_o => tga_o,
                tga_o => tga_o,
                we_o => we_o,
                we_o => we_o,
                int => int,
                int => int,
                halt => halt,
                halt => halt,
                q_pc => q_pc,
                q_pc => q_pc,
                q_opc => q_opc,
                q_opc => q_opc,
                q_cat => q_cat,
                q_cat => q_cat,
                q_imm => q_imm,
                q_imm => q_imm,
                q_cyc => q_cyc,
                q_cyc => q_cyc,
                q_sx => q_sx,
                q_sx => q_sx,
                q_sy => q_sy,
                q_sy => q_sy,
                q_op => q_op,
                q_op => q_op,
                q_sa => q_sa,
                q_sa => q_sa,
                q_smq => q_smq,
                q_smq => q_smq,
                q_we_rr => q_we_rr,
                q_we_rr => q_we_rr,
                q_we_ll => q_we_ll,
                q_we_ll => q_we_ll,
                q_we_sp => q_we_sp,
                q_we_sp => q_we_sp,
                q_rr => q_rr,
                q_rr => q_rr,
                q_ll => q_ll,
                q_ll => q_ll,
                q_sp => q_sp
                q_sp => q_sp
        );
        );
 
 
        ack_i <= stb_o;
        ack_i <= stb_o;
 
 
-- *** Test Bench - User Defined Section ***
-- *** Test Bench - User Defined Section ***
        PROCESS -- clock process for CLK_I,
        PROCESS -- clock process for CLK_I,
        BEGIN
        BEGIN
                CLOCK_LOOP : LOOP
                CLOCK_LOOP : LOOP
                        CLK_I <= transport '0';
                        CLK_I <= transport '0';
                        WAIT FOR 1 ns;
                        WAIT FOR 1 ns;
                        CLK_I <= transport '1';
                        CLK_I <= transport '1';
                        WAIT FOR 1 ns;
                        WAIT FOR 1 ns;
                        WAIT FOR 11 ns;
                        WAIT FOR 11 ns;
                        CLK_I <= transport '0';
                        CLK_I <= transport '0';
                        WAIT FOR 12 ns;
                        WAIT FOR 12 ns;
                END LOOP CLOCK_LOOP;
                END LOOP CLOCK_LOOP;
        END PROCESS;
        END PROCESS;
 
 
        PROCESS(CLK_I)
        PROCESS(CLK_I)
        BEGIN
        BEGIN
                if (rising_edge(CLK_I)) then
                if (rising_edge(CLK_I)) then
                        if (Q_CYC = M1) then
                        if (Q_CYC = M1) then
                                CLK_COUNTER <= CLK_COUNTER + 1;
                                CLK_COUNTER <= CLK_COUNTER + 1;
                        end if;
                        end if;
 
 
                        if (ADR_O(0) = '0') then          DAT_I <= X"44"; -- data
                        if (ADR_O(0) = '0') then          DAT_I <= X"44"; -- data
                        else                                                    DAT_I <= X"01"; -- control
                        else                                                    DAT_I <= X"01"; -- control
                        end if;
                        end if;
 
 
                        case CLK_COUNTER is
                        case CLK_COUNTER is
                                when 0           =>      RST_I <= '1';   INT <= '0';
                                when 0           =>      RST_I <= '1';   INT <= '0';
                                when 1          =>      RST_I <= '0';
                                when 1          =>      RST_I <= '0';
--                              when 20         =>      INT <= '1';
--                              when 20         =>      INT <= '1';
 
 
 
 
                                when 1000       =>      CLK_COUNTER <= 0;
                                when 1000       =>      CLK_COUNTER <= 0;
                                                                ASSERT (FALSE) REPORT
                                                                ASSERT (FALSE) REPORT
                                                                        "simulation done (no error)"
                                                                        "simulation done (no error)"
                                                                        SEVERITY FAILURE;
                                                                        SEVERITY FAILURE;
                                when others     =>
                                when others     =>
                        end case;
                        end case;
                end if;
                end if;
        END PROCESS;
        END PROCESS;
 
 
END;
END;
 
 

powered by: WebSVN 2.1.0

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