data/full_repos/permissive/123649059/Usart/UsartBaudGenerator.v
1: b'%Error: data/full_repos/permissive/123649059/Usart/UsartBaudGenerator.v:1: Cannot find include file: UsartCfg.v\n`include "UsartCfg.v" \n         ^~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/123649059/Usart,data/full_repos/permissive/123649059/UsartCfg.v\n             data/full_repos/permissive/123649059/Usart,data/full_repos/permissive/123649059/UsartCfg.v.v\n             data/full_repos/permissive/123649059/Usart,data/full_repos/permissive/123649059/UsartCfg.v.sv\n             UsartCfg.v\n             UsartCfg.v.v\n             UsartCfg.v.sv\n             obj_dir/UsartCfg.v\n             obj_dir/UsartCfg.v.v\n             obj_dir/UsartCfg.v.sv\n%Error: data/full_repos/permissive/123649059/Usart/UsartBaudGenerator.v:10: Define or directive not defined: \'`BAUD_FULL_50M_57600\'\nparameter  BAUD_RATE = `BAUD_FULL_50M_57600;\n                       ^~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/123649059/Usart/UsartBaudGenerator.v:10: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\nparameter  BAUD_RATE = `BAUD_FULL_50M_57600;\n                                           ^\n%Error: data/full_repos/permissive/123649059/Usart/UsartBaudGenerator.v:12: Define or directive not defined: \'`BAUD_RATE_WIDTH\'\nlocalparam BAUD_HALF = BAUD_RATE[`BAUD_RATE_WIDTH-1:1];\n                                 ^~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/123649059/Usart/UsartBaudGenerator.v:21: Define or directive not defined: \'`BAUD_RATE_WIDTH\'\nreg[`BAUD_RATE_WIDTH-1:0] cnt;\n    ^~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/123649059/Usart/UsartBaudGenerator.v:25: Define or directive not defined: \'`BAUD_RATE_WIDTH\'\n  cnt <= `BAUD_RATE_WIDTH\'D0;\n         ^~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/123649059/Usart/UsartBaudGenerator.v:27: Define or directive not defined: \'`BAUD_RATE_WIDTH\'\n  cnt <= `BAUD_RATE_WIDTH\'D0;\n         ^~~~~~~~~~~~~~~~\n%Error: Exiting due to 7 error(s)\n'
module UsartBaudGenerator(
	clk, 
	rst_n, 
	start,
	signal
);

parameter  BAUD_RATE = `BAUD_FULL_50M_57600;

localparam BAUD_HALF = BAUD_RATE[`BAUD_RATE_WIDTH-1:1];
localparam BAUD_FULL = BAUD_RATE - 1'B1;

input  clk;
input  rst_n;
input  start;
output signal;

reg                       signal;
reg[`BAUD_RATE_WIDTH-1:0] cnt;

always @(posedge clk or negedge rst_n) begin
	if(!rst_n)
		cnt <= `BAUD_RATE_WIDTH'D0;
	else if((!start) || (cnt == BAUD_FULL))
		cnt <= `BAUD_RATE_WIDTH'D0;
	else
		cnt <= cnt + 1'B1;
end

always @(posedge clk or negedge rst_n) begin
	if(!rst_n)
		signal <= 1'B0;
	else if(cnt == BAUD_HALF)
		signal <= 1'B1;
	else
		signal <= 1'B0;
end

endmodule
module UsartBaudGenerator(
	clk, 
	rst_n, 
	start,
	signal
);


parameter  BAUD_RATE = `BAUD_FULL_50M_57600;

localparam BAUD_HALF = BAUD_RATE[`BAUD_RATE_WIDTH-1:1];
localparam BAUD_FULL = BAUD_RATE - 1'B1;

input  clk;
input  rst_n;
input  start;
output signal;

reg                       signal;
reg[`BAUD_RATE_WIDTH-1:0] cnt;

always @(posedge clk or negedge rst_n) begin
	if(!rst_n)
		cnt <= `BAUD_RATE_WIDTH'D0;
	else if((!start) || (cnt == BAUD_FULL))
		cnt <= `BAUD_RATE_WIDTH'D0;
	else
		cnt <= cnt + 1'B1;
end

always @(posedge clk or negedge rst_n) begin
	if(!rst_n)
		signal <= 1'B0;
	else if(cnt == BAUD_HALF)
		signal <= 1'B1;
	else
		signal <= 1'B0;
end

endmodule