-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgui_datapath.v
79 lines (63 loc) · 1.17 KB
/
gui_datapath.v
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
module gui_datapath (
input clk,
input reset,
input showTitle,
input showMap,
input showGameOver,
input flash,
output reg [7:0] x,
output reg [6:0] y,
output reg [2:0] colourOut
);
wire [2:0] red, black, title_ram_out, map_ram_out, gameover_ram_out;
reg [14:0] address;
assign red = 3'b100;
assign black = 3'b000;
// ram_title title (
//
//
//
//
//
// );
// ram_map map (
//
//
//
//
// );
// ram_gameover gameover (
//
//
//
//
//
// );
always @(posedge clk)
begin
if (!reset)
begin
address <= 15'b0;
end
else begin
if (showTitle || showGameOver || flash || showMap)
address <= address + 1'b1;
end
if (address == 15'd19119) // num_pixel
address <= 15'b0;
end
always @(*)
begin
colourOut = black;
if (flash)
colourOut = red;
else if (showMap)
colourOut = black; // change to map_ram_out
else if (showTitle)
colourOut = 3'b110; // change to title_ram_out
else if (showGameOver)
colourOut = 3'b011; // change to gameover_ram_out
x = address % 8'd160;
y = address / 8'd160;
end
endmodule