data/full_repos/permissive/159001439/src/character_detect.v
'utf-8' codec can't decode byte 0xd7 in position 112: invalid continuation byte
data/verilator_xmls/bb4e7f6a-4985-4a7c-9a44-4eb3936aea52.xml
module character_detect
(
	input clk_i,
	input rst_i,
	input strobe_i,
	output int_o
);
parameter cw=16,d=65535;
parameter [0:0] polarity=1'b1;

reg [cw-1:0] counter;
reg int_r;

assign int_o = int_r;

always @(posedge clk_i, posedge rst_i)
begin
	if(rst_i)
		int_r <= 1'b0;
	else if(counter == d)
		int_r <= 1'b0;
	else if(~int_r && strobe_i==polarity)
		int_r <= 1'b1;
end

always @(posedge clk_i, posedge rst_i)
begin
	if(rst_i)
		counter <= 'b0;
	else if(int_r)
		counter <= counter + 1;
	else
		counter <= 'b0;
end

endmodule
module character_detect
(
	input clk_i,
	input rst_i,
	input strobe_i,
	output int_o
);

parameter cw=16,d=65535;
parameter [0:0] polarity=1'b1;

reg [cw-1:0] counter;
reg int_r;

assign int_o = int_r;

always @(posedge clk_i, posedge rst_i)
begin
	if(rst_i)
		int_r <= 1'b0;
	else if(counter == d)
		int_r <= 1'b0;
	else if(~int_r && strobe_i==polarity)
		int_r <= 1'b1;
end

always @(posedge clk_i, posedge rst_i)
begin
	if(rst_i)
		counter <= 'b0;
	else if(int_r)
		counter <= counter + 1;
	else
		counter <= 'b0;
end

endmodule