2021-05-13 14:05:33 -04:00
|
|
|
module top (
|
|
|
|
input wire clk,
|
2020-12-09 11:35:15 -05:00
|
|
|
output wire [3:0] led
|
|
|
|
);
|
|
|
|
|
2021-05-13 14:05:33 -04:00
|
|
|
wire [63:0] emio_gpio_o;
|
|
|
|
wire [63:0] emio_gpio_t;
|
|
|
|
wire [63:0] emio_gpio_i;
|
2020-12-09 11:35:15 -05:00
|
|
|
|
2021-05-13 14:05:33 -04:00
|
|
|
wire clk_bufg;
|
|
|
|
BUFG BUFG (
|
|
|
|
.I(clk),
|
|
|
|
.O(clk_bufg)
|
|
|
|
);
|
2020-12-09 11:35:15 -05:00
|
|
|
|
2021-05-13 14:05:33 -04:00
|
|
|
wire en_counter = ~emio_gpio_o[0];
|
|
|
|
wire count_direction = ~emio_gpio_o[1];
|
|
|
|
reg [31:0] counter = 0;
|
2020-12-09 11:35:15 -05:00
|
|
|
|
2021-05-13 14:05:33 -04:00
|
|
|
always @(posedge clk_bufg) begin
|
2020-12-09 11:35:15 -05:00
|
|
|
if (en_counter)
|
2021-05-13 14:05:33 -04:00
|
|
|
if (count_direction) counter <= counter + 1;
|
|
|
|
else counter <= counter - 1;
|
|
|
|
end
|
|
|
|
|
|
|
|
assign led = counter[27:24];
|
|
|
|
|
|
|
|
// The PS7
|
|
|
|
(* KEEP, DONT_TOUCH *)
|
|
|
|
PS7 PS7 (
|
|
|
|
.EMIOGPIOO (emio_gpio_o),
|
|
|
|
.EMIOGPIOTN(emio_gpio_t),
|
2022-03-24 04:11:48 -04:00
|
|
|
.EMIOGPIOI (emio_gpio_i)
|
2021-05-13 14:05:33 -04:00
|
|
|
);
|
2020-12-09 11:35:15 -05:00
|
|
|
|
|
|
|
|
|
|
|
endmodule
|