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

Subversion Repositories System68

[/] [System68/] [tags/] [arelease/] [vhdl/] [testbench2.vhd] - Blame information for rev 5

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

Line No. Rev Author Line
1 4 dilbert57
--===========================================================================--
2
--
3
-- CPU68 Microprocessor Test Bench 2
4
--
5
--
6
-- John Kent 21st October 2002
7
--
8
--
9
-------------------------------------------------------------------------------
10
library ieee;
11
   use ieee.std_logic_1164.all;
12
   use IEEE.STD_LOGIC_ARITH.ALL;
13
   use IEEE.STD_LOGIC_UNSIGNED.ALL;
14
   use ieee.numeric_std.all;
15
 
16
entity my_testbench is
17
end my_testbench;
18
 
19
-------------------------------------------------------------------------------
20
-- Architecture for memio Controller Unit
21
-------------------------------------------------------------------------------
22
architecture behavior of my_testbench is
23
  -----------------------------------------------------------------------------
24
  -- Signals
25
  -----------------------------------------------------------------------------
26
  signal uart_irq    : Std_Logic;
27
  signal timer_irq   : std_logic;
28
 
29
  -- Sequencer Interface signals
30
  signal SysClk      : Std_Logic;
31
  signal cpu_reset   : Std_Logic;
32
  signal cpu_rw      : std_logic;
33
  signal cpu_vma     : std_logic;
34
  signal cpu_addr    : Std_Logic_Vector(15 downto 0);
35
  signal cpu_data_in : Std_Logic_Vector(7 downto 0);
36
  signal cpu_data_out: Std_Logic_Vector(7 downto 0);
37
 
38
  constant width   : integer := 8;
39
  constant memsize : integer := 64;
40
 
41
  type rom_array is array(0 to memsize-1) of std_logic_vector(width-1 downto 0);
42
 
43
  constant rom_data : rom_array :=
44
  (
45
    "10001110", "11111111", "11011101", -- FFC0 - 8E FFDD  RESET LDS #$FFDD
46
         "11001110", "00010010", "00110100", -- FFC3 - CE 1234        LDX #$1234
47
         "10001101", "00000100",             -- FFC6 - 8D 04          BSR SAVGET
48
    "00100111", "11110110",             -- FFC8 - 27 F6    REENT BEQ RESET
49
         "00100000", "11111110",             -- FFCA - 20 FF          BRA *
50
         "11111111", "11111111", "11110000", -- FFCC - FF FFF0 SAVGET STX $FFF0
51
         "11111110", "11111111", "11011001", -- FFCF - FE FFD9        LDX $FFD9
52
         "00110111",                         -- FFD2 - 37             PSHB
53
         "11100110", "00000001",             -- FFD3 - E6 01          LDAB 1,X
54
         "11100001", "00000011",             -- FFD5 - E1 03          CMPB 3,X
55
         "00110011",                         -- FFD7 - 33             PULB
56
         "00111001",                         -- FFD8 - 39             RTS
57
         "11111111", "11100000",             -- FFD9 - FF E0          FDB $FFE0
58
         "01010101",                         -- FFDB - 55             FCB $55
59
         "11111111", "11001000",             -- FFDC - FFC8           FDB REENT
60
         "00100000", "11100000",             -- FFDE - 20 E0          BRA RESET
61
         "00000000", "00000000",             -- FFE0 - 00 00          fcb $00,$00
62
         "00000000", "00000000",             -- FFE2 - 00 00          fcb $00,$00
63
         "00000000", "00000000",             -- FFE4 - 00 00          fcb $00,$00
64
         "00000000", "00000000",             -- FFE6 - 00 00          fcb $00,$00
65
    "01001000", "01100101", "01101100", -- FFE8 - 48 65 6c MSG   FCC "Hel"
66
         "01101100", "01101111", "00100000", -- FFEB - 6c 6f 20       FCC "lo "
67
         "01010111", "01101111", "01110010", -- FFEE - 57 6f 72       FCC "Wor"
68
    "01101100", "01100100",             -- FFF1 - 6c 64          FCC "ld"
69
    "00001010", "00001101", "00000000", -- FFF3 - 0a 0d 00       FCB LF,CR,NULL
70
    "00000000", "00000000",             -- FFF6 - 00 00          fcb null,null           
71
         "11111111", "11000000",             -- FFF8 - FF C0          fdb $FFC0 ; Timer irq
72
         "11111111", "11000000",             -- FFFA - FF C0          fdb $FFC0 ; Ext IRQ
73
         "11111111", "11000000",             -- FFFC - FF C0          fcb $FFC0 ; SWI
74
         "11111111", "11000000"              -- FFFE - FF C0          fdb $FFC0 ; Reset
75
         );
76
 
77
component cpu68
78
  port (
79
    data_in:  in        std_logic_vector(7 downto 0);
80
         data_out: out std_logic_vector(7 downto 0);
81
    address:  out       std_logic_vector(15 downto 0);
82
    vma:             out        std_logic;
83
    rw:      out        std_logic;              -- Asynchronous memory interface
84
    rst:             in std_logic;
85
         clk:        in std_logic;
86
         irq:      in  std_logic;
87
         nmi:      in  std_logic
88
  );
89
end component cpu68;
90
 
91
 
92
begin
93
cpu : cpu68  port map (
94
    data_in   => cpu_data_in,
95
         data_out  => cpu_data_out,
96
    address   => cpu_addr(15 downto 0),
97
    vma       => cpu_vma,
98
    rw       => cpu_rw,
99
    rst      => cpu_reset,
100
         clk         => SysClk,
101
         irq       => uart_irq,
102
         nmi       => timer_irq
103
  );
104
 
105
  -- *** Test Bench - User Defined Section ***
106
   tb : PROCESS
107
        variable count : integer;
108
   BEGIN
109
 
110
        cpu_reset <= '0';
111
        SysClk <= '0';
112
   uart_irq <= '0';
113
        timer_irq <= '0';
114
 
115
                for count in 0 to 256 loop
116
                        SysClk <= '0';
117
                        if count = 0 then
118
                                cpu_reset <= '1';
119
                        elsif count = 1 then
120
                                cpu_reset <= '0';
121
                        end if;
122
                        wait for 100 ns;
123
                        SysClk <= '1';
124
                        wait for 100 ns;
125
                end loop;
126
 
127
      wait; -- will wait forever
128
   END PROCESS;
129
-- *** End Test Bench - User Defined Section ***
130
 
131
 
132
  rom : PROCESS( cpu_addr )
133
  begin
134
    cpu_data_in <= rom_data(conv_integer(cpu_addr(5 downto 0)));
135
  end process;
136
 
137
end behavior; --===================== End of architecture =======================--
138
 

powered by: WebSVN 2.1.0

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