data/full_repos/permissive/157819432/debounce.v
data/verilator_xmls/1dea504a-b402-4b0f-a107-d8d6dec5d1cd.xml
module debounce(clk, button, pressed);
input   clk, button;
output  pressed;

reg         pressed;
reg [31:0]  last;

parameter   DELAY=10000000;

always @ (posedge clk)
begin
  if (button)
  last = 32'd0;
  else 
  last = (last == DELAY) ? 32'd0 : last + 32'd1;
end

always @ (posedge clk)
begin
    if (button | last != DELAY)
    pressed = 1'b0;
    else 
    pressed = 1'b1;
end
endmodule
module debounce(clk, button, pressed);

input   clk, button;
output  pressed;

reg         pressed;
reg [31:0]  last;

parameter   DELAY=10000000;

always @ (posedge clk)
begin
  if (button)
  last = 32'd0;
  else 
  last = (last == DELAY) ? 32'd0 : last + 32'd1;
end

always @ (posedge clk)
begin
    if (button | last != DELAY)
    pressed = 1'b0;
    else 
    pressed = 1'b1;
end
endmodule