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

Subversion Repositories c16

[/] [c16/] [trunk/] [vhdl/] [cpu_test.vhd] - Blame information for rev 33

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

Line No. Rev Author Line
1 2 jsauermann
 
2
-- VHDL Test Bench Created from source file cpu_engine.vhd -- 12:41:11 06/20/2003
3
--
4
-- Notes: 
5
-- This testbench has been automatically generated using types std_logic and
6
-- std_logic_vector for the ports of the unit under test.  Xilinx recommends 
7
-- that these types always be used for the top-level I/O of a design in order 
8
-- to guarantee that the testbench will bind correctly to the post-implementation 
9
-- simulation model.
10
--
11
LIBRARY ieee;
12
USE ieee.std_logic_1164.ALL;
13
USE ieee.numeric_std.ALL;
14
 
15
use work.cpu_pack.ALL;
16
 
17
ENTITY testbench IS
18
END testbench;
19
 
20
ARCHITECTURE behavior OF testbench IS
21
 
22
        COMPONENT cpu16
23
        PORT(
24 9 jsauermann
                clk_i : IN std_logic;
25 2 jsauermann
                switch : IN std_logic_vector(9 downto 0);
26
                ser_in : IN std_logic;
27
                temp_spo : IN std_logic;
28
                xm_rdat : IN std_logic_vector(7 downto 0);
29
                ser_out : OUT std_logic;
30
                temp_spi : OUT std_logic;
31
                temp_ce : OUT std_logic;
32
                temp_sclk : OUT std_logic;
33
                seg1 : OUT std_logic_vector(7 downto 0);
34
                seg2 : OUT std_logic_vector(7 downto 0);
35
                led : OUT std_logic_vector(7 downto 0);
36
                xm_adr : OUT std_logic_vector(15 downto 0);
37
                xm_wdat : OUT std_logic_vector(7 downto 0);
38
                xm_we : OUT std_logic;
39
                xm_ce : OUT std_logic
40
                );
41
        END COMPONENT;
42
 
43 9 jsauermann
        signal  clk_i :  std_logic;
44 2 jsauermann
        signal  switch :  std_logic_vector(9 downto 0) := "0000000000";
45
        signal  ser_in :  std_logic := '0';
46
        signal  temp_spo :  std_logic := '0';
47
        signal  xm_rdat : std_logic_vector(7 downto 0) := X"33";
48
        signal  ser_out : std_logic;
49
        signal  temp_spi : std_logic := '0';
50
        signal  temp_ce : std_logic;
51
        signal  temp_sclk : std_logic;
52
        signal  seg1 : std_logic_vector(7 downto 0) := X"00";
53
        signal  seg2 : std_logic_vector(7 downto 0) := X"00";
54
        signal  led : std_logic_vector(7 downto 0);
55
        signal  xm_adr : std_logic_vector(15 downto 0);
56
        signal  xm_wdat : std_logic_vector(7 downto 0);
57
        signal  xm_we : std_logic;
58
        signal  xm_ce : std_logic;
59
 
60
        signal clk_counter : INTEGER := 0;
61
 
62
BEGIN
63
 
64
        uut: cpu16 PORT MAP(
65 9 jsauermann
                clk_i => clk_i,
66 2 jsauermann
                switch => switch,
67
                ser_in => ser_in,
68
                ser_out => ser_out,
69
                temp_spo => temp_spo,
70
                temp_spi => temp_spi,
71
                temp_ce => temp_ce,
72
                temp_sclk => temp_sclk,
73
                seg1 => seg1,
74
                seg2 => seg2,
75
                led => led,
76
                xm_adr => xm_adr,
77
                xm_rdat => xm_rdat,
78
                xm_wdat => xm_wdat,
79
                xm_we => xm_we,
80
                xm_ce => xm_ce
81
        );
82
 
83
-- *** Test Bench - User Defined Section ***
84
        PROCESS -- clock process for CLK,
85
        BEGIN
86
                CLOCK_LOOP : LOOP
87 9 jsauermann
                        CLK_I <= transport '0';
88 2 jsauermann
                        WAIT FOR 1 ns;
89 9 jsauermann
                        CLK_I <= transport '1';
90 2 jsauermann
                        WAIT FOR 1 ns;
91
                        WAIT FOR 11 ns;
92 9 jsauermann
                        CLK_I <= transport '0';
93 2 jsauermann
                        WAIT FOR 12 ns;
94
                END LOOP CLOCK_LOOP;
95
        END PROCESS;
96
 
97 9 jsauermann
        PROCESS(CLK_I)
98 2 jsauermann
        BEGIN
99 9 jsauermann
                if (rising_edge(CLK_I)) then
100 2 jsauermann
                        CLK_COUNTER <= CLK_COUNTER + 1;
101
 
102
                        case CLK_COUNTER is
103
                                when 0           =>      switch(9 downto 8) <= "11";
104
                                when 1          =>      switch(9 downto 8) <= "00";
105
 
106
 
107
                                when 1000       =>      CLK_COUNTER <= 0;
108
                                                                ASSERT (FALSE) REPORT
109
                                                                        "simulation done (no error)"
110
                                                                        SEVERITY FAILURE;
111
                                when others     =>
112
                        end case;
113
                end if;
114
        END PROCESS;
115
 
116
END;

powered by: WebSVN 2.1.0

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