I moved around where packages are. I couldn't find any evidence of where other people put them, but for now they are in the `lib/` folder. Other infrastructure changes are that all the weird includes we need to make the linter happy are gated behind ifdefs, so they don't mess with vivado. I kinda can't believe concurrent assertions work because there's so little info about them, good to ssee they actually do something
23 lines
457 B
Systemverilog
23 lines
457 B
Systemverilog
//NOTE: you should drive this with a slow clock to actually debounce input
|
|
module debouncer(input logic clk, input reset, input source, output logic out);
|
|
|
|
logic pressed;
|
|
|
|
always_ff @(posedge clk) begin
|
|
if (reset)
|
|
pressed <= 0;
|
|
if (!source) begin
|
|
pressed <= 0;
|
|
out <= 0;
|
|
end
|
|
else
|
|
if (pressed)
|
|
out <= 0;
|
|
else begin
|
|
pressed <= 1;
|
|
out <= 1;
|
|
end
|
|
end
|
|
|
|
endmodule
|