-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchip8.sv.bak
58 lines (47 loc) · 1012 Bytes
/
chip8.sv.bak
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
module chip8 (
input wire clk_in,
input wire rst_in,
output logic lcd_clk,
output logic lcd_data,
output logic [5:0] led
);
bit [7:0] vram[0:1023];
bit [7:0] memory[0:4095];
bit keyboard[15:0];
bit [7:0] sound_timer;
bit [15:0] program_counter;
int cycle_counter;
bit rom_ready;
bit font_ready;
bit system_ready;
bit halt;
bit [7:0] random_number;
and(system_ready, rom_ready, font_ready);
cpu cpu (
system_ready,
memory,
clk_in,
keyboard,
random_number,
cycle_counter,
program_counter,
vram,
sound_timer
);
st7920_serial_driver gpu (clk_in, 1'b1, vram, lcd_clk, lcd_data, led);
rng randy (
clk_in,
program_counter,
keyboard,
cycle_counter,
random_number
);
initial begin
if (~font_ready) begin
$readmemh("fontset.bin", memory, 0);
$readmemb("rom.bin", memory, 'h200);
font_ready = 1;
rom_ready = 1;
end
end
endmodule