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

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Mon Nov 29 21:40:41 GMT 2021


--- Comment #56 from andrey at technepisteme.xyz ---
Created attachment 148
  --> https://bugs.libre-soc.org/attachment.cgi?id=148&action=edit
Sim showing GPIO 2 and 3 o/oe signals switching

(In reply to Luke Kenneth Casson Leighton from comment #55)
> (In reply to andrey from comment #54)
> > AttributeError: 'Blinker' object has no attribute 'gpio0_o'
> this is perfectly correct.  you have not added an object named
> "gpio0_o" inside the Blinker class: why would you be surprised
> that it does not exist?
Due to not really understanding the topology, my brain basically switched off.

Now it makes sense though, given that the gpio object was not a public

Also in regards to topology, the "gpio" object seems to me to be a core side
block (thus you can control the o/oe signals). Is there a corresponding "pad"
object (which would allow me to control the i signal)?

> > I thought the GPIO block is accessible as an attribute of top module.
> to the nmigen *AST*, yes.  but you are not directly accessng the
> AST, here, you are accessing the python object named "top" which
> happens to be an instance of Blinker().
I seem to remember you talking about AST and then some other object after the
AST step, but this escaped me.

> > What is the correct way to access the GPIO signals in the test?
> first add the GPIO signals to the class instance so that they are
> publicly accessible!
> +++ b/src/spec/testing_stage1.py
> @@ -172,6 +172,10 @@ class Blinker(Elaboratable):
>          m.d.comb += uart.tx.eq(intermediary)
>          m.d.comb += intermediary.eq(uart.rx)
> +        # to even be able to get at objects, you first have to make them
> +        # available - i.e. not as local variables
> +        self.gpio = gpio
> +
I'm able to control o and oe signals by using top.gpio.gpio2.oe (for example),
which is a great step forward.
Not sure how to control the i signal, but I'm using your print method for
seeing the objects contained in JTAG, and I'll try to figure it out tomorrow.

Made uart signals public by writing
self.uart = uart
Tried to control the rx, (as in this example, rx sets "intermediary" signal,
which then sets tx), but not working. I'm guessing this is a similar issue I
have with gpio i where I'm trying to drive the wrong signal.

You can see the GPIO 2 and 3 outputs being toggled in the attached screenshot

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

More information about the libre-soc-bugs mailing list