data/full_repos/permissive/492704601/verilog/rtl/pinmux/src/timer.sv
1: b'%Warning-WIDTH: data/full_repos/permissive/492704601/verilog/rtl/pinmux/src/timer.sv:51: Operator EQ expects 16 bits on the RHS, but RHS\'s CONST \'1\'h0\' generates 1 bits.\n                                                                                       : ... In instance timer\n   assign timer_hit = (timer_counter == 1\'b0);\n                                     ^~\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Error: Exiting due to 1 warning(s)\n'
module timer
  (
     input logic	     reset_n,
     input logic	     mclk,
     input logic 	     pulse_1us,
     input logic 	     pulse_1ms,
     input logic 	     pulse_1s,

     input logic             cfg_timer_enb,     
     input logic             cfg_timer_update, 
     input logic [15:0]      cfg_timer_compare,
     input logic [1:0]       cfg_timer_clksel,

     output logic  	     timer_intr

   );




reg 		timer_hit_s1;
wire 		timer_hit;
reg [15:0]      timer_counter;
wire		timer_pulse;



assign timer_pulse = (cfg_timer_clksel == 2'b00) ? pulse_1us : 
	             (cfg_timer_clksel == 2'b01) ? pulse_1ms : pulse_1s;
  


always @(negedge reset_n or posedge mclk)
begin
   if (!reset_n)
	timer_counter <= 16'b0;
   else if (cfg_timer_update || (timer_pulse && timer_hit))
	timer_counter <=  cfg_timer_compare;
   else if (timer_pulse && cfg_timer_enb)
	timer_counter <=  timer_counter - 1;
end


   

   assign timer_hit = (timer_counter == 1'b0);

   assign timer_intr = !timer_hit_s1 && timer_hit && cfg_timer_enb;

   
   always @(negedge reset_n or posedge mclk)
     begin
	if (!reset_n) begin
	   timer_hit_s1 <= 1'b1;
        end else begin
	   timer_hit_s1 <= timer_hit;
	end
     end

   
endmodule
module timer
  (
     input logic	     reset_n,
     input logic	     mclk,
     input logic 	     pulse_1us,
     input logic 	     pulse_1ms,
     input logic 	     pulse_1s,

     input logic             cfg_timer_enb,     
     input logic             cfg_timer_update, 
     input logic [15:0]      cfg_timer_compare,
     input logic [1:0]       cfg_timer_clksel,

     output logic  	     timer_intr

   );





reg 		timer_hit_s1;
wire 		timer_hit;
reg [15:0]      timer_counter;
wire		timer_pulse;



assign timer_pulse = (cfg_timer_clksel == 2'b00) ? pulse_1us : 
	             (cfg_timer_clksel == 2'b01) ? pulse_1ms : pulse_1s;
  


always @(negedge reset_n or posedge mclk)
begin
   if (!reset_n)
	timer_counter <= 16'b0;
   else if (cfg_timer_update || (timer_pulse && timer_hit))
	timer_counter <=  cfg_timer_compare;
   else if (timer_pulse && cfg_timer_enb)
	timer_counter <=  timer_counter - 1;
end


   

   assign timer_hit = (timer_counter == 1'b0);

   assign timer_intr = !timer_hit_s1 && timer_hit && cfg_timer_enb;

   
   always @(negedge reset_n or posedge mclk)
     begin
	if (!reset_n) begin
	   timer_hit_s1 <= 1'b1;
        end else begin
	   timer_hit_s1 <= timer_hit;
	end
     end

   
endmodule