Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ecp5: Fix constant and inverted CEMUX #1442

Merged
merged 1 commit into from
Jan 27, 2025
Merged

Conversation

gatecat
Copy link
Member

@gatecat gatecat commented Jan 27, 2025

In one case, Yosys generates a never-toggling flipflop with constant-1 CE and CEMUX set to INV. This is a bit odd, but nextpnr should still handle this case correctly.

@leocassarani
Copy link

@gatecat Thanks for fixing this so quickly! I've just tested your patch with the following repro case and I can confirm that it works as expected on my board (i.e. the LED stays off) — as opposed to nextpnr on master where the LED would be on. Much appreciated 🙏

module top (
  input clk,
  output reg led_g = 1'b0
);

  reg a = 1'b0;
  always @(posedge clk)
    a <= !a;

  wire [2:0] b = 3'd3 + { 2'b0, a };

  always @(posedge clk)
    if (b == 3'd0) led_g <= 1'b1;

endmodule

@gatecat gatecat merged commit ede78f3 into master Jan 27, 2025
16 checks passed
@gatecat gatecat deleted the gatecat/ecp5-cemux-fix branch January 27, 2025 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants