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

Subversion Repositories System11

[/] [System11/] [trunk/] [rtl/] [vhdl/] [testbench4.vhd] - Blame information for rev 4

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

Line No. Rev Author Line
1 4 dilbert57
--===========================================================================--
2
--
3
-- CPU11 Microprocessor Test Bench 4
4
--
5
-- Complete system test
6
--
7
-- John Kent 21st October 2002
8
--
9
--
10
-------------------------------------------------------------------------------
11
library ieee;
12
   use ieee.std_logic_1164.all;
13
   use IEEE.STD_LOGIC_ARITH.ALL;
14
   use IEEE.STD_LOGIC_UNSIGNED.ALL;
15
   use ieee.numeric_std.all;
16
 
17
entity my_testbench4 is
18
end my_testbench4;
19
 
20
-------------------------------------------------------------------------------
21
-- Architecture for System11 Testbench 4
22
-------------------------------------------------------------------------------
23
architecture behavior of my_testbench4 is
24
 
25
signal    tb_SysClk       : Std_Logic;  -- System Clock input
26
signal   tb_Reset_n      : Std_logic;  -- Master Reset input (active low)
27
signal    tb_LED          : std_logic;  -- Diagnostic LED Flasher
28
 
29
    -- Memory Interface signals
30
signal    tb_ram_csn      : Std_Logic;
31
signal    tb_ram_wrln     : Std_Logic;
32
signal    tb_ram_wrun     : Std_Logic;
33
signal    tb_ram_addr     : Std_Logic_Vector(16 downto 0);
34
signal    tb_ram_data     : Std_Logic_Vector(15 downto 0);
35
         -- Uart Interface
36
signal    tb_rxbit        : Std_Logic;
37
signal   tb_txbit        : Std_Logic;
38
signal    tb_rts_n        : Std_Logic;
39
signal    tb_cts_n        : Std_Logic;
40
    -- Compact Flash B5-CF Module
41
signal    tb_cf_rst_n     : std_logic;
42
signal   tb_cf_cs0_n     : std_logic;
43
signal   tb_cf_cs1_n     : std_logic;
44
signal    tb_cf_rd_n      : std_logic;
45
signal    tb_cf_wr_n      : std_logic;
46
signal   tb_cf_cs16_n    : std_logic;
47
signal    tb_cf_a         : std_logic_vector(2 downto 0);
48
signal    tb_cf_d         : std_logic_vector(15 downto 0);
49
-- I/O Ports
50
signal    tb_Porta        : std_logic_vector(7 downto 0);
51
signal    tb_Portb        : std_logic_vector(7 downto 0);
52
--signal    tb_PortC        : std_logic_vector(7 downto 0);
53
--signal    tb_PortD        : std_logic_vector(7 downto 0);
54
 
55
-- CPU bus
56
signal   tb_bus_clk      : std_logic;
57
signal   tb_bus_reset    : std_logic;
58
signal   tb_bus_rw       : std_logic;
59
signal   tb_bus_cs       : std_logic;
60
signal    tb_bus_addr     : std_logic_vector(15 downto 0);
61
signal   tb_bus_data     : std_logic_vector(7 downto 0);
62
 
63
signal    tb_reset        : std_logic;
64
signal    tb_ram_cs       : std_logic;
65
signal    tb_ramlo_din    : std_logic_vector(7 downto 0);
66
signal    tb_ramlo_dout   : std_logic_vector(7 downto 0);
67
signal    tb_ramhi_din    : std_logic_vector(7 downto 0);
68
signal    tb_ramhi_dout   : std_logic_vector(7 downto 0);
69
 
70
-- Timer I/O
71
signal   tb_timer_out    : std_logic;
72
 
