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

Subversion Repositories System09

[/] [System09/] [tags/] [V10/] [rtl/] [vhdl/] [testbench3.vhd] - Blame information for rev 201

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

Line No. Rev Author Line
1 2 dilbert57
--===========================================================================----
2
--
3
--  T E S T B E N C H    tesetbench3 - CPU09 Testbench.
4
--
5
--  www.OpenCores.Org - September 2003
6
--  This core adheres to the GNU public license  
7
--
8
-- File name      : Testbench3.vhd
9
--
10
-- Purpose        : cpu09 Microprocessor Test Bench 3
11
--                  Contains ROM to test interrupts
12
--
13
-- Dependencies   : ieee.Std_Logic_1164
14
--                  ieee.std_logic_unsigned
15
--                  ieee.std_logic_arith
16
--                  ieee.numeric_std
17
--
18
-- Uses           : cpu09    (cpu09.vhd)      CPU core
19
--                   
20
-- Author         : John E. Kent
21
--                  dilbert57@opencores.org      
22
--
23
--===========================================================================----
24
--
25
-- Revision History:
26
--===========================================================================--
27
--
28
-- Version 0.1 - 12st April 2003 - John Kent 
29
-- First version
30
--
31
-- Version 1.0 - 6 Sep 2003 - John Kent
32
-- Initial release to Open Cores
33
--
34
--===========================================================================--
35
 
36
library ieee;
37
   use ieee.std_logic_1164.all;
38
   use IEEE.STD_LOGIC_ARITH.ALL;
39
   use IEEE.STD_LOGIC_UNSIGNED.ALL;
40
   use ieee.numeric_std.all;
41
 
42
entity my_testbench is
43
end my_testbench;
44
 
45
-------------------------------------------------------------------------------
46
-- Architecture for memio Controller Unit
47
-------------------------------------------------------------------------------
48
architecture behavior of my_testbench is
49
  -----------------------------------------------------------------------------
50
  -- Signals
51
  -----------------------------------------------------------------------------
52
  signal cpu_irq    : std_Logic;
53
  signal cpu_firq   : std_logic;
54
  signal cpu_nmi    : std_logic;
55
 
56
  -- CPU Interface signals
57
  signal SysClk      : Std_Logic;
58
  signal cpu_reset   : Std_Logic;
59
  signal cpu_rw      : Std_Logic;
60
  signal cpu_vma     : Std_Logic;
61
  signal cpu_addr    : Std_Logic_Vector(15 downto 0);
62
  signal cpu_data_in : Std_Logic_Vector(7 downto 0);
63
  signal cpu_data_out: Std_Logic_Vector(7 downto 0);
64
  signal cpu_alu     : Std_Logic_Vector(15 downto 0);
65
  signal cpu_cc      : Std_Logic_Vector(7 downto 0);
66
 
67
  constant width   : integer := 8;
68
  constant memsize : integer := 64;
69
 
70
  type rom_array is array(0 to memsize-1) of std_logic_vector(width-1 downto 0);
71
 
72
  constant rom_data : rom_array :=
