sandbox/fpga/tinyfpga/hello_world/top.v

28 lines
840 B
Coq
Raw Normal View History

2018-12-28 23:44:47 +00:00
// look in pins.pcf for all the pin names on the TinyFPGA BX board
module top (
input CLK, // 16MHz clock
output LED, // User/boot LED next to power LED
output USBPU // USB pull-up resistor
);
// drive USB pull-up resistor to '0' to disable USB
assign USBPU = 0;
////////
// make a simple blink circuit
////////
// keep track of time and location in blink_pattern
reg [25:0] blink_counter;
2018-12-28 23:44:47 +00:00
// pattern that will be flashed over the LED over time
wire [31:0] blink_pattern = 32'b101010001110111011100010101;
2018-12-28 23:44:47 +00:00
// increment the blink_counter every clock
always @(posedge CLK) begin
blink_counter <= blink_counter + 1;
2018-12-28 23:44:47 +00:00
end
// light up the LED according to the pattern
assign LED = blink_pattern[blink_counter[25:21]];
2018-12-28 23:44:47 +00:00
endmodule