data/full_repos/permissive/127241521/updown-blinker/director.v
data/verilator_xmls/5b0619f2-9929-4dee-a7f8-21ba0c2dffe7.xml
module director(
    input clk,
	 input rst,
	 input sclk, 
    input btn,
	 
    output dir 
);

reg bstate;
reg current;

always @(posedge clk)
begin
    if(rst)
	 begin
	     bstate <= 0;
	     current <= 1;
    end		  
	 else if(btn && !bstate)
	 begin
	     bstate <= 1;
	     current <= ~current;
    end
	 else if(!btn && bstate)
	 begin
	     bstate <= 0;
	 end
end  

assign dir = current;

endmodule
module director(
    input clk,
	 input rst,
	 input sclk, 
    input btn,
	 
    output dir 
);


reg bstate;
reg current;

always @(posedge clk)
begin
    if(rst)
	 begin
	     bstate <= 0;
	     current <= 1;
    end		  
	 else if(btn && !bstate)
	 begin
	     bstate <= 1;
	     current <= ~current;
    end
	 else if(!btn && bstate)
	 begin
	     bstate <= 0;
	 end
end  

assign dir = current;

endmodule