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

nmigen generates invalid RTLIL with negative shifts #302

Closed
Ravenslofty opened this issue Jan 11, 2020 · 1 comment
Closed

nmigen generates invalid RTLIL with negative shifts #302

Ravenslofty opened this issue Jan 11, 2020 · 1 comment

Comments

@Ravenslofty
Copy link
Contributor

from nmigen import *
from nmigen.back import verilog

class Test(Elaboratable):
    def __init__(self):
        self.i = Signal(8)
        self.o = Signal(8)

    def elaborate(self, platform):
        m = Module()

        m.d.comb += self.o.eq(self.i << -3)

        return m

print(verilog.convert(Test()))

produces

Traceback (most recent call last):
  File "test.py", line 16, in <module>
    print(verilog.convert(Test()))
  File "/usr/local/lib/python3.7/dist-packages/nmigen-0.2.dev13+g476ce15-py3.7.egg/nmigen/back/verilog.py", line 77, in convert
    return _convert_rtlil_text(rtlil_text, strip_internal_attrs=strip_internal_attrs)
  File "/usr/local/lib/python3.7/dist-packages/nmigen-0.2.dev13+g476ce15-py3.7.egg/nmigen/back/verilog.py", line 65, in _convert_rtlil_text
    raise YosysError(error.strip())
nmigen.back.verilog.YosysError: ERROR: Found error in internal cell \top.$3 ($sshl) at kernel/rtlil.cc:790:
  attribute \src "test.py:12"
  cell $sshl $3
    parameter \Y_WIDTH 4'1011
    parameter \B_WIDTH 2'11
    parameter \B_SIGNED 1'1
    parameter \A_WIDTH 4'1000
    parameter \A_SIGNED 1'0
    connect \Y $2
    connect \B 3'101
    connect \A \i
  end
@whitequark
Copy link
Contributor

whitequark commented Feb 1, 2020

Fixed in my fork.

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

No branches or pull requests

2 participants