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

Subversion Repositories System11

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

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

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

powered by: WebSVN 2.1.0

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