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

Subversion Repositories lattice6502

[/] [lattice6502/] [ghdl/] [Test_bench.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 stanley82
 
2
-- VHDL Test Bench Created from source file Processor.vhd -- 07-MAY-2008 01:09:40
3
---  25 October 2010 Ian Chapman
4
--   ******************************************************
5
---- Distributed under the GNU General Public License.    *
6
---- This can be obtained from “www.gnu.org”.             *
7
--   ******************************************************
8
--    This program is free software: you can redistribute it and/or modify
9
--    it under the terms of the GNU General Public License as published by
10
--    the Free Software Foundation, either version 3 of the License, or
11
--    (at your option) any later version.
12
--
13
--    This program is distributed in the hope that it will be useful,
14
--    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
--    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
--    GNU General Public License for more details.
17
--
18
--    You should have received a copy of the GNU General Public License
19
--    along with this program.  If not, see <http://www.gnu.org/licenses/>
20
--
21
-- Notes: 
22
-- 1) This testbench template has been automatically generated using types
23
-- std_logic and std_logic_vector for the ports of the unit under test.
24
-- Lattice recommends that these types always be used for the top-level
25
-- I/O of a design in order to guarantee that the testbench will bind
26
-- correctly to the timing (post-route) simulation model.
27
-- 2) To use this template as your testbench, change the filename to any
28
-- name of your choice with the extension .vhd, and use the "source->import"
29
-- menu in the ispLEVER Project Navigator to import the testbench.
30
-- Then edit the user defined section below, adding code to generate the 
31
-- stimulus for your design.
32
-- 3) VHDL simulations will produce errors if there are Lattice FPGA library 
33
 
34
-- elements in your design that require the instantiation of GSR, PUR, and
35
-- TSALL and they are not present in the testbench. For more information see
36
-- the How To section of online help.  
37
--
38
LIBRARY ieee;
39
USE ieee.std_logic_1164.ALL;
40
USE ieee.numeric_std.ALL;
41
 
42
ENTITY testbench IS
43
END testbench;
44
 
45
ARCHITECTURE behavior OF testbench IS
46
 
47
        COMPONENT Processor
48
        PORT(
49
                clk_pin : IN std_logic;
50
--              data_wr : inout unsigned(7 downto 0);
51
                Pwr_on_pin : out std_logic;
52
                rst_pin, irq_pin, nmi_pin : IN std_logic;
53
                RX_pin : in std_logic;
54
                Tx_pin : out std_logic
55
                );
56
        END COMPONENT;
57
 
58
        SIGNAL clk :  std_logic;
59
        signal RX_pin, TX_pin : std_logic;
60
        SIGNAL rst, nmi, irq :  std_logic;
61
--      signal data_wr : unsigned(7 downto 0);
62
 
63
BEGIN
64
 
65
-- Please check and add your generic clause manually
66
        uut: Processor PORT MAP(
67
                clk_pin => clk,
68
                irq_pin => irq,
69
                nmi_pin => nmi,
70
                RX_pin  => RX_pin,
71
                TX_pin  => TX_pin,
72
--              data_wr => data_wr,
73
                rst_pin => rst
74
        );
75
 
76
 
77
-- *** Test Bench - User Defined Section ***
78
 
79
clock : process
80
 
81
        begin
82
                clk <= '0';
83
        wait for 50 ns;
84
                clk <= '1';
85
        wait for 50 ns;
86
end process;
87
reset: process
88
        begin
89
        rst <= '0';
90
        wait for 175 ns;
91
        rst <= '1';
92
        wait; -- will wait forever
93
 
94
   END PROCESS;
95
 
96
--rx_232 : process
97
--      begin
98
--      RX_pin <= '1';
99
--      wait for 5 us;
100
--      RX_pin <= '0';
101
--      wait for 104 us;
102
--      RX_pin <= '1';
103
--      wait for 208 us;
104
--      RX_pin <= '0';
105
--      wait for 104 us;
106
--      RX_pin <= '1';
107
--      wait for 208 us;
108
--      RX_pin <= '0';
109
--      wait for 208 us;
110
--      RX_pin <= '1';
111
--      WAIT;
112
--END PROCESS;
113
 
114
 
115
 
116
interrupt: process
117
        begin
118
        irq <= '1';
119
        nmi <= '1';
120
        wait for 2 us;
121
        irq <= '1';
122
        nmi <= '1';
123
        wait for 100 ns;
124
        irq <= '1';
125
        nmi <= '1';
126
 
127
        wait;   --will wait forever
128
 
129
   END PROCESS;
130
-- *** End Test Bench - User Defined Section ***
131
 
132
END behavior;
133
 

powered by: WebSVN 2.1.0

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