Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
`timescale 1ns / 1ps
module flash_suppressor(
input youre_not_the_boss_of_me_in,
input sw0_in,
output[3:0] lights,
output glitch_out
);
reg [31:0] glitch_status = 32'b0;
reg [31:0] ctr = 32'b0;
reg glitch_r = 1'b0;
assign lights[2:0] = 3'b111;
assign lights[3] = glitch_r;
assign glitch_out = glitch_r;
always @(posedge youre_not_the_boss_of_me_in)
begin
if (sw0_in == 1)
begin
glitch_r <= 1'b0;
ctr <= 0;
end
else
begin
ctr <= ctr + 1;
if (ctr == 3'b100)
begin
ctr <= 0;
glitch_status <= 2'b10;
end
if (glitch_status > 0) begin
glitch_r <= 1'b1;
glitch_status <= glitch_status - 1;
end else begin
glitch_r <= 1'b0;
end
end
end
endmodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.