73
component System11
74
  port(
75
    SysClk      : in  Std_Logic;  -- System Clock input
76
         Reset_n     : in  Std_logic;  -- Master Reset input (active low)
77
    LED         : out std_logic;  -- Diagnostic LED Flasher
78
 
79
    -- Memory Interface signals
80
    ram_csn     : out Std_Logic;
81
    ram_wrln    : out Std_Logic;
82
    ram_wrun    : out Std_Logic;
83
    ram_addr    : out Std_Logic_Vector(16 downto 0);
84
    ram_data    : inout Std_Logic_Vector(15 downto 0);
85
 
86
         -- Stuff on the peripheral board
87
 
88
         -- PS/2 Keyboard
89
--       kb_clock    : inout Std_logic;
90
--       kb_data     : inout Std_Logic;
91
 
92
         -- PS/2 Mouse interface
93
--       mouse_clock : in  Std_Logic;
94
--       mouse_data  : in  Std_Logic;
95
 
96
         -- Uart Interface
97
    rxbit       : in  Std_Logic;
98
         txbit       : out Std_Logic;
99
    rts_n       : out Std_Logic;
100
    cts_n       : in  Std_Logic;
101
 
102
         -- CRTC output signals
103
--              v_drive     : out Std_Logic;
104
--    h_drive     : out Std_Logic;
105
--    blue_lo     : out std_logic;
106
--    blue_hi     : out std_logic;
107
--    green_lo    : out std_logic;
108
--    green_hi    : out std_logic;
109
--    red_lo      : out std_logic;
110
--    red_hi      : out std_logic;
111
--       buzzer      : out std_logic;
112
 
113
    -- Compact Flash B5-CF Module
114
    cf_rst_n     : out std_logic;
115
         cf_cs0_n     : out std_logic;
116
         cf_cs1_n     : out std_logic;
117
    cf_rd_n      : out std_logic;
118
    cf_wr_n      : out std_logic;
119
         cf_cs16_n    : out std_logic;
120
    cf_a         : out std_logic_vector(2 downto 0);
121
    cf_d         : inout std_logic_vector(15 downto 0);
122
--    cf_intrq     : in std_logic;
123
--    cf_iordy     : in std_logic;
124
--      cf_dase      : in std_logic;
125
--         cf_pdiag     : in std_logic;
126
--         cf_present   : in std_logic;
127
 
128
-- I/O Ports
129
    Porta        : inout std_logic_vector(7 downto 0);
130
    Portb        : inout std_logic_vector(7 downto 0);
131
--    PortC        : inout std_logic_vector(7 downto 0);
132
--    PortD        : inout std_logic_vector(7 downto 0);
133
 
134
-- CPU bus
135
         bus_clk      : out std_logic;
136
         bus_reset    : out std_logic;
137
         bus_rw       : out std_logic;
138
         bus_cs       : out std_logic;
139
    bus_addr     : out std_logic_vector(15 downto 0);
140
         bus_data     : inout std_logic_vector(7 downto 0);
141
 
142
-- Timer I/O
143
         timer_out    : out std_logic
144
         );
145
end component;
146
 
147
component my_ram
148
        port (
149
         clk       : in  std_logic;
150
    rst       : in  std_logic;
151
    cs        : in  std_logic;
152
    rw        : in  std_logic;
153
    addr      : in  std_logic_vector(5 downto 0);
154
         data_in   : in  std_logic_vector(7 downto 0);
155
         data_out  : out std_logic_vector(7 downto 0)
156
         );
157
end component;
158
 
159
begin
160
 
161
my_system11:  System11 port map (
162
    SysClk     => tb_SysClk,  -- System Clock input
163
         Reset_n    => tb_Reset_n,  -- Master Reset input (active low)
164
    LED        => tb_LED,  -- Diagnostic LED Flasher
165
 
166
    -- Memory Interface signals
167
    ram_csn     => tb_ram_csn,
168
    ram_wrln    => tb_ram_wrln,
169
    ram_wrun    => tb_ram_wrun,
170
    ram_addr    => tb_ram_addr,
171
    ram_data    => tb_ram_data,
172
 
173
         -- Stuff on the peripheral board
174
 
175
         -- PS/2 Keyboard
176
--       kb_clock   => tb_kb_clk.
177
--       kb_data    => tb_kb_data,
178
 
179
         -- PS/2 Mouse interface
180
--       mouse_clock => tb_mouse_clock,
181
--       mouse_data  => tb_mouse_data,
182
 
183
         -- Uart Interface
184
    rxbit       => tb_rxbit,
185
         txbit       => tb_txbit,
186
    rts_n       => tb_rts_n,
187
    cts_n       => tb_cts_n,
188
 
189
         -- CRTC output signals
190
--              v_drive    => tb_v_drive,
191
--    h_drive    => tb_h_drive,
192
--    blue_lo    => tb_blue_lo,
193
--    blue_hi    => tb_blue_hi,
194
--    green_lo   => tb_green_lo,
195
--    green_hi   => tb_green_hi,
196
--    red_lo     => tb_red_lo,
197
--    red_hi     => tb_red_hi,
198
--         buzzer     => tb_buzzer,
199
 
200
    -- Compact Flash B5-CF Module
201
    cf_rst_n     => tb_cf_rst_n,
202
         cf_cs0_n     => tb_cf_cs0_n,
203
         cf_cs1_n     => tb_cf_cs1_n,
204
    cf_rd_n      => tb_cf_rd_n,
205
    cf_wr_n      => tb_cf_wr_n,
206
         cf_cs16_n    => tb_cf_cs16_n,
207
    cf_a         => tb_cf_a,
208
    cf_d         => tb_cf_d,
209
--    cf_intrq     => tb_cf_intrq,
210
--    cf_iordy     => tb_cf_iordy,
211
--      cf_dase      => tb_cf_dase,
212
--         cf_pdiag     => tb_cf_pdiag,
213
--         cf_present   => tb_cf_present,
214
 
215
-- I/O Ports
216
    Porta        => tb_Porta,
217
    Portb        => tb_Portb,
218
--    PortC        => tb_Portc,
219
--    PortD        => tb_portd,
220
 
221
-- CPU bus
222
         bus_clk      => tb_bus_clk,
223
         bus_reset    => tb_bus_reset,
224
         bus_rw       => tb_bus_rw,
225
         bus_cs       => tb_bus_cs,
226
    bus_addr     => tb_bus_addr,
227
         bus_data     => tb_bus_data,
228
 
229
-- Timer I/O
230
         timer_out    => tb_timer_out
231
         );
232
 
233
ramlo : my_ram port map (
234
         clk       => tb_bus_clk,
235
    rst       => tb_reset,
236
    cs        => tb_ram_cs,
237
    rw        => tb_ram_wrln,
238
    addr      => tb_ram_addr(5 downto 0),
239
         data_in   => tb_ramlo_din,
240
         data_out  => tb_ramlo_dout
241
         );
242
 
243
ramhi : my_ram port map (
244
         clk       => tb_bus_clk,
245
    rst       => tb_reset,
246
    cs        => tb_ram_cs,
247
    rw        => tb_ram_wrun,
248
    addr      => tb_ram_addr(5 downto 0),
249
         data_in   => tb_ramhi_din,
250
         data_out  => tb_ramhi_dout
251
         );
252
 
253
   tb_ram : PROCESS( tb_reset_n, tb_ram_csn, tb_ram_wrln, tb_ram_wrun,
254
                      tb_ramlo_din, tb_ramlo_dout, tb_ramhi_din, tb_ramhi_dout,
255
                                          tb_ram_data )
256
         begin
257
      tb_reset      <= not tb_reset_n;
258
      tb_ram_cs     <= not tb_ram_csn;
259
 
260
           if( tb_ram_wrln = '1' ) then
261
        tb_ram_data( 7 downto 0) <= tb_ramlo_dout;
262
      else
263
        tb_ram_data( 7 downto 0) <= "ZZZZZZZZ";
264
        tb_ramlo_din  <= tb_ram_data(7 downto 0);
265
      end if;
266
 
267
           if( tb_ram_wrun = '1' ) then
268
        tb_ram_data( 15 downto 8) <= tb_ramhi_dout;
269
      else
270
        tb_ram_data( 15 downto 8) <= "ZZZZZZZZ";
271
        tb_ramhi_din  <= tb_ram_data( 15 downto 8);
272
      end if;
273
         end process;
274
 
275
  -- *** Test Bench - User Defined Section ***
276
   tb : PROCESS
277
        variable count : integer;
278
   BEGIN
279
 
280
                tb_rxbit      <= '1';
281
                tb_cts_n      <= '0';
282
           tb_reset_n    <= '0';
283
           tb_SysClk     <= '0';
284
 
285
                for count in 0 to 512 loop
286
                        tb_SysClk <= '0';
287
                        if count = 0 then
288
                                tb_reset_n <= '0';
289
                        elsif count = 1 then
290
                                tb_reset_n <= '1';
291
                        end if;
292
                        wait for 50 ns;
293
                        tb_SysClk <= '1';
294
                        wait for 50 ns;
295
                end loop;
296
 
297
      wait; -- will wait forever
298
   END PROCESS;
299
-- *** End Test Bench - User Defined Section ***
300
 
301
 
302
end behavior; --===================== End of architecture =======================--
303
 

powered by: WebSVN 2.1.0

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