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

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Mon Nov 29 17:28:17 GMT 2021


https://bugs.libre-soc.org/show_bug.cgi?id=50

--- Comment #55 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(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?

> 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().

> 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
+

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


More information about the libre-soc-bugs mailing list