-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDE1_SoC.sv
59 lines (44 loc) · 2.33 KB
/
DE1_SoC.sv
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
// Top-level module that defines the I/Os for the DE-1 SoC board
module DE1_SoC (HEX0, HEX1, HEX2, HEX3, HEX4, HEX5, KEY, SW, LEDR, GPIO_1, CLOCK_50);
output logic [6:0] HEX0, HEX1, HEX2, HEX3, HEX4, HEX5;
output logic [9:0] LEDR;
input logic [3:0] KEY;
input logic [9:0] SW;
output logic [35:0] GPIO_1;
input logic CLOCK_50;
// Turn off HEX displays
assign HEX1 = '1;
assign HEX2 = '1;
assign HEX3 = '1;
assign HEX4 = '1;
assign HEX5 = '1;
/* Set up system base clock to 1526 Hz (50 MHz / 2**(14+1))
===========================================================*/
logic [31:0] clk;
logic SYSTEM_CLOCK;
clock_divider divider (.clock(CLOCK_50), .divided_clocks(clk));
assign SYSTEM_CLOCK = clk[14]; // 1526 Hz clock signal
/* If you notice flickering, set SYSTEM_CLOCK faster.
However, this may reduce the brightness of the LED board. */
/* Set up LED board driver
================================================================== */
logic [15:0][15:0]RedPixels; // 16 x 16 array representing red LEDs
logic [15:0][15:0]GrnPixels; // 16 x 16 array representing green LEDs
logic RST, next, select, player, player_selector;
// logic [1:0] one,two,three,four,five,size,seven,eight,nine;
logic [3:0] number;
assign RST = SW[9];
/* Standard LED Driver instantiation - set once and 'forget it'.
See LEDDriver.sv for more info. Do not modify unless you know what you are doing! */
LEDDriver Driver (.CLK(SYSTEM_CLOCK), .RST, .EnableCount(1'b1), .RedPixels, .GrnPixels, .GPIO_1);
/* LED board test submodule - paints the board with a static pattern.
Replace with your own code driving RedPixels and GrnPixels.
SW[9] : Reset
=================================================================== */
cleanInput c1 (.Clock(SYSTEM_CLOCK), .Reset(RST), .in(~KEY[0]), .out(select));
cleanInput c2 (.Clock(SYSTEM_CLOCK), .Reset(RST), .in(~KEY[1]), .out(next));
cleanInput c3 (.Clock(SYSTEM_CLOCK), .Reset(RST), .in(~KEY[2]), .out(player_selector));
player_toggle pt (.clock (SYSTEM_CLOCK), .reset(RST), .select(select), .player);
selector s (.clock(SYSTEM_CLOCK), .reset(RST), .next, .GrnPixels, .number);
led_controller lc(.clock(SYSTEM_CLOCK),.number,.player, .select, .RedPixels, .reset(RST), .leds(HEX0));
endmodule