[Libre-soc-bugs] [Bug 762] Peripheral Pin Muxing Development

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Sun Jan 16 11:29:36 GMT 2022


--- Comment #4 from Andrey Miroshnikov <andrey at technepisteme.xyz> ---
(In reply to Luke Kenneth Casson Leighton from comment #3)
>  107        comb += wb_rd_data.eq((gpio_oe_list[gpio_addr] << OESHIFT)
>  108                           + (gpio_ie_list[gpio_addr] << IESHIFT)
>  109                          + (puen_list[gpio_addr] << PUSHIFT)
>  110                          + (pden_list[gpio_addr] << PDSHIFT)
>  111                          + (gpio_i_list[gpio_addr] << IOSHIFT)
>  112                          + (bank_sel[gpio_addr] << BANKSHIFT))
> this is what Record is for.  one line.

Sure. I looked at Robert's tutorial for Records
and created a Layout and Record:

class CSRLayout(Layout):
    def __init__(self):
            ("oe", unsigned(1)),
            ("ie", unsigned(1)),
            ("puen", unsigned(1)),
            ("pden", unsigned(1)),
            ("io", unsigned(1)),
            ("bank_sel", unsigned(NUMBANKBITS))

class CSRBus(Record):
    def __init__(self):

In the SimpleGPIO module's __init__() method, I added:
self.csrbus = CSRBus()

During the object creation however, I'm getting a TypeError:
Traceback (most recent call last):
  File "simple_gpio.py", line 276, in <module>
  File "simple_gpio.py", line 258, in test_gpio
    dut = SimpleGPIO()
  File "simple_gpio.py", line 68, in __init__
    self.csrbus = CSRBus()
  File "simple_gpio.py", line 49, in __init__
  File "/home/rohdo/src/nmigen/nmigen/hdl/rec.py", line 127, in __init__
    self.layout = Layout.cast(layout, src_loc_at=1 + src_loc_at)
  File "/home/rohdo/src/nmigen/nmigen/hdl/rec.py", line 25, in cast
    return Layout(obj, src_loc_at=1 + src_loc_at)
  File "/home/rohdo/src/nmigen/nmigen/hdl/rec.py", line 29, in __init__
    for field in fields:
TypeError: 'type' object is not iterable

Can you clarify what I'm missing here?

My current commit:

You are receiving this mail because:
You are on the CC list for the bug.

More information about the libre-soc-bugs mailing list