data/full_repos/permissive/51637845/bmp_test.v
1: b'%Warning-STMTDLY: data/full_repos/permissive/51637845/bmp_test.v:18: Unsupported: Ignoring delay on this delayed statement.\n    #150;\n    ^\n                  ... Use "/* verilator lint_off STMTDLY */" and lint_on around source to disable this message.\n%Warning-STMTDLY: data/full_repos/permissive/51637845/bmp_test.v:19: Unsupported: Ignoring delay on this delayed statement.\n    forever #(STEP/2)\n            ^\n%Warning-STMTDLY: data/full_repos/permissive/51637845/bmp_test.v:44: Unsupported: Ignoring delay on this delayed statement.\n    #1000;\n    ^\n%Warning-STMTDLY: data/full_repos/permissive/51637845/bmp_test.v:47: Unsupported: Ignoring delay on this delayed statement.\n        #STEP;\n        ^\n%Warning-WIDTH: data/full_repos/permissive/51637845/bmp_test.v:26: Logical Operator LOGNOT expects 1 bit on the LHS, but LHS\'s VARREF \'fp_src\' generates 32 bits.\n                                                                 : ... In instance bmp_test\n    if(!fp_src) begin\n       ^\n%Warning-WIDTH: data/full_repos/permissive/51637845/bmp_test.v:32: Logical Operator LOGNOT expects 1 bit on the LHS, but LHS\'s VARREF \'fp_dst\' generates 32 bits.\n                                                                 : ... In instance bmp_test\n    if(!fp_dst) begin\n       ^\n%Warning-WIDTH: data/full_repos/permissive/51637845/bmp_test.v:67: Operator ASSIGN expects 8 bits on the Assign RHS, but Assign RHS\'s VARREF \'c\' generates 32 bits.\n                                                                 : ... In instance bmp_test\n    DATA = c;\n         ^\n%Error: data/full_repos/permissive/51637845/bmp_test.v:48: Unsupported: Function output argument \'DATA\' requires 8 bits, but connection\'s VARREF \'pixel_data\' generates 32 bits.\n                                                         : ... In instance bmp_test\n        read_from_src(pixel_data);\n                      ^~~~~~~~~~\n%Warning-WIDTH: data/full_repos/permissive/51637845/bmp_test.v:48: Operator TASKREF \'read_from_src\' expects 8 bits on the Function Argument, but Function Argument\'s VARREF \'pixel_data\' generates 32 bits.\n                                                                 : ... In instance bmp_test\n        read_from_src(pixel_data);\n        ^~~~~~~~~~~~~\n%Warning-WIDTH: data/full_repos/permissive/51637845/bmp_test.v:75: Operator ASSIGN expects 32 bits on the Assign RHS, but Assign RHS\'s VARREF \'DATA\' generates 8 bits.\n                                                                 : ... In instance bmp_test\n    c = DATA;\n      ^\n%Warning-WIDTH: data/full_repos/permissive/51637845/bmp_test.v:49: Operator TASKREF \'write_to_dst\' expects 8 bits on the Function Argument, but Function Argument\'s VARREF \'pixel_data\' generates 32 bits.\n                                                                 : ... In instance bmp_test\n        write_to_dst(pixel_data);\n        ^~~~~~~~~~~~\n%Error: Exiting due to 1 error(s), 10 warning(s)\n        ... See the manual and https://verilator.org for more assistance.\n'
module bmp_test;
  parameter STEP = 100;
  integer fp_src, fp_dst;
  integer i;
  integer x, y;
  reg [7:0] header [0:53];
  integer pixel_data;
  reg	clk;
  

  initial begin
    clk <= 0;
    #150;
    forever #(STEP/2)
      clk <= ~clk;
  end

  initial begin

    fp_src = $fopen(`SOURCE_FILE, "rb");
    if(!fp_src) begin
      $display("Src file open error.\n");
      $stop;
    end

    fp_dst = $fopen(`RESULT_FILE, "wb");
    if(!fp_dst) begin
      $display("Destination file open error.\n");
      $fclose(fp_src);
      $stop;
    end
    

    for(i = 0; i < 54; i = i+1) begin
      header[i] = $fgetc(fp_src);
			$fwrite(fp_dst, "%c", header[i]);
    end
    
    #1000;
    for(y = 0; y < 480; y = y + 1) begin
      for(x = 0; x < 640; x = x + 1) begin
        #STEP;
        read_from_src(pixel_data);
        write_to_dst(pixel_data);
      end
    end
    
    $fclose(fp_src);
    $fclose(fp_dst);
    $stop;
  end


task read_from_src;
  output [7:0] DATA;
  integer c;
  begin
    c = $fgetc(fp_src);
    c = c + $fgetc(fp_src);
    c = c + $fgetc(fp_src);
    c = c / 3;
    DATA = c;
  end
endtask

task write_to_dst;
  input [7:0] DATA;
  integer c;
  begin
    c = DATA;
    $fwrite (fp_dst, "%c", c);
    $fwrite (fp_dst, "%c", c);
    $fwrite (fp_dst, "%c", c);
  end
endtask

endmodule
module bmp_test;

  parameter STEP = 100;
  integer fp_src, fp_dst;
  integer i;
  integer x, y;
  reg [7:0] header [0:53];
  integer pixel_data;
  reg	clk;
  

  initial begin
    clk <= 0;
    #150;
    forever #(STEP/2)
      clk <= ~clk;
  end

  initial begin

    fp_src = $fopen(`SOURCE_FILE, "rb");
    if(!fp_src) begin
      $display("Src file open error.\n");
      $stop;
    end

    fp_dst = $fopen(`RESULT_FILE, "wb");
    if(!fp_dst) begin
      $display("Destination file open error.\n");
      $fclose(fp_src);
      $stop;
    end
    

    for(i = 0; i < 54; i = i+1) begin
      header[i] = $fgetc(fp_src);
			$fwrite(fp_dst, "%c", header[i]);
    end
    
    #1000;
    for(y = 0; y < 480; y = y + 1) begin
      for(x = 0; x < 640; x = x + 1) begin
        #STEP;
        read_from_src(pixel_data);
        write_to_dst(pixel_data);
      end
    end
    
    $fclose(fp_src);
    $fclose(fp_dst);
    $stop;
  end


task read_from_src;
  output [7:0] DATA;
  integer c;
  begin
    c = $fgetc(fp_src);
    c = c + $fgetc(fp_src);
    c = c + $fgetc(fp_src);
    c = c / 3;
    DATA = c;
  end
endtask

task write_to_dst;
  input [7:0] DATA;
  integer c;
  begin
    c = DATA;
    $fwrite (fp_dst, "%c", c);
    $fwrite (fp_dst, "%c", c);
    $fwrite (fp_dst, "%c", c);
  end
endtask

endmodule