data/full_repos/permissive/143278/ivltests/function7.v
data/verilator_xmls/fde68d7a-a922-42e3-a458-2519b24041ef.xml
module test;
   parameter BYTES = 2;
   localparam mxbit = BYTES*8-1;

   function integer clog2;
      input value;
      integer value;
      for (clog2=0; value>0; clog2=clog2+1) value = value >> 1;
   endfunction


   localparam cntrw = clog2(mxbit);

   integer    tmp;
   initial begin
      tmp = mxbit;
      $display("The maximum bit is %0d and uses a %0d bit counter", mxbit, cntrw);
      $display("clog2 does works here! Got %0d, should be %0d.", clog2(mxbit), clog2(tmp));

      if (cntrw !== clog2(tmp)) begin
	 $display("FAILED -- cntrw=%0d", cntrw);
	 $finish;
      end

      $display("PASSED");
      $finish;
   end
endmodule
module test;

   parameter BYTES = 2;
   localparam mxbit = BYTES*8-1;

   function integer clog2;
      input value;
      integer value;
      for (clog2=0; value>0; clog2=clog2+1) value = value >> 1;
   endfunction


   localparam cntrw = clog2(mxbit);

   integer    tmp;
   initial begin
      tmp = mxbit;
      $display("The maximum bit is %0d and uses a %0d bit counter", mxbit, cntrw);
      $display("clog2 does works here! Got %0d, should be %0d.", clog2(mxbit), clog2(tmp));

      if (cntrw !== clog2(tmp)) begin
	 $display("FAILED -- cntrw=%0d", cntrw);
	 $finish;
      end

      $display("PASSED");
      $finish;
   end
endmodule