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

Subversion Repositories c16

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

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
                clk : IN std_logic;
25
                cck : IN std_logic;
26
                switch : IN std_logic_vector(9 downto 0);
27
                ser_in : IN std_logic;
28
                temp_spo : IN std_logic;
29
                xm_rdat : IN std_logic_vector(7 downto 0);
30
                ser_out : OUT std_logic;
31
                temp_spi : OUT std_logic;
32
                temp_ce : OUT std_logic;
33
                temp_sclk : OUT std_logic;
34
                seg1 : OUT std_logic_vector(7 downto 0);
35
                seg2 : OUT std_logic_vector(7 downto 0);
36
                led : OUT std_logic_vector(7 downto 0);
37
                xm_adr : OUT std_logic_vector(15 downto 0);
38
                xm_wdat : OUT std_logic_vector(7 downto 0);
39
                xm_we : OUT std_logic;
40
                xm_ce : OUT std_logic
41
                );
42
        END COMPONENT;
43
 
44
        signal  clk :  std_logic;
45
        signal  cck :  std_logic;
46
        signal  switch :  std_logic_vector(9 downto 0) := "0000000000";
47
        signal  ser_in :  std_logic := '0';
48
        signal  temp_spo :  std_logic := '0';
49
        signal  xm_rdat : std_logic_vector(7 downto 0) := X"33";
50
        signal  ser_out : std_logic;
51
        signal  temp_spi : std_logic := '0';
52
        signal  temp_ce : std_logic;
53
        signal  temp_sclk : std_logic;
54
        signal  seg1 : std_logic_vector(7 downto 0) := X"00";
55
        signal  seg2 : std_logic_vector(7 downto 0) := X"00";
56
        signal  led : std_logic_vector(7 downto 0);
57
        signal  xm_adr : std_logic_vector(15 downto 0);
58
        signal  xm_wdat : std_logic_vector(7 downto 0);
59
        signal  xm_we : std_logic;
60
        signal  xm_ce : std_logic;
61
 
62
        signal clk_counter : INTEGER := 0;
63
 
64
BEGIN
65
 
66
        uut: cpu16 PORT MAP(
67
                clk => clk,
68
                cck => cck,
69
                switch => switch,
70
                ser_in => ser_in,
71
                ser_out => ser_out,
72
                temp_spo => temp_spo,
73
                temp_spi => temp_spi,
74
                temp_ce => temp_ce,
75
                temp_sclk => temp_sclk,
76
                seg1 => seg1,
77
                seg2 => seg2,
78
                led => led,
79
                xm_adr => xm_adr,
80
                xm_rdat => xm_rdat,
81
                xm_wdat => xm_wdat,
82
                xm_we => xm_we,
83
                xm_ce => xm_ce
84
        );
85
 
86
-- *** Test Bench - User Defined Section ***
87
        PROCESS -- clock process for CLK,
88
        BEGIN
89
                CLOCK_LOOP : LOOP
90
                        CLK <= transport '0';
91
                        WAIT FOR 1 ns;
92
                        CLK <= transport '1';
93
                        WAIT FOR 1 ns;
94
                        WAIT FOR 11 ns;
95
                        CLK <= transport '0';
96
                        WAIT FOR 12 ns;
97
                END LOOP CLOCK_LOOP;
98
        END PROCESS;
99
 
100
        PROCESS(CLK)
101
        BEGIN
102
                if (rising_edge(CLK)) then
103
                        CLK_COUNTER <= CLK_COUNTER + 1;
104
 
105
                        case CLK_COUNTER is
106
                                when 0           =>      switch(9 downto 8) <= "11";
107
                                when 1          =>      switch(9 downto 8) <= "00";
108
 
109
 
110
                                when 1000       =>      CLK_COUNTER <= 0;
111
                                                                ASSERT (FALSE) REPORT
112
                                                                        "simulation done (no error)"
113
                                                                        SEVERITY FAILURE;
114
                                when others     =>
115
                        end case;
116
                end if;
117
        END PROCESS;
118
 
119
END;

powered by: WebSVN 2.1.0

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