data/full_repos/permissive/143278/ivltests/sbyte_test.v
[Errno 2] No such file or directory: 'preprocess.output'
1: b'%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:60: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n                  ... Use "/* verilator lint_off STMTDLY */" and lint_on around source to disable this message.\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:62: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:69: Unsupported: Ignoring delay on this delayed statement.\n    # 1;\n    ^\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:74: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:78: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:89: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:91: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Error: data/full_repos/permissive/143278/ivltests/sbyte_test.v:92: Unsupported: Verilog 1995 force\n        force bu = ui;\n        ^~~~~\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:93: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Error: data/full_repos/permissive/143278/ivltests/sbyte_test.v:100: Unsupported: Verilog 1995 release\n    release bu;\n    ^~~~~~~\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:105: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:107: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Error: data/full_repos/permissive/143278/ivltests/sbyte_test.v:108: Unsupported: Verilog 1995 force\n        force bu = si;\n        ^~~~~\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:109: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Error: data/full_repos/permissive/143278/ivltests/sbyte_test.v:116: Unsupported: Verilog 1995 release\n    release bu;\n    ^~~~~~~\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:122: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:127: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Error: data/full_repos/permissive/143278/ivltests/sbyte_test.v:128: Unsupported: Verilog 1995 force\n        force bu_xz = si;\n        ^~~~~\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:129: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Error: data/full_repos/permissive/143278/ivltests/sbyte_test.v:136: Unsupported: Verilog 1995 release\n    release bu_xz;\n    ^~~~~~~\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:140: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:143: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:145: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:175: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:178: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:180: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:203: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:206: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:241: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Error: data/full_repos/permissive/143278/ivltests/sbyte_test.v:243: Unsupported: Verilog 1995 force\n        force bu = slice;\n        ^~~~~\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:245: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Error: data/full_repos/permissive/143278/ivltests/sbyte_test.v:252: Unsupported: Verilog 1995 release\n    release bu;\n    ^~~~~~~\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/sbyte_test.v:253: Unsupported: Ignoring delay on this delayed statement.\n    # 1;\n    ^\n%Error: Exiting due to 8 error(s), 25 warning(s)\n        ... See the manual and https://verilator.org for more assistance.\n'
module main;
  parameter N_REPS = 500;
  parameter XZ_REPS = 500;
  parameter MAX = 'h7f;
  parameter LEN = 8;

  reg signed [LEN-1:0] ar;
  reg signed [LEN-1:0] ar_xz;
  reg signed [LEN-1:0] ar_expected;
  integer unsigned       ui;
  integer signed         si;
  reg signed [LEN/2-1:0]       slice;

  byte signed bu;
  byte signed bu_xz;
  byte signed bresult;
  byte signed mcaresult;
  byte signed mabresult;

  integer i;





  assign bu = ar;
  assign bu_xz = ar_xz;


  ms_add duv (.a(bu), .b(bu_xz), .sc(mcaresult), .ss(mabresult) );


  initial begin

    if (bu !== 8'b0 || bu_xz != 8'b0 || bresult !== 8'b0)
      begin
        $display ("FAILED - time zero initialisation incorrect: %b %b", bu, bu_xz);
        $finish;
      end

    for (i = 0; i< N_REPS; i = i+1)
      begin
        #1;
        ar = $random % MAX;
        #1;
        if (bu !== ar)
          begin
            $display ("FAILED - incorrect assigment to byte: %b", bu);
            $finish;
        end
      end
    # 1;


    for (i = 0; i< XZ_REPS; i = i+1)
      begin
        #1;
        ar = $random % MAX;
        ar_xz = xz_inject (ar);
        ar_expected = xz_expected (ar_xz);
        #1;
        if (bu_xz !== ar_expected)
          begin
            $display ("FAILED - incorrect assigment to byte (when 'x 'z): %b", bu);
            $finish;
        end
      end


    for (i = 0; i< N_REPS; i = i+1)
      begin
        #1;
        ui = {$random} % 2*(MAX+1);
        #1;
        force bu = ui;
        #1;
        if (bu !== ui[LEN-1:0])
          begin
            $display ("FAILED - incorrect truncation from unsigned integer to byte: %b", bu);
            $finish;
        end
      end
    release bu;


    for (i = 0; i< N_REPS; i = i+1)
      begin
        #1;
        si = $random % MAX;
        #1;
        force bu = si;
        #1;
        if (bu !== si[LEN-1:0])
          begin
            $display ("FAILED - incorrect truncation from signed integer to byte: %b mismatchs %b", bu, si[LEN-1:0]);
            $finish;
        end
      end
    release bu;



    for (i = 0; i< XZ_REPS; i = i+1)
      begin
        #1;
        si = $random;
        ar_xz = xz_inject (si[LEN-1:0]);
        si = {si[31:LEN], ar_xz};
        ar_expected = xz_expected (ar_xz);
        #1;
        force bu_xz = si;
        #1;
        if (bu_xz !== ar_expected)
          begin
            $display ("FAILED - incorrect conversion from integer (with 'x 'z) to byte: %b mismatchs %b", bu_xz, ar_expected);
            $finish;
        end
      end
    release bu_xz;

    for (i = 0; i< N_REPS; i = i+1)
      begin
        #1;
        ar = $random % MAX;
        ar_xz = $random % MAX;
        #1;
        bresult = bu + bu_xz;
        #1;
        if ( bresult !== s_sum(ar, ar_xz) )
          begin
            $display ("FAILED - incorrect addition of signed bytes: %0d mismatchs %0d", bresult, s_sum(ar, ar_xz));
            $finish;
          end

        if ( fs_sum (bu, bu_xz) !== s_sum(ar, ar_xz) )
          begin
            $display ("FAILED - incorrect addition of signed bytes in function");
            $finish;
          end

        ts_sum (bu, bu_xz, bresult);
        if ( bresult !== s_sum(ar, ar_xz) )
          begin
            $display ("FAILED - incorrect addition of signed bytes in task: %0d mismatchs %0d", bresult, s_sum(ar, ar_xz));
            $finish;
          end

        if ( mcaresult !== s_sum(ar, ar_xz) || mabresult !== s_sum(ar, ar_xz))
          begin
            $display ("FAILED - incorrect addition of signed bytes from module");
            $finish;
          end
      end


    for (i = 0; i< N_REPS; i = i+1)
      begin
        #1;
        ar = ($random % MAX) << LEN/2;
        ar_xz = ($random % MAX) << (LEN/2 - 1);
        #1;
        bresult = bu * bu_xz;
        #1;
        if ( bresult !== s_mul(ar, ar_xz) )
          begin
            $display ("FAILED - incorrect product of signed bytes: %0d mismatchs %0d", bresult, s_mul(ar, ar_xz));
            $finish;
          end

        if ( fs_mul (bu, bu_xz) !== s_mul(ar, ar_xz) )
          begin
            $display ("FAILED - incorrect product of signed bytes in function");
            $finish;
          end

        ts_mul (bu, bu_xz, bresult);
        if ( bresult !== s_mul(ar, ar_xz) )
          begin
            $display ("FAILED - incorrect product of signed bytes in task: %0d mismatchs %0d", bresult, s_mul(ar, ar_xz));
            $finish;
          end
      end

    for (i = 0; i< N_REPS; i = i+1)
      begin
        #1;
        ar = $random % MAX;
        ar_xz = $random % MAX;
        #1;
        if ( (bu < bu_xz ) !== (ar < ar_xz) )
          begin
            $display ("FAILED - incorrect 'less than' on signed bytes");
            $finish;
          end
        if ( (bu <= bu_xz ) !== (ar <= ar_xz) )
          begin
            $display ("FAILED - incorrect 'less than or equal' on signed bytes");
            $finish;
          end
        if ( (bu > bu_xz ) !== (ar > ar_xz) )
          begin
            $display ("FAILED - incorrect 'greater than' on signed bytes");
            $finish;
          end
        if ( (bu >= bu_xz ) !== (ar >= ar_xz) )
          begin
            $display ("FAILED - incorrect 'greater than or equal' than on signed bytes");
            $finish;
          end
        if ( (bu == bu_xz ) !== (ar == ar_xz) )
          begin
            $display ("FAILED - incorrect 'equal to' on signed bytes");
            $finish;
          end
        if ( (bu != bu_xz ) !== (ar != ar_xz) )
          begin
            $display ("FAILED - incorrect 'not equal to' on signed bytes");
            $finish;
          end
      end

    for (i = 0; i < (1<<LEN/2); i = i+1)
      begin
        #1;
        slice = $random % 'h7;
        force bu = slice;
        ar = slice;
        #1;
        if (bu !== ar)
          begin
            $display ("FAILED - incorrect signed extend to signed bytes");
            $finish;
          end
      end
    release bu;
    # 1;
    $display("PASSED");
  end


  function [LEN-1:0] xz_inject (input signed [LEN-1:0] value);
      integer i, temp;
      begin
        temp = {$random} % 2*(MAX+1);
        for (i=0; i<LEN; i=i+1)
          begin
             if (temp[i] == 1'b1)
               begin
                 temp = $random % MAX;
                 if (temp <= 0)
                    value[i] = 1'bx;
                 else
                    value[i] = 1'bz;
               end
          end
          xz_inject = value;
      end
  endfunction


  function [LEN-1:0] xz_expected (input signed [LEN-1:0] value_xz);
      integer i;
      begin
        for (i=0; i<LEN; i=i+1)
          begin
             if (value_xz[i] === 1'bx || value_xz[i] === 1'bz )
                 value_xz[i] = 1'b0;
          end
          xz_expected = value_xz;
      end
  endfunction


  function signed [LEN-1:0] s_sum (input signed [LEN-1:0] a, b);
      s_sum = a + b;
  endfunction


  function byte signed fs_sum (input byte signed a, b);
      fs_sum = a + b;
  endfunction


  task ts_sum (input byte signed a, b, output byte signed c);
      c = a + b;
  endtask


  function signed [LEN-1:0] s_mul (input signed [LEN-1:0] a, b);
      s_mul = a * b;
  endfunction


  function byte signed fs_mul (input byte signed a, b);
      fs_mul = a * b;
  endfunction


  task ts_mul (input byte signed a, b, output byte signed c);
      c = a * b;
  endtask


endmodule
module main;

  parameter N_REPS = 500;
  parameter XZ_REPS = 500;
  parameter MAX = 'h7f;
  parameter LEN = 8;

  reg signed [LEN-1:0] ar;
  reg signed [LEN-1:0] ar_xz;
  reg signed [LEN-1:0] ar_expected;
  integer unsigned       ui;
  integer signed         si;
  reg signed [LEN/2-1:0]       slice;

  byte signed bu;
  byte signed bu_xz;
  byte signed bresult;
  byte signed mcaresult;
  byte signed mabresult;

  integer i;





  assign bu = ar;
  assign bu_xz = ar_xz;


  ms_add duv (.a(bu), .b(bu_xz), .sc(mcaresult), .ss(mabresult) );


  initial begin

    if (bu !== 8'b0 || bu_xz != 8'b0 || bresult !== 8'b0)
      begin
        $display ("FAILED - time zero initialisation incorrect: %b %b", bu, bu_xz);
        $finish;
      end

    for (i = 0; i< N_REPS; i = i+1)
      begin
        #1;
        ar = $random % MAX;
        #1;
        if (bu !== ar)
          begin
            $display ("FAILED - incorrect assigment to byte: %b", bu);
            $finish;
        end
      end
    # 1;


    for (i = 0; i< XZ_REPS; i = i+1)
      begin
        #1;
        ar = $random % MAX;
        ar_xz = xz_inject (ar);
        ar_expected = xz_expected (ar_xz);
        #1;
        if (bu_xz !== ar_expected)
          begin
            $display ("FAILED - incorrect assigment to byte (when 'x 'z): %b", bu);
            $finish;
        end
      end


    for (i = 0; i< N_REPS; i = i+1)
      begin
        #1;
        ui = {$random} % 2*(MAX+1);
        #1;
        force bu = ui;
        #1;
        if (bu !== ui[LEN-1:0])
          begin
            $display ("FAILED - incorrect truncation from unsigned integer to byte: %b", bu);
            $finish;
        end
      end
    release bu;


    for (i = 0; i< N_REPS; i = i+1)
      begin
        #1;
        si = $random % MAX;
        #1;
        force bu = si;
        #1;
        if (bu !== si[LEN-1:0])
          begin
            $display ("FAILED - incorrect truncation from signed integer to byte: %b mismatchs %b", bu, si[LEN-1:0]);
            $finish;
        end
      end
    release bu;



    for (i = 0; i< XZ_REPS; i = i+1)
      begin
        #1;
        si = $random;
        ar_xz = xz_inject (si[LEN-1:0]);
        si = {si[31:LEN], ar_xz};
        ar_expected = xz_expected (ar_xz);
        #1;
        force bu_xz = si;
        #1;
        if (bu_xz !== ar_expected)
          begin
            $display ("FAILED - incorrect conversion from integer (with 'x 'z) to byte: %b mismatchs %b", bu_xz, ar_expected);
            $finish;
        end
      end
    release bu_xz;

    for (i = 0; i< N_REPS; i = i+1)
      begin
        #1;
        ar = $random % MAX;
        ar_xz = $random % MAX;
        #1;
        bresult = bu + bu_xz;
        #1;
        if ( bresult !== s_sum(ar, ar_xz) )
          begin
            $display ("FAILED - incorrect addition of signed bytes: %0d mismatchs %0d", bresult, s_sum(ar, ar_xz));
            $finish;
          end

        if ( fs_sum (bu, bu_xz) !== s_sum(ar, ar_xz) )
          begin
            $display ("FAILED - incorrect addition of signed bytes in function");
            $finish;
          end

        ts_sum (bu, bu_xz, bresult);
        if ( bresult !== s_sum(ar, ar_xz) )
          begin
            $display ("FAILED - incorrect addition of signed bytes in task: %0d mismatchs %0d", bresult, s_sum(ar, ar_xz));
            $finish;
          end

        if ( mcaresult !== s_sum(ar, ar_xz) || mabresult !== s_sum(ar, ar_xz))
          begin
            $display ("FAILED - incorrect addition of signed bytes from module");
            $finish;
          end
      end


    for (i = 0; i< N_REPS; i = i+1)
      begin
        #1;
        ar = ($random % MAX) << LEN/2;
        ar_xz = ($random % MAX) << (LEN/2 - 1);
        #1;
        bresult = bu * bu_xz;
        #1;
        if ( bresult !== s_mul(ar, ar_xz) )
          begin
            $display ("FAILED - incorrect product of signed bytes: %0d mismatchs %0d", bresult, s_mul(ar, ar_xz));
            $finish;
          end

        if ( fs_mul (bu, bu_xz) !== s_mul(ar, ar_xz) )
          begin
            $display ("FAILED - incorrect product of signed bytes in function");
            $finish;
          end

        ts_mul (bu, bu_xz, bresult);
        if ( bresult !== s_mul(ar, ar_xz) )
          begin
            $display ("FAILED - incorrect product of signed bytes in task: %0d mismatchs %0d", bresult, s_mul(ar, ar_xz));
            $finish;
          end
      end

    for (i = 0; i< N_REPS; i = i+1)
      begin
        #1;
        ar = $random % MAX;
        ar_xz = $random % MAX;
        #1;
        if ( (bu < bu_xz ) !== (ar < ar_xz) )
          begin
            $display ("FAILED - incorrect 'less than' on signed bytes");
            $finish;
          end
        if ( (bu <= bu_xz ) !== (ar <= ar_xz) )
          begin
            $display ("FAILED - incorrect 'less than or equal' on signed bytes");
            $finish;
          end
        if ( (bu > bu_xz ) !== (ar > ar_xz) )
          begin
            $display ("FAILED - incorrect 'greater than' on signed bytes");
            $finish;
          end
        if ( (bu >= bu_xz ) !== (ar >= ar_xz) )
          begin
            $display ("FAILED - incorrect 'greater than or equal' than on signed bytes");
            $finish;
          end
        if ( (bu == bu_xz ) !== (ar == ar_xz) )
          begin
            $display ("FAILED - incorrect 'equal to' on signed bytes");
            $finish;
          end
        if ( (bu != bu_xz ) !== (ar != ar_xz) )
          begin
            $display ("FAILED - incorrect 'not equal to' on signed bytes");
            $finish;
          end
      end

    for (i = 0; i < (1<<LEN/2); i = i+1)
      begin
        #1;
        slice = $random % 'h7;
        force bu = slice;
        ar = slice;
        #1;
        if (bu !== ar)
          begin
            $display ("FAILED - incorrect signed extend to signed bytes");
            $finish;
          end
      end
    release bu;
    # 1;
    $display("PASSED");
  end


  function [LEN-1:0] xz_inject (input signed [LEN-1:0] value);
      integer i, temp;
      begin
        temp = {$random} % 2*(MAX+1);
        for (i=0; i<LEN; i=i+1)
          begin
             if (temp[i] == 1'b1)
               begin
                 temp = $random % MAX;
                 if (temp <= 0)
                    value[i] = 1'bx;
                 else
                    value[i] = 1'bz;
               end
          end
          xz_inject = value;
      end
  endfunction


  function [LEN-1:0] xz_expected (input signed [LEN-1:0] value_xz);
      integer i;
      begin
        for (i=0; i<LEN; i=i+1)
          begin
             if (value_xz[i] === 1'bx || value_xz[i] === 1'bz )
                 value_xz[i] = 1'b0;
          end
          xz_expected = value_xz;
      end
  endfunction


  function signed [LEN-1:0] s_sum (input signed [LEN-1:0] a, b);
      s_sum = a + b;
  endfunction


  function byte signed fs_sum (input byte signed a, b);
      fs_sum = a + b;
  endfunction


  task ts_sum (input byte signed a, b, output byte signed c);
      c = a + b;
  endtask


  function signed [LEN-1:0] s_mul (input signed [LEN-1:0] a, b);
      s_mul = a * b;
  endfunction


  function byte signed fs_mul (input byte signed a, b);
      fs_mul = a * b;
  endfunction


  task ts_mul (input byte signed a, b, output byte signed c);
      c = a * b;
  endtask


endmodule