data/full_repos/permissive/422421961/lib/tb/write_array_data.v
1: b'%Warning-STMTDLY: data/full_repos/permissive/422421961/lib/tb/write_array_data.v:33: Unsupported: Ignoring delay on this delayed statement.\n    #delay;\n    ^\n                  ... Use "/* verilator lint_off STMTDLY */" and lint_on around source to disable this message.\n%Error: data/full_repos/permissive/422421961/lib/tb/write_array_data.v:42: Expecting expression to be constant, but variable isn\'t const: \'i\'\n                                                                         : ... In instance write_array_data\n      $display ("%gWrite task with address : %h Data : %h",$time, offset+i,data[(i+1)*BIT_W-1:i*BIT_W]);\n                                                                                              ^\n%Error: data/full_repos/permissive/422421961/lib/tb/write_array_data.v:42: Expecting expression to be constant, but variable isn\'t const: \'i\'\n                                                                         : ... In instance write_array_data\n      $display ("%gWrite task with address : %h Data : %h",$time, offset+i,data[(i+1)*BIT_W-1:i*BIT_W]);\n                                                                                 ^\n%Error: data/full_repos/permissive/422421961/lib/tb/write_array_data.v:42: First value of [a:b] isn\'t a constant, maybe you want +: or -:\n                                                                         : ... In instance write_array_data\n      $display ("%gWrite task with address : %h Data : %h",$time, offset+i,data[(i+1)*BIT_W-1:i*BIT_W]);\n                                                                                               ^\n%Error: data/full_repos/permissive/422421961/lib/tb/write_array_data.v:42: Second value of [a:b] isn\'t a constant, maybe you want +: or -:\n                                                                         : ... In instance write_array_data\n      $display ("%gWrite task with address : %h Data : %h",$time, offset+i,data[(i+1)*BIT_W-1:i*BIT_W]);\n                                                                                           ^\n%Error: data/full_repos/permissive/422421961/lib/tb/write_array_data.v:43: Expecting expression to be constant, but variable isn\'t const: \'i\'\n                                                                         : ... In instance write_array_data\n      $fwrite(signal_FILE, "%s[%d] = %d\\n",NAME,offset+i,data[(i+1)*BIT_W-1:i*BIT_W]);\n                                                                            ^\n%Error: data/full_repos/permissive/422421961/lib/tb/write_array_data.v:43: Expecting expression to be constant, but variable isn\'t const: \'i\'\n                                                                         : ... In instance write_array_data\n      $fwrite(signal_FILE, "%s[%d] = %d\\n",NAME,offset+i,data[(i+1)*BIT_W-1:i*BIT_W]);\n                                                               ^\n%Error: data/full_repos/permissive/422421961/lib/tb/write_array_data.v:43: First value of [a:b] isn\'t a constant, maybe you want +: or -:\n                                                                         : ... In instance write_array_data\n      $fwrite(signal_FILE, "%s[%d] = %d\\n",NAME,offset+i,data[(i+1)*BIT_W-1:i*BIT_W]);\n                                                                             ^\n%Error: data/full_repos/permissive/422421961/lib/tb/write_array_data.v:43: Second value of [a:b] isn\'t a constant, maybe you want +: or -:\n                                                                         : ... In instance write_array_data\n      $fwrite(signal_FILE, "%s[%d] = %d\\n",NAME,offset+i,data[(i+1)*BIT_W-1:i*BIT_W]);\n                                                                         ^\n%Error: Exiting due to 8 error(s), 1 warning(s)\n        ... See the manual and https://verilator.org for more assistance.\n'
module write_array_data#(
parameter BIT_W=10,
parameter len=256,
parameter NAME="data",
parameter FILENAME="result.dat",
parameter delay=1
)(
	input [BIT_W*len-1:0] data
);
reg [31:0] cnt=0;
integer signal_FILE,i;
task write;
input integer offset;
begin
    #delay;
    signal_FILE = $fopen(FILENAME,"wb+");
    if (signal_FILE ==0) begin
        $display("Error at opening file: %s",FILENAME);
        $stop;
    end
  
  	for(i=0;i<len;i=i+1)begin
  	  cnt=cnt+1;
      $display ("%gWrite task with address : %h Data : %h",$time, offset+i,data[(i+1)*BIT_W-1:i*BIT_W]);
      $fwrite(signal_FILE, "%s[%d] = %d\n",NAME,offset+i,data[(i+1)*BIT_W-1:i*BIT_W]);
   	end	
   	$fclose(signal_FILE);
  end
  
endtask

endmodule
module write_array_data#(
parameter BIT_W=10,
parameter len=256,
parameter NAME="data",
parameter FILENAME="result.dat",
parameter delay=1
)(
	input [BIT_W*len-1:0] data
);

reg [31:0] cnt=0;
integer signal_FILE,i;
task write;
input integer offset;
begin
    #delay;
    signal_FILE = $fopen(FILENAME,"wb+");
    if (signal_FILE ==0) begin
        $display("Error at opening file: %s",FILENAME);
        $stop;
    end
  
  	for(i=0;i<len;i=i+1)begin
  	  cnt=cnt+1;
      $display ("%gWrite task with address : %h Data : %h",$time, offset+i,data[(i+1)*BIT_W-1:i*BIT_W]);
      $fwrite(signal_FILE, "%s[%d] = %d\n",NAME,offset+i,data[(i+1)*BIT_W-1:i*BIT_W]);
   	end	
   	$fclose(signal_FILE);
  end
  
endtask

endmodule