redo mkpincon for fast names
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 28 Jul 2018 09:52:08 +0000 (10:52 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 28 Jul 2018 09:52:08 +0000 (10:52 +0100)
src/bsv/peripheral_gen/base.py
src/bsv/peripheral_gen/flexbus.py
src/bsv/pinmux_generator.py

index c62a492a2451241207940f5fc213185a265c4626..ad863de2ba7722a61a3897e6207778980cc7317e 100644 (file)
@@ -135,7 +135,7 @@ if(addr>=`{0} && addr<=`{1})
 else"""
         return template.format(bname, bend, name)
 
-    def mk_pincon(self, name, count):
+    def _mk_pincon(self, name, count, ptyp):
         # TODO: really should be using bsv.interface_decl.Interfaces
         # pin-naming rules.... logic here is hard-coded to duplicate
         # it (see Interface.__init__ outen)
@@ -146,9 +146,14 @@ else"""
             #n = "{0}{1}".format(self.name, self.mksuffix(name, count))
             n = name  # "{0}{1}".format(self.name, self.mksuffix(name, count))
             ret.append("//%s %s" % (n, str(p)))
-            sname = self.peripheral.iname().format(count)
-            sname = "{0}.{1}".format(sname, pname)
-            ps = "pinmux.peripheral_side.%s" % sname
+            if ptyp == 'fast':
+                sname = self.get_iname(count)
+                sname = "{0}.{1}".format(sname, pname)
+                ps = "slow_peripherals.%s" % sname
+            else:
+                sname = self.peripheral.iname().format(count)
+                sname = "{0}.{1}".format(sname, pname)
+                ps = "pinmux.peripheral_side.%s" % sname
             if typ == 'out' or typ == 'inout':
                 fname = self.pinname_out(pname)
                 if not n.startswith('gpio'):  # XXX EURGH! horrible hack
@@ -379,7 +384,7 @@ class PeripheralIface(object):
                       'mk_dma_sync', 'mk_dma_connect', 'mk_dma_rule',
                       'mkfast_peripheral',
                       'mk_plic', 'mk_ext_ifacedef',
-                      'mk_connection', 'mk_cellconn', 'mk_pincon']:
+                      'mk_connection', 'mk_cellconn', '_mk_pincon']:
             fn = CallFn(self, fname)
             setattr(self, fname, types.MethodType(fn, self))
 
@@ -631,12 +636,18 @@ class PeripheralInterfaces(object):
         return li(pinmux_cellrule.format(ret), 4)
 
     def mk_pincon(self):
+        return self._mk_pincon("slow")
+
+    def mk_fast_pincon(self):
+        return self._mk_pincon("fast")
+
+    def _mk_pincon(self, typ):
         ret = []
         for (name, count) in self.ifacecount:
             for i in range(count):
                 if self.is_on_fastbus(name, i):
                     continue
-                txt = self.data[name].mk_pincon(name, i)
+                txt = self.data[name]._mk_pincon(name, i, typ)
                 ret.append(txt)
         return '\n'.join(li(list(filter(None, ret)), 4))
 
index 074e84366c05d9150922a350f522564c1941d61e..33fb61f10582a5cab431f78d39ecb44ffea74f89 100644 (file)
@@ -34,14 +34,16 @@ class flexbus(PBase):
                 'rw': 'flexbus_side.m_R_Wn',
                 }.get(pname, '')
 
-    def mk_pincon(self, name, count):
-        ret = [PBase.mk_pincon(self, name, count)]
+    def _mk_pincon(self, name, count, typ):
+        ret = [PBase._mk_pincon(self, name, count, typ)]
         # special-case for gpio in, store in a temporary vector
         plen = len(self.peripheral.pinspecs)
         template = "mkConnection({0}.{3},\n\t\t\t{2}.flexbus_side.{1});"
-        sname = self.peripheral.iname().format(count)
+        sname = self.get_iname(count)
+        # SLOW -->sname = self.peripheral.iname().format(count)
         name = self.get_iname(count)
-        ps = "pinmux.peripheral_side.%s" % sname
+        assert typ == 'fast' # TODO slow?
+        ps = "slow_peripherals.%s" % sname
         n = "{0}".format(name)
         for stype, ptype in [
             ('cs', 'm_FBCSn'),
index 83e0e0efb9fe1c7604932c1affdd2ed8b62cbc95..77300c6673e1e867a7b30f91c72d5208a3efa299 100644 (file)
@@ -152,7 +152,7 @@ def write_soc(soc, soct, fastmf, fastmt, p, ifaces, iocells):
     mkfast = ifaces.mkfast_peripheral()
     mkcon = ifaces.mk_fast_connection()
     mkcellcon = ifaces.mk_cellconn()
-    pincon = ifaces.mk_pincon()
+    pincon = ifaces.mk_fast_pincon()
     inst = ifaces.extfastifinstance()
     mkplic = ifaces.mk_plic()
     numsloirqs = ifaces.mk_sloirqsdef()