greatscottgadgets/luna

"Part offset must be unsigned" error

jrsa opened this issue · 0 comments

jrsa commented

Seems to have been introduced by this commit in amaranth: amaranth-lang/amaranth@21b5451

Traceback:

$ python examples/usb/simple_device.py
INFO    | __init__    | Building and uploading gateware to attached ECPIX-5 (85F)...
INFO    | __init__    | Fixing build, creating output directory: /tmp/tmp46jesvlq/soc/lambdasoc.soc.cpu/bios/3rdparty/litex
Traceback (most recent call last):
  File "/home/user/git/luna/examples/usb/simple_device.py", line 92, in <module>
    top_level_cli(USBDeviceExample)
  File "/home/user/git/luna/env/lib/python3.11/site-packages/luna/__init__.py", line 151, in top_level_cli
    products = platform.build(fragment,
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/git/luna/env/lib/python3.11/site-packages/amaranth/build/plat.py", line 105, in build
    plan = self.prepare(elaboratable, name, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/git/luna/env/lib/python3.11/site-packages/amaranth/build/plat.py", line 145, in prepare
    fragment = Fragment.get(elaboratable, self)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/git/luna/env/lib/python3.11/site-packages/amaranth/hdl/ir.py", line 42, in get
    new_obj = obj.elaborate(platform)
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/git/luna/env/lib/python3.11/site-packages/amaranth/hdl/dsl.py", line 539, in elaborate
    fragment.add_subfragment(Fragment.get(self._named_submodules[name], platform), name)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/git/luna/env/lib/python3.11/site-packages/amaranth/hdl/ir.py", line 42, in get
    new_obj = obj.elaborate(platform)
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/git/luna/env/lib/python3.11/site-packages/amaranth/hdl/dsl.py", line 539, in elaborate
    fragment.add_subfragment(Fragment.get(self._named_submodules[name], platform), name)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/git/luna/env/lib/python3.11/site-packages/amaranth/hdl/ir.py", line 42, in get
    new_obj = obj.elaborate(platform)
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/git/luna/env/lib/python3.11/site-packages/amaranth/hdl/dsl.py", line 539, in elaborate
    fragment.add_subfragment(Fragment.get(self._named_submodules[name], platform), name)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/git/luna/env/lib/python3.11/site-packages/amaranth/hdl/ir.py", line 42, in get
    new_obj = obj.elaborate(platform)
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/git/luna/env/lib/python3.11/site-packages/amaranth/hdl/dsl.py", line 539, in elaborate
    fragment.add_subfragment(Fragment.get(self._named_submodules[name], platform), name)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/git/luna/env/lib/python3.11/site-packages/amaranth/hdl/ir.py", line 42, in get
    new_obj = obj.elaborate(platform)
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/git/luna/env/lib/python3.11/site-packages/luna/gateware/usb/usb2/descriptor.py", line 514, in elaborate
    self.tx.payload     .eq(rom_read_port.data.word_select(3 - byte_in_stream, 8)),
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/git/luna/env/lib/python3.11/site-packages/amaranth/hdl/ast.py", line 407, in word_select
    return Part(self, offset, width, stride=width, src_loc_at=1)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/git/luna/env/lib/python3.11/site-packages/amaranth/hdl/ast.py", line 870, in __init__
    raise TypeError("Part offset must be unsigned")
TypeError: Part offset must be unsigned