add mkconnection to fast axi slaves
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 25 Jul 2018 10:17:13 +0000 (11:17 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 25 Jul 2018 10:17:13 +0000 (11:17 +0100)
src/bsv/bsv_lib/soc_template.bsv
src/bsv/peripheral_gen/base.py
src/bsv/peripheral_gen/eint.py
src/bsv/peripheral_gen/gpio.py
src/bsv/pinmux_generator.py

index 0e48a0e0a15f091f54a7ca54127bad2179494941..94ceec08b7fdab7bfdcb42d8a3c318b23b69c2f4 100644 (file)
@@ -200,6 +200,10 @@ package Soc;
                        `ifdef FlexBus
                                mkConnection (fabric.v_to_slaves[fromInteger(valueOf(FlexBus_slave_num))],flexbus.axi_side);
                        `endif
+
+// fabric connections
+{5}
+
                        `ifdef DMA
                        //rule to connect all interrupt lines to the DMA
                        //All the interrupt lines to DMA are active HIGH. For peripherals that are not connected, or those which do not
index ef8f881cc42b08c5db3b3e086489a3fce83def1b..6d680f60df1754b980e044c2421d042131a08171 100644 (file)
@@ -134,7 +134,17 @@ class PBase(object):
     def mksuffix(self, name, i):
         return i
 
-    def __mk_connection(self, con, aname):
+    def __mk_connection(self, con, aname, fabricname):
+        txt = "        mkConnection ({2}.v_to_slaves\n" + \
+            "                    [fromInteger(valueOf({1}))],\n" + \
+            "                    {0});"
+
+        print "PBase __mk_connection", self.name, aname
+        if not con:
+            return ''
+        return txt.format(con, aname, fabricname)
+
+    def __mk_master_connection(self, con, aname):
         txt = "        mkConnection (slow_fabric.v_to_slaves\n" + \
             "                    [fromInteger(valueOf({1}))],\n" + \
             "                    {0});"
@@ -144,15 +154,15 @@ class PBase(object):
             return ''
         return txt.format(con, aname)
 
-    def mk_connection(self, count, name=None):
+    def mk_connection(self, count, fabricname, typ, name=None):
         if name is None:
             name = self.name
         print "PBase mk_conn", self.name, count
-        aname = self.axi_slave_name(name, count)
+        aname = self.axi_slave_name(name, count, typ)
         #dname = self.mksuffix(name, count)
         #dname = "{0}{1}".format(name, dname)
         con = self._mk_connection(name, count).format(count, aname)
-        return self.__mk_connection(con, aname)
+        return self.__mk_connection(con, aname, fabricname)
 
     def _mk_connection(self, name=None, count=0):
         return ''
@@ -441,13 +451,26 @@ class PeripheralInterfaces(object):
                 ret.append(x.format(suffix))
         return '\n'.join(list(filter(None, ret)))
 
+    def mk_fast_connection(self, *args):
+        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_connection(i, "fabric", "fast")
+                if name == 'gpioa':
+                    print "txt", txt
+                    print self.data[name].mk_connection
+                ret.append(txt)
+        return '\n'.join(list(filter(None, ret)))
+
     def mk_connection(self, *args):
         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_connection(i)
+                txt = self.data[name].mk_connection(i, "slow_fabric", "")
                 if name == 'gpioa':
                     print "txt", txt
                     print self.data[name].mk_connection
index e67aa8e559d92f9cddcacc7475e48b45742d564e..3e25401bb20236dde9768d9f02efdc321a46ec17 100644 (file)
@@ -11,7 +11,7 @@ class eint(PBase):
         size = len(self.peripheral.pinspecs)
         return "        Wire#(Bit#(%d)) wr_interrupt <- mkWire();" % size
 
-    def axi_slave_name(self, name, ifacenum):
+    def axi_slave_name(self, name, ifacenum, typ=''):
         return ''
 
     def axi_slave_idx(self, idx, name, ifacenum, typ):
index 90671a569a0ec586cb639526f066be117565af6e..2e6f859c3871deea702f3664ee5c56ac973e47bd 100644 (file)
@@ -34,12 +34,12 @@ class gpio(PBase):
         return "        MUX#(%d) mux{0} <- mkmux();\n" % size + \
                "        GPIO#(%d) gpio{0} <- mkgpio();" % size
 
-    def mk_connection(self, count):
+    def mk_connection(self, count, fabricname, typ):
         print "GPIO mk_conn", self.name, count
         res = []
         dname = self.mksuffix(self.name, count)
         for i, n in enumerate(['gpio' + dname, 'mux' + dname]):
-            res.append(PBase.mk_connection(self, count, n))
+            res.append(PBase.mk_connection(self, count, fabricname, typ, n))
         return '\n'.join(res)
 
     def _mk_connection(self, name=None, count=0):
index 85a81a51ef6e79ef5e20b24b4af7da91e724d805..485e1807e20c84b086ad1ab0178e17e0e20277e0 100644 (file)
@@ -138,7 +138,7 @@ def write_soc(soc, soct, p, ifaces, iocells):
     mastdecl = ifaces.axi_master_idx()
     fnaddrmap = ifaces.axi_addr_map()
     mkfast = ifaces.mkfast_peripheral()
-    mkcon = ifaces.mk_connection()
+    mkcon = ifaces.mk_fast_connection()
     mkcellcon = ifaces.mk_cellconn()
     pincon = ifaces.mk_pincon()
     inst = ifaces.extifinstance()
@@ -148,7 +148,7 @@ def write_soc(soc, soct, p, ifaces, iocells):
     ifacedef = ifaces.mk_ext_ifacedef()
     with open(soc, "w") as bsv_file:
         bsv_file.write(soct.format(imports, ifdecl, mkfast,
-                            slavedecl, mastdecl,
+                            slavedecl, mastdecl, mkcon,
                             #'', '' #regdef, slavedecl,
                             #'', mkslow, #fnaddrmap, mkslow, mkcon, mkcellcon,
                             #pincon, inst, mkplic,