Skip to content

An infinite loop occurred in the log during the synth_greenpak4 process. #4972

@sdjasj

Description

@sdjasj

Version

Yosys 0.50+49 (git sha1 05c81b3, clang++ 14.0.0-1ubuntu1.1 -Og -fPIC -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=address,undefined)

On which OS did this happen?

Linux

Reproduction Steps

The following is the problematic Verilog code file bug.v, which I have minimized as much as possible out of responsibility:

module a(input b, c, output reg d);
  reg [31:0] e;

  always @(*) begin
    if (b >> e) begin
        d = e;
    end

    if (c - c) begin
      e = 0;
    end

    e = !e;
  end
endmodule

Running the following command causes Yosys to enter an infinite logging loop, possibly due to an internal infinite loop during synthesis:

yosys -p "read_verilog bug.v; synth_greenpak4"

I discovered this bug while testing Yosys using a fuzzing tool I am developing.

Expected Behavior

The synth_greenpak4 synthesis process should not result in an infinite loop.

Actual Behavior

The following log was produced:

2.24.2. Continuing TECHMAP pass.
Using template $paramod\$lut\WIDTH=32'00000000000000000000000000000001\LUT=2'01 for cells of type $lut.
Using template $paramod\$lut\WIDTH=32'00000000000000000000000000000010\LUT=4'0111 for cells of type $lut.
No more expansions possible.
<suppressed ~41 debug messages>

2.25. Executing GREENPAK4_DFFINV pass (merge input/output inverters into FF/latch cells).
Merged input inverter into cell a.$auto$ff.cc:266:slice$122: GP_DLATCH -> GP_DLATCHI
Merged input inverter into cell a.$auto$ff.cc:266:slice$122: GP_DLATCHI -> GP_DLATCH
Merged input inverter into cell a.$auto$ff.cc:266:slice$122: GP_DLATCH -> GP_DLATCHI
Merged input inverter into cell a.$auto$ff.cc:266:slice$122: GP_DLATCHI -> GP_DLATCH
Merged input inverter into cell a.$auto$ff.cc:266:slice$122: GP_DLATCH -> GP_DLATCHI
Merged input inverter into cell a.$auto$ff.cc:266:slice$122: GP_DLATCHI -> GP_DLATCH
Merged input inverter into cell a.$auto$ff.cc:266:slice$122: GP_DLATCH -> GP_DLATCHI
Merged input inverter into cell a.$auto$ff.cc:266:slice$122: GP_DLATCHI -> GP_DLATCH

and it keeps repeating without termination.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FuzzerFuzzer generated issuebug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions