sandbox/fpga/tinyfpga/btled/top.v

25 lines
502 B
Coq
Raw Normal View History

2018-12-29 17:55:32 +00:00
/// bled
/// Button-toggled LED
///
/// This toggles the LED using a pushbutton on pin 6. The pushbutton
/// has one side connected to Vcc, and the other side to both pin 6 and
/// a 10K Ω resistor (because, for some reason, that's what I have on
/// hand).
module top (
input PIN_6,
input CLK,
output LED
);
reg state = 0;
reg pressed = 0;
assign LED = state;
2018-12-29 18:11:22 +00:00
// I found the negedge was better for debouncing.
2018-12-29 17:55:32 +00:00
always @(negedge PIN_6)
state <= !state;
endmodule