73
  (
74
         "00010000", "11001110", "11111000", "00110000", -- F800 - 10CE F830 RET1    LDS #STACK
75
         "00111111",                                     -- F804 -   3F              SWI
76
         "00010000", "00111111",                         -- F805 - 103F      SWIVEC  SWI2
77
         "00010001", "00111111",                         -- F807 - 113F      SWI2VEC SWI3
78
         "00111011",                                     -- F809 -   3B      SWI3VEC RTI
79
         "00100000", "11111110",                         -- F80A -   20 FE           BRA *
80
         "10110001",                                     -- F80C -   B1      STACK3 FCB $B1 ; CC
81
         "00110010",                                     -- F80D -   32             FCB $32 ; ACCA
82
         "00110011",                                     -- F8OE -   33             FCB $33 ; ACCB
83
         "00110100",                                     -- F8OF -   34             FCB $34 ; DPR
84
         "00110101", "00110110",                         -- F810 - 3536             FDB $3536 ; IX
85
    "00110111", "00111000",                         -- F812 - 3738             FDB $3738 ; IY
86
    "00111001", "00111010",                         -- F814 - 393A             FDB $393A ; UP
87
         "11111000", "00001001",                         -- F816 - F809             FDB SWI3VEC ; PC
88
         "10100001",                                     -- F818 -   A1      STACK2 FCB $A1 ; CC
89
         "00100010",                                     -- F819 -   22             FCB $22 ; ACCA
90
         "00100011",                                     -- F81A -   23             FCB $23 ; ACCB
91
         "00100100",                                     -- F81B -   24             FCB $24 ; DPR
92
         "00100101", "00100110",                         -- F81C - 2526             FDB $2526 ; IX
93
    "00100111", "00101000",                         -- F81E - 2728             FDB $2728 ; IY
94
    "00101001", "00101010",                         -- F820 - 292A             FDB $292A ; UP
95
         "11111000", "00001001",                         -- F822 - F809             FDB SWI3VEC ; PC
96
         "10010001",                                     -- F824 -   91      STACK1 FCB $91 ; CC
97
         "00010010",                                     -- F825 -   12             FCB $12 ; ACCA
98
         "00010011",                                     -- F826 -   13             FCB $13 ; ACCB
99
         "00010100",                                     -- F827 -   14             FCB $14 ; DPR
100
         "00010101", "00010110",                         -- F828 - 1516             FDB $1516 ; IX
101
    "00010111", "00011000",                         -- F82A - 1718             FDB $1718 ; IY
102
    "00011001", "00011010",                         -- F82C - 191A             FDB $191A ; UP
103
         "11111000", "00000000",                         -- F82E - F800             FDB RESET ; PC
104
         "11111000", "00000000",                         -- F830 - F800      STACK  FDB RESET ; RESV
105
    "11111000", "00001001",                         -- F832 - F809             FDB SWIVEC3 ; SWI3
106
         "11111000", "00000111",                         -- F834 - F807             FDB SWIVEC2 ; SWI2
107
         "11111000", "00000000",                         -- F836 - F800             fdb RESET ; FIRQ
108
         "11111000", "00000000",                         -- F838 - F800             fdb RESET ; IRQ
109
         "11111000", "00000101",                         -- F83A - F805             fdb SWIVEC ; SWI
110
         "11111000", "00000000",                         -- F83C - F800             fcb RESET ; NMI
111
         "11111000", "00000000"                          -- F83E - F800             fdb RESET ; Reset
112
         );
113
 
114
component cpu09
115
  port (
116
         clk:        in std_logic;
117
    rst:             in std_logic;
118
    rw:      out        std_logic;              -- Asynchronous memory interface
119
    vma:             out        std_logic;
120
    address:  out       std_logic_vector(15 downto 0);
121
    data_in:  in        std_logic_vector(7 downto 0);
122
         data_out: out std_logic_vector(7 downto 0);
123
         halt:     in  std_logic;
124
         hold:     in  std_logic;
125
         irq:      in  std_logic;
126
         nmi:      in  std_logic;
127
         firq:     in  std_logic;
128
         test_alu: out std_logic_vector(15 downto 0);
129
         test_cc:  out std_logic_vector(7 downto 0)
130
  );
131
end component cpu09;
132
 
133
 
134
begin
135
cpu : cpu09  port map (
136
         clk         => SysClk,
137
    rst      => cpu_reset,
138
    rw       => cpu_rw,
139
    vma       => cpu_vma,
140
    address   => cpu_addr(15 downto 0),
141
    data_in   => cpu_data_in,
142
         data_out  => cpu_data_out,
143
         halt      => '0',
144
         hold      => '0',
145
         irq       => cpu_irq,
146
         nmi       => cpu_nmi,
147
         firq      => cpu_firq,
148
         test_alu  => cpu_alu,
149
         test_cc   => cpu_cc
150
  );
151
 
152
  -- *** Test Bench - User Defined Section ***
153
   tb : PROCESS
154
        variable count : integer;
155
   BEGIN
156
 
157
        cpu_reset <= '0';
158
        SysClk <= '0';
159
   cpu_irq <= '0';
160
   cpu_nmi <= '0';
161
        cpu_firq <= '0';
162
 
163
                for count in 0 to 512 loop
164
                        SysClk <= '0';
165
                        if count = 0 then
166
                                cpu_reset <= '1';
167
                        elsif count = 1 then
168
                                cpu_reset <= '0';
169
                        end if;
170
                        wait for 100 ns;
171
                        SysClk <= '1';
172
                        wait for 100 ns;
173
                end loop;
174
 
175
      wait; -- will wait forever
176
   END PROCESS;
177
-- *** End Test Bench - User Defined Section ***
178
 
179
 
180
  rom : PROCESS( cpu_addr )
181
  begin
182
    cpu_data_in <= rom_data(conv_integer(cpu_addr(5 downto 0)));
183
  end process;
184
 
185
end behavior; --===================== End of architecture =======================--
186
 

powered by: WebSVN 2.1.0

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