-
Notifications
You must be signed in to change notification settings - Fork 2
/
cpu_test.vhdl
102 lines (82 loc) · 3.34 KB
/
cpu_test.vhdl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
library ieee;
USE ieee.std_logic_1164.ALL;
use ieee.numeric_std.all;
use work.all;
use work.debugtools.all;
use work.types.all;
use work.instruction_types.all;
use work.instruction_equations.all;
use work.extra_instruction_equations.all;
entity cpu_test is
end cpu_test;
architecture behavior of cpu_test is
signal pixelclock : std_logic := '0';
signal cpuclock : std_logic := '0';
signal ioclock : std_logic := '0';
signal reset : std_logic := '0';
signal irq : std_logic := '1';
signal nmi : std_logic := '1';
signal monitor_pc : unsigned(15 downto 0);
signal fetch_port_read : fetch_port_out;
signal fetch_port_write : fetch_port_in;
signal fastio_rdata : unsigned(7 downto 0) := x"00";
signal fastio_wdata : unsigned(7 downto 0) := x"00";
signal fastio_address : unsigned(19 downto 0);
signal fastio_write : std_logic;
signal fastio_read : std_logic;
signal monitor_core_id : unsigned(1 downto 0) := "00";
begin
-- instantiate components here
core0: entity work.gs4502b
port map (
cpuclock => cpuclock,
ioclock => ioclock,
reset => reset,
-- Fetch memory interface for VIC-IV
fetch_port_read => fetch_port_read,
fetch_port_write => fetch_port_write,
-- Fast IO interface for CPU
fastio_address => fastio_address,
fastio_rdata => fastio_rdata,
fastio_wdata => fastio_wdata,
fastio_read => fastio_read,
fastio_write => fastio_write,
monitor_core_id => monitor_core_id,
monitor_pc => monitor_pc,
rom_at_8000 => '0',
rom_at_a000 => '0',
rom_at_c000 => '0',
rom_at_e000 => '0',
viciii_iomode => "11"
);
process
begin -- process tb
report "beginning simulation" severity note;
-- Assert reset for 16 cycles to give CPU pipeline ample time to flush out
-- and actually reset.
reset <= '1';
for i in 1 to 4 loop
pixelclock <= '1'; cpuclock <= '1'; ioclock <= '1'; wait for 2.5 ns;
pixelclock <= '0'; cpuclock <= '0'; ioclock <= '1'; wait for 2.5 ns;
pixelclock <= '1'; cpuclock <= '1'; ioclock <= '1'; wait for 2.5 ns;
pixelclock <= '0'; cpuclock <= '0'; ioclock <= '1'; wait for 2.5 ns;
pixelclock <= '1'; cpuclock <= '1'; ioclock <= '0'; wait for 2.5 ns;
pixelclock <= '0'; cpuclock <= '0'; ioclock <= '0'; wait for 2.5 ns;
pixelclock <= '1'; cpuclock <= '1'; ioclock <= '0'; wait for 2.5 ns;
pixelclock <= '0'; cpuclock <= '0'; ioclock <= '0'; wait for 2.5 ns;
end loop; -- i
-- Run CPU for 8 million cycles.
reset <= '0';
for i in 1 to 2000000 loop
pixelclock <= '1'; cpuclock <= '1'; ioclock <= '1'; wait for 2.5 ns;
pixelclock <= '0'; cpuclock <= '0'; ioclock <= '1'; wait for 2.5 ns;
pixelclock <= '1'; cpuclock <= '1'; ioclock <= '1'; wait for 2.5 ns;
pixelclock <= '0'; cpuclock <= '0'; ioclock <= '1'; wait for 2.5 ns;
pixelclock <= '1'; cpuclock <= '1'; ioclock <= '0'; wait for 2.5 ns;
pixelclock <= '0'; cpuclock <= '0'; ioclock <= '0'; wait for 2.5 ns;
pixelclock <= '1'; cpuclock <= '1'; ioclock <= '0'; wait for 2.5 ns;
pixelclock <= '0'; cpuclock <= '0'; ioclock <= '0'; wait for 2.5 ns;
end loop; -- i
assert false report "End of simulation" severity failure;
end process;
end behavior;