data/full_repos/permissive/139213403/FPGA/blinker_counter.v
[Errno 2] No such file or directory: 'preprocess.output'
data/verilator_xmls/7d09b900-3b66-4aef-90a8-656eb9966583.xml
module blinker_counter
#(
	parameter C_ON=2,
	          C_OFF=3,
	          C_BITS=3
)
(
	input wire clk, reset,
	input wire blink,
	output wire b_en
);

localparam C_MAX = C_ON + C_OFF - 1;
reg [C_BITS-1:0] c_reg, c_next;

always @(posedge clk, posedge reset)
	begin
		if (reset)
			c_reg <= 0;
		else
			c_reg <= c_next;
	end

always @*
	begin
		c_next = c_reg + 1'b1;
		if (c_next == C_MAX)
			c_next = 0;
	end
	
assign b_en = ~blink || (c_reg < C_ON);

endmodule
module blinker_counter
#(
	parameter C_ON=2,
	          C_OFF=3,
	          C_BITS=3
)
(
	input wire clk, reset,
	input wire blink,
	output wire b_en
);


localparam C_MAX = C_ON + C_OFF - 1;
reg [C_BITS-1:0] c_reg, c_next;

always @(posedge clk, posedge reset)
	begin
		if (reset)
			c_reg <= 0;
		else
			c_reg <= c_next;
	end

always @*
	begin
		c_next = c_reg + 1'b1;
		if (c_next == C_MAX)
			c_next = 0;
	end
	
assign b_en = ~blink || (c_reg < C_ON);

endmodule