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

empty signal slice generates verilog which can not be parsed by Quartus #635

Closed
hansfbaier opened this issue Sep 28, 2021 · 3 comments
Closed

Comments

@hansfbaier
Copy link

hansfbaier commented Sep 28, 2021

from nmigen import *

class QuartusHiccup(Elaboratable):
    def __init__(self):
        self.out = Signal()

    def elaborate(self, platform):
        m = Module()
        data = Signal(1)
        m.d.sync += self.out.eq(data[1:])
        return m

This will generate verilog containing:
assign \$1 = + "";
which is valid verilog, which the quartus parser cannot parse:

Error (10170): Verilog HDL syntax error at top.v(19973) near text: """;  expecting "(".
@hansfbaier hansfbaier changed the title empty signal slice generates verilog which Quartus cannot parse empty signal slice generates verilog which can not be parsed by Quartus Sep 28, 2021
@hansfbaier
Copy link
Author

Also the CSR register multiplexer from nmigen_soc seems to generate similar results,
but I have not been able to reduce that yet. I am not sure whether an empty signal slice has something to do with that.

@whitequark
Copy link
Member

This is actually an upstream issue; Yosys should not be generating empty strings in this context. I've fixed one instance of this bug in YosysHQ/yosys#1203 (in 2019!), but it turns out there was another one, which I've fixed just now in YosysHQ/yosys#3103.

Your testcase synthesizes fine on Quartus with Yosys 0.10, which is required as of the current main branch, so I'm going to close this issue. I'm not sure whether there are other inputs that will generate the RTLIL that causes the pathological Verilog output; please comment on this issue if you do have such a testcase.

@hansfbaier
Copy link
Author

Wow, that's awesome! Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants