data/full_repos/permissive/143278/ivltests/iint_test.v
 line:13: before: "bu"
1: b'%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/iint_test.v:32: 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/iint_test.v:34: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/iint_test.v:41: Unsupported: Ignoring delay on this delayed statement.\n    # 1;\n    ^\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/iint_test.v:45: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/iint_test.v:49: Unsupported: Ignoring delay on this delayed statement.\n        #1;\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/143278/ivltests/iint_test.v:56: Unsupported: Ignoring delay on this delayed statement.\n    # 1;\n    ^\n%Error: Exiting due to 6 warning(s)\n        ... See the manual and https://verilator.org for more assistance.\n'
module ibyte_test;
  parameter TRIALS = 100;
  parameter MAX = 'h7fffffff;
  reg [31:0] ar;
  reg [31:0] ar_xz;
  reg [31:0] ar_expected;
  int unsigned bu;
  int unsigned bu_xz;

  integer i;

  assign bu = ar;
  assign bu_xz = ar_xz;


  initial begin

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

    for (i = 0; i< TRIALS; 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< TRIALS; 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): %b", bu);
            $finish;
        end
      end
    # 1;
    $display("PASSED");
  end


  function [31:0] xz_inject (input [31:0] value);
      integer i, temp;
      begin
        temp = {$random} % MAX;
        for (i=0; i<32; 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 [31:0] xz_expected (input [31:0] value_xz);
      integer i;
      begin
        for (i=0; i<32; 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


endmodule
module ibyte_test;

  parameter TRIALS = 100;
  parameter MAX = 'h7fffffff;
  reg [31:0] ar;
  reg [31:0] ar_xz;
  reg [31:0] ar_expected;
  int unsigned bu;
  int unsigned bu_xz;

  integer i;

  assign bu = ar;
  assign bu_xz = ar_xz;


  initial begin

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

    for (i = 0; i< TRIALS; 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< TRIALS; 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): %b", bu);
            $finish;
        end
      end
    # 1;
    $display("PASSED");
  end


  function [31:0] xz_inject (input [31:0] value);
      integer i, temp;
      begin
        temp = {$random} % MAX;
        for (i=0; i<32; 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 [31:0] xz_expected (input [31:0] value_xz);
      integer i;
      begin
        for (i=0; i<32; 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


endmodule