Skip to content

ERROR: Assert 'signal_list[id1].bit.wire != nullptr' occurred during the synth_efinix #4987

@sdjasj

Description

@sdjasj

Version

Yosys 0.51+107 (git sha1 f03b449, clang++ 14.0.0-1ubuntu1.1 -fPIC -O3)

On which OS did this happen?

Linux

Reproduction Steps

Below is the Verilog code bug.v that triggers the assertion. I’ve already minimized it using C-Reduce and manual inspection (from 6493 bytes to 740 bytes) — removing any single line from the code will prevent the assertion from being triggered. (Interestingly, if I change reg [1:0] g, h, i, j; to reg g, h, i, j;, the assertion does not occur.)

module a(
    input f,
    input [1:0] b,
    output reg c
);
    reg [1:0] g, h, i, j;
    wire k, e;

    always @(*) begin
        begin
            c = h;
        end

        case (b)
            'd1: begin
                h = i;
            end
        endcase
    end

    always @(f) begin
        case (g << j >> h)
            32'd3: begin
                case (b << j)
                    'd1: begin
                        h = 0;
                        j = f ? (^k) : 0;
                    end
                    'd2: begin
                        i = j;
                    end
                endcase
            end

            default: begin
                h = e || b;
            end
        endcase
    end
endmodule

The following is the minimized min.il file using Yosys's bugpoint.

