[Libre-soc-bugs] [Bug 50] nmigen pinmux

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Mon Nov 15 22:21:26 GMT 2021


--- Comment #32 from andrey at technepisteme.xyz ---
(In reply to Luke Kenneth Casson Leighton from comment #31)
> (In reply to andrey from comment #30)
> i just realised though, that returning $tristate has to go.  $tristate
> is exactly the same as if this was a single FPGA endpoint. that is precisely
> and exactly what we do not want.

> now, in some distant future version we might actually want to output
> $IOcell from C4M FlexLib IO package, but not right now, because it is
> coriolis2 that is taking care of the IOPad cell allocation, and for
> that to work, it has to have the triple signals: i, o and oe.
Makes sense.

I made a naive modification, connecting the pin.i/o/oe straight to port.i/o/oe
(or through the JTAG block):
if pin.name in ['clk_0', 'rst_0']: # sigh
    print("No JTAG chain in-between")
    # Can port's i/o/oe be accessed like this?
    m.d.comb += port.o.eq(pin.o)
    m.d.comb += port.oe.eq(pin.oe)
    m.d.comb += pin.i.eq(port.i)
    return m
(res, pin, port, attrs) = self.padlookup[pin.name]
io = self.jtag.ios[pin.name]
m.d.comb += io.core.o.eq(pin.o)
m.d.comb += io.core.oe.eq(pin.oe)
m.d.comb += pin.i.eq(io.core.i)
m.d.comb += io.pad.i.eq(port.i)
m.d.comb += port.o.eq(io.pad.o)
m.d.comb += port.oe.eq(io.pad.oe)

However, I'm getting an AttributeError about a missing "i" signal:
Traceback (most recent call last):
  File "testing_stage1.py", line 353, in <module>
  File "/home/rohdo/work/nmigen/nmigen/build/plat.py", line 95, in build
    plan = self.prepare(elaboratable, name, **kwargs)
  File "/home/rohdo/work/nmigen/nmigen/build/plat.py", line 152, in prepare
    add_pin_fragment(pin, self.get_tristate(pin, port, attrs, invert))
  File "testing_stage1.py", line 300, in get_tristate
    m.d.comb += pin.i.eq(io.core.i)
  File "/home/rohdo/work/nmigen/nmigen/hdl/rec.py", line 146, in __getattr__
    return self[name]
  File "/home/rohdo/work/nmigen/nmigen/hdl/rec.py", line 158, in __getitem__
    .format(reference, item, ", ".join(self.fields))) from None
AttributeError: Record 'gpio_0__gpio0__oe' does not have a field 'i'. Did you
mean one of: o, oe?

Not sure of how to access the port's i,o,oe signals. Looks like there are only
"i" OR "o/oe" gpios types only, I guess something hasn't been configured

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

More information about the libre-soc-bugs mailing list