read config mux and output to slow_peripherals.bsv
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 3 Aug 2018 06:47:33 +0000 (07:47 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 3 Aug 2018 06:47:33 +0000 (07:47 +0100)
src/bsv/peripheral_gen/gpio.py

index b9f8504d7a6f1c626207e22e0d00af3289c3bddc..095d654e5a07ce359473a49b4cc1695b9f84434b 100644 (file)
@@ -36,8 +36,10 @@ class gpio(PBase):
 
     def mkslow_peripheral(self, size=0):
         print "gpioslow", self.peripheral, dir(self.peripheral)
+        print "gpioslow", self.peripheral.configs
         size = len(self.peripheral.pinspecs)
-        dflt = "%s" % ("0"*size*2) # XX TODO: read default from config
+        dflt_ = "%s" % ("0"*size*2) # default if not set in spec
+        dflt = self.peripheral.configs[0].get("muxconfig", dflt_)
         return "MUX#(%d) mux{0} <- mkmux(`b%s);\n" % (size, dflt)+ \
                "GPIO#(%d) gpio{0} <- mkgpio();" % size