# Generated by Yosys 0.51+107 (git sha1 f03b44959, clang++ 14.0.0-1ubuntu1.1 -fPIC -O3)
autoidx 130
attribute \src "bug.v:1.1-40.10"
attribute \cells_not_processed 1
module \a
  attribute \src "bug.v:9.5-19.8"
  wire $0\c[0:0]
  attribute \src "bug.v:9.5-19.8"
  wire width 2 $0\h[1:0]
  attribute \src "bug.v:21.5-39.8"
  wire width 2 $0\i[1:0]
  attribute \src "bug.v:21.5-39.8"
  wire width 2 $0\j[1:0]
  attribute \src "bug.v:9.5-19.8"
  wire width 2 $1\h[1:0]
  attribute \src "bug.v:21.5-39.8"
  wire width 2 $1\i[1:0]
  attribute \src "bug.v:21.5-39.8"
  wire width 2 $1\j[1:0]
  attribute \src "bug.v:21.5-39.8"
  wire width 2 $2\h[1:0]
  attribute \src "bug.v:21.5-39.8"
  wire width 2 $2\i[1:0]
  attribute \src "bug.v:21.5-39.8"
  wire width 2 $2\j[1:0]
  attribute \src "bug.v:21.5-39.8"
  wire width 2 $3\h[1:0]
  attribute \src "bug.v:21.5-39.8"
  wire width 2 $4\h[1:0]
  attribute $bugpoint 1
  wire width 2 input 3 $auto$bugpoint.cc:258:simplify_something$13
  attribute $bugpoint 1
  wire $auto$bugpoint.cc:258:simplify_something$18
  attribute $bugpoint 1
  wire $auto$bugpoint.cc:258:simplify_something$57
  attribute $bugpoint 1
  wire width 32 input 4 $auto$bugpoint.cc:258:simplify_something$78
  attribute $bugpoint 1
  wire width 32 input 5 $auto$bugpoint.cc:258:simplify_something$90
  wire width 32 $delete_wire$29
  wire width 32 $delete_wire$30
  wire $delete_wire$45
  attribute \src "bug.v:36.21-36.27"
  wire width 2 $logic_or$bug.v:36$8_Y
  attribute \src "bug.v:22.15-22.26"
  wire width 32 $shr$bug.v:22$4_Y
  attribute \src "bug.v:27.29-27.41"
  wire width 32 $ternary$bug.v:27$7_Y
  attribute \src "bug.v:3.17-3.18"
  wire width 2 input 1 \b
  attribute \src "bug.v:4.16-4.17"
  wire output 2 \c
  attribute \src "bug.v:6.18-6.19"
  wire width 2 \h
  attribute \src "bug.v:6.21-6.22"
  wire width 2 \i
  attribute \src "bug.v:6.24-6.25"
  wire width 2 \j
  attribute \src "bug.v:36.21-36.27"
  cell $logic_or $logic_or$bug.v:36$8
    parameter \A_SIGNED 0
    parameter \A_WIDTH 1
    parameter \B_SIGNED 0
    parameter \B_WIDTH 2
    parameter \Y_WIDTH 2
    connect \A 1'x
    connect \B \b
    connect \Y $logic_or$bug.v:36$8_Y
  end
  attribute \src "bug.v:22.15-22.26"
  cell $shr $shr$bug.v:22$4
    parameter \A_SIGNED 0
    parameter \A_WIDTH 32
    parameter \B_SIGNED 0
    parameter \B_WIDTH 2
    parameter \Y_WIDTH 32
    connect \A $auto$bugpoint.cc:258:simplify_something$78
    connect \B $auto$bugpoint.cc:258:simplify_something$13
    connect \Y $shr$bug.v:22$4_Y
  end
  attribute \src "bug.v:27.29-27.41"
  cell $mux $ternary$bug.v:27$7
    parameter \WIDTH 32
    connect \A 32'x
    connect \B $auto$bugpoint.cc:258:simplify_something$90
    connect \S $auto$bugpoint.cc:258:simplify_something$57
    connect \Y $ternary$bug.v:27$7_Y
  end
  attribute \src "bug.v:21.5-39.8"
  process $proc$bug.v:21$2
    assign $2\h[1:0] $3\h[1:0]
    assign $0\i[1:0] $1\i[1:0]
    assign $0\j[1:0] $1\j[1:0]
    attribute \src "bug.v:22.9-38.16"
    switch $shr$bug.v:22$4_Y
      case 3
        assign $3\h[1:0] $4\h[1:0]
        assign $1\i[1:0] $2\i[1:0]
        assign $1\j[1:0] $2\j[1:0]
        attribute \src "bug.v:24.17-32.24"
        switch $delete_wire$30
          case 1
            assign $2\j[1:0] $ternary$bug.v:27$7_Y [1:0]
          case 2
            assign $2\i[1:0] \j
          case 
        end
      case 
        assign $3\h[1:0] $logic_or$bug.v:36$8_Y
    end
    sync always
      update \h $2\h[1:0]
      update \i $0\i[1:0]
      update \j $0\j[1:0]
  end
  attribute \src "bug.v:9.5-19.8"
  process $proc$bug.v:9$1
    assign $0\c[0:0] \h [0]
    assign $0\h[1:0] $1\h[1:0]
    attribute \src "bug.v:14.9-18.16"
    switch { 30'000000000000000000000000000000 \b }
      case 1
        assign $1\h[1:0] \i
      case 
        assign $1\h[1:0] \h
    end
    sync always
      update \c $0\c[0:0]
      update \h $0\h[1:0]
  end
end

The bug can be reproduced with the following commands:

yosys -p "read_verilog bug.v; synth_efinix"

or

yosys -p "read_rtlil min.il; synth_efinix"

Expected Behavior

The synthesis process should not trigger an assertion.

Actual Behavior

An assertion failure occurred, causing the synthesis to fail. The log is as follows:

2.17. Executing OPT_EXPR pass (perform const folding).
Optimizing module a.
Couldn't topologically sort cells, optimizing module a may take a longer time.
Couldn't topologically sort cells, optimizing module a may take a longer time.
<suppressed ~1 debug messages>

2.18. Executing SIMPLEMAP pass (map simple cells to gate primitives).

2.19. Executing ABC pass (technology mapping using ABC).

2.19.1. Extracting gate netlist of module `\a' to `<abc-temp-dir>/input.blif'..
ERROR: Assert `signal_list[id1].bit.wire != nullptr' failed in passes/techmap/abc.cc:536.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FuzzerFuzzer generated issuepending-verificationThis issue is pending verification and/or reproduction

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions