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

Subversion Repositories System09

[/] [System09/] [rev_86/] [rtl/] [Testbench/] [testbench4.vhd] - Blame information for rev 121

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

Line No. Rev Author Line
1 19 dilbert57
--===========================================================================--
2
--
3
-- MC6809 Microprocessor Test Bench 4
4
-- Test Software - SBUG ROM
5
--
6
--
7
-- John Kent 12st April 2003
8
--
9
-- Version 1.1 - 25th Jan 2004 - John Kent
10
-- removed "test_alu" and "test_cc"
11
--
12
--
13
-------------------------------------------------------------------------------
14
library ieee;
15
   use ieee.std_logic_1164.all;
16
   use IEEE.STD_LOGIC_ARITH.ALL;
17
   use ieee.numeric_std.all;
18
 
19
entity my_testbench is
20
end my_testbench;
21
 
22
-------------------------------------------------------------------------------
23
-- Architecture for memio Controller Unit
24
-------------------------------------------------------------------------------
25
architecture behavior of my_testbench is
26
  -----------------------------------------------------------------------------
27
  -- Signals
28
  -----------------------------------------------------------------------------
29
  signal cpu_irq    : std_Logic;
30
  signal cpu_firq   : std_logic;
31
  signal cpu_nmi    : std_logic;
32
 
33
  -- CPU Interface signals
34
  signal SysClk      : Std_Logic;
35
  signal cpu_reset   : Std_Logic;
36
  signal cpu_rw      : Std_Logic;
37
  signal cpu_vma     : Std_Logic;
38
  signal cpu_addr    : Std_Logic_Vector(15 downto 0);
39
  signal cpu_data_in : Std_Logic_Vector(7 downto 0);
40
  signal cpu_data_out: Std_Logic_Vector(7 downto 0);
41
  signal cpu_halt    : Std_logic;
42
  signal cpu_hold    : Std_logic;
43
  signal rom_data_out: Std_Logic_Vector(7 downto 0);
44
  signal ram_data_out: Std_Logic_Vector(7 downto 0);
45
  signal ram_cs      : Std_Logic;
46
 
47
component cpu09
48
  port (
49
         clk:        in std_logic;
50
    rst:             in std_logic;
51
    rw:      out        std_logic;              -- Asynchronous memory interface
52
    vma:             out        std_logic;
53
    address:  out       std_logic_vector(15 downto 0);
54
    data_in:  in        std_logic_vector(7 downto 0);
55
         data_out: out std_logic_vector(7 downto 0);
56
         halt:     in  std_logic;
57
         hold:     in  std_logic;
58
         irq:      in  std_logic;
59
         nmi:      in  std_logic;
60
         firq:     in  std_logic
61
  );
62
end component;
63
 
64
 
65
component sbug_rom
66
    Port (
67
       MEMclk   : in  std_logic;
68
       MEMaddr  : in  std_logic_vector (10 downto 0);
69
       MEMrdata : out std_logic_vector (7 downto 0)
70
    );
71
end component;
72
 
73
component block_ram
74
    Port (
75
       MEMclk   : in  std_logic;
76
       MEMcs    : in  std_logic;
77
                 MEMrw    : in  std_logic;
78
       MEMaddr  : in  std_logic_vector (10 downto 0);
79
       MEMrdata : out std_logic_vector (7 downto 0);
80
       MEMwdata : in  std_logic_vector (7 downto 0)
81
    );
82
end component;
83
 
84
begin
85
my_cpu : cpu09  port map (
86
         clk         => SysClk,
87
    rst      => cpu_reset,
88
    rw       => cpu_rw,
89
    vma       => cpu_vma,
90
    address   => cpu_addr(15 downto 0),
91
    data_in   => cpu_data_in,
92
         data_out  => cpu_data_out,
93
         halt      => cpu_halt,
94
         hold      => cpu_hold,
95
         irq       => cpu_irq,
96
         nmi       => cpu_nmi,
97
         firq      => cpu_firq
98
  );
99
 
100
 
101
my_ram : block_ram port map (
102
       MEMclk   => SysClk,
103
                 MEMcs    => ram_cs,
104
                 MEMrw    => cpu_rw,
105
       MEMaddr  => cpu_addr(10 downto 0),
106
       MEMrdata => ram_data_out,
107
       MEMwdata => cpu_data_out
108
    );
109
 
110
my_rom : sbug_rom port map (
111
       MEMclk   => SysClk,
112
       MEMaddr  => cpu_addr(10 downto 0),
113
       MEMrdata => rom_data_out
114
    );
115
 
116
  -- *** Test Bench - User Defined Section ***
117
   tb : PROCESS
118
        variable count : integer;
119
   BEGIN
120
 
121
        cpu_reset <= '0';
122
        SysClk <= '0';
123
   cpu_irq <= '0';
124
   cpu_nmi <= '0';
125
        cpu_firq <= '0';
126
   cpu_halt <= '0';
127
        cpu_hold <= '0';
128
 
129
                for count in 0 to 512 loop
130
                        SysClk <= '0';
131
                        if count = 0 then
132
                                cpu_reset <= '1';
133
                        elsif count = 1 then
134
                                cpu_reset <= '0';
135
                        end if;
136
                        wait for 100 ns;
137
                        SysClk <= '1';
138
                        wait for 100 ns;
139
                end loop;
140
 
141
      wait; -- will wait forever
142
   END PROCESS;
143
-- *** End Test Bench - User Defined Section ***
144
 
145
 
146
  rom : PROCESS( cpu_addr, rom_data_out, ram_data_out )
147
  begin
148
    if( cpu_addr(15 downto 11) = "11111" ) then
149
      cpu_data_in <= rom_data_out;
150
                ram_cs <= '0';
151
         else
152
      cpu_data_in <= ram_data_out;
153
                ram_cs <= '1';
154
         end if;
155
  end process;
156
 
157
end behavior; --===================== End of architecture =======================--
158
 

powered by: WebSVN 2.1.0

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