remove init blocks from core componsnts
This commit is contained in:
parent
f395551009
commit
f949c2515b
3 changed files with 109 additions and 104 deletions
190
chip8.sv
190
chip8.sv
|
@ -1,5 +1,6 @@
|
|||
module chip8 (
|
||||
input wire clk_in
|
||||
input wire clk_in,
|
||||
input wire rst_in
|
||||
);
|
||||
|
||||
bit [31:0] vram[0:2047];
|
||||
|
@ -16,6 +17,7 @@ module chip8 (
|
|||
|
||||
beeper beeper (sound_timer);
|
||||
cpu cpu (
|
||||
rst_in,
|
||||
memory,
|
||||
clk_in,
|
||||
keyboard,
|
||||
|
@ -39,98 +41,100 @@ module chip8 (
|
|||
);
|
||||
rom_loader loader (memory);
|
||||
|
||||
initial begin
|
||||
bit [7:0] fontset[79:0] = {
|
||||
8'hF0,
|
||||
8'h90,
|
||||
8'h90,
|
||||
8'h90,
|
||||
8'hF0, // 0
|
||||
8'h20,
|
||||
8'h60,
|
||||
8'h20,
|
||||
8'h20,
|
||||
8'h70, // 1
|
||||
8'hF0,
|
||||
8'h10,
|
||||
8'hF0,
|
||||
8'h80,
|
||||
8'hF0, // 2
|
||||
8'hF0,
|
||||
8'h10,
|
||||
8'hF0,
|
||||
8'h10,
|
||||
8'hF0, // 3
|
||||
8'h90,
|
||||
8'h90,
|
||||
8'hF0,
|
||||
8'h10,
|
||||
8'h10, // 4
|
||||
8'hF0,
|
||||
8'h80,
|
||||
8'hF0,
|
||||
8'h10,
|
||||
8'hF0, // 5
|
||||
8'hF0,
|
||||
8'h80,
|
||||
8'hF0,
|
||||
8'h90,
|
||||
8'hF0, // 6
|
||||
8'hF0,
|
||||
8'h10,
|
||||
8'h20,
|
||||
8'h40,
|
||||
8'h40, // 7
|
||||
8'hF0,
|
||||
8'h90,
|
||||
8'hF0,
|
||||
8'h90,
|
||||
8'hF0, // 8
|
||||
8'hF0,
|
||||
8'h90,
|
||||
8'hF0,
|
||||
8'h10,
|
||||
8'hF0, // 9
|
||||
8'hF0,
|
||||
8'h90,
|
||||
8'hF0,
|
||||
8'h90,
|
||||
8'h90, // A
|
||||
8'hE0,
|
||||
8'h90,
|
||||
8'hE0,
|
||||
8'h90,
|
||||
8'hE0, // B
|
||||
8'hF0,
|
||||
8'h80,
|
||||
8'h80,
|
||||
8'h80,
|
||||
8'hF0, // C
|
||||
8'hE0,
|
||||
8'h90,
|
||||
8'h90,
|
||||
8'h90,
|
||||
8'hE0, // D
|
||||
8'hF0,
|
||||
8'h80,
|
||||
8'hF0,
|
||||
8'h80,
|
||||
8'hF0, // E
|
||||
8'hF0,
|
||||
8'h80,
|
||||
8'hF0,
|
||||
8'h80,
|
||||
8'h80 // F
|
||||
};
|
||||
|
||||
// Load fontset into memory
|
||||
for (int i = 0; i < 80; i++) begin
|
||||
memory[i] = fontset[79-i];
|
||||
end
|
||||
|
||||
// Initialize keyboard bits
|
||||
for (int i = 0; i < 15; i++) begin
|
||||
keyboard[i] = 0;
|
||||
always_ff @(posedge clk_in) begin
|
||||
if (rst_in) begin
|
||||
bit [7:0] fontset[79:0] = {
|
||||
8'hF0,
|
||||
8'h90,
|
||||
8'h90,
|
||||
8'h90,
|
||||
8'hF0, // 0
|
||||
8'h20,
|
||||
8'h60,
|
||||
8'h20,
|
||||
8'h20,
|
||||
8'h70, // 1
|
||||
8'hF0,
|
||||
8'h10,
|
||||
8'hF0,
|
||||
8'h80,
|
||||
8'hF0, // 2
|
||||
8'hF0,
|
||||
8'h10,
|
||||
8'hF0,
|
||||
8'h10,
|
||||
8'hF0, // 3
|
||||
8'h90,
|
||||
8'h90,
|
||||
8'hF0,
|
||||
8'h10,
|
||||
8'h10, // 4
|
||||
8'hF0,
|
||||
8'h80,
|
||||
8'hF0,
|
||||
8'h10,
|
||||
8'hF0, // 5
|
||||
8'hF0,
|
||||
8'h80,
|
||||
8'hF0,
|
||||
8'h90,
|
||||
8'hF0, // 6
|
||||
8'hF0,
|
||||
8'h10,
|
||||
8'h20,
|
||||
8'h40,
|
||||
8'h40, // 7
|
||||
8'hF0,
|
||||
8'h90,
|
||||
8'hF0,
|
||||
8'h90,
|
||||
8'hF0, // 8
|
||||
8'hF0,
|
||||
8'h90,
|
||||
8'hF0,
|
||||
8'h10,
|
||||
8'hF0, // 9
|
||||
8'hF0,
|
||||
8'h90,
|
||||
8'hF0,
|
||||
8'h90,
|
||||
8'h90, // A
|
||||
8'hE0,
|
||||
8'h90,
|
||||
8'hE0,
|
||||
8'h90,
|
||||
8'hE0, // B
|
||||
8'hF0,
|
||||
8'h80,
|
||||
8'h80,
|
||||
8'h80,
|
||||
8'hF0, // C
|
||||
8'hE0,
|
||||
8'h90,
|
||||
8'h90,
|
||||
8'h90,
|
||||
8'hE0, // D
|
||||
8'hF0,
|
||||
8'h80,
|
||||
8'hF0,
|
||||
8'h80,
|
||||
8'hF0, // E
|
||||
8'hF0,
|
||||
8'h80,
|
||||
8'hF0,
|
||||
8'h80,
|
||||
8'h80 // F
|
||||
};
|
||||
|
||||
// Load fontset into memory
|
||||
for (int i = 0; i < 80; i++) begin
|
||||
memory[i] = fontset[79-i];
|
||||
end
|
||||
|
||||
// Initialize keyboard bits
|
||||
for (int i = 0; i < 15; i++) begin
|
||||
keyboard[i] = 0;
|
||||
end
|
||||
end
|
||||
end
|
||||
endmodule
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue