nextpnr: Segfault/exception on combinatorial looping design

The design below crashed both my old, self-built, nextpnr-ecp5 and the current version from https://yowasp.org/ (I apologize for my contorted attempt at forcing yosys to keep my ring oscillator – improvements welcome).

I’ve attached the relevant files:

module top(input clk_25mhz,
           input [6:0] btn,
           output reg [7:0] led,
           output wifi_gpio0);

   // Tie GPIO0, keep ULX3S board from rebooting                                                                                                               
   assign wifi_gpio0    = 1;


   parameter      W = 3; // Must be odd > 2                                                                                                                    
   reg [W-1:0] lfsr = 1;
   always @(posedge btn[6])
     if (btn[5] != btn[4])
       lfsr <= 0;
     else
       lfsr <= {lfsr[W-2:0],lfsr[W-1]^lfsr[W-2]};

   wire [999:0] q;
   genvar      i;
   for (i = 0; i < W; i = i + 1)
     assign q[i] = q[(i + 1) % W] ^ lfsr[i];

   always @(posedge q[0]) led[0] <= !led[0];
   always @(posedge clk_25mhz) led[1] <= btn[1];
endmodule

files.zip

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 16 (10 by maintainers)

Most upvoted comments

@tommythorn You can install nightly builds of YoWASP tools from Test PyPI:

pip install --pre -i https://test.pypi.org/simple/ yowasp-nextpnr-ecp5