From: Luke Kenneth Casson Leighton Date: Wed, 25 Jul 2018 10:17:13 +0000 (+0100) Subject: add mkconnection to fast axi slaves X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5533a3252213251591833588f5679be976dd288e;p=pinmux.git add mkconnection to fast axi slaves --- diff --git a/src/bsv/bsv_lib/soc_template.bsv b/src/bsv/bsv_lib/soc_template.bsv index 0e48a0e..94ceec0 100644 --- a/src/bsv/bsv_lib/soc_template.bsv +++ b/src/bsv/bsv_lib/soc_template.bsv @@ -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 diff --git a/src/bsv/peripheral_gen/base.py b/src/bsv/peripheral_gen/base.py index ef8f881..6d680f6 100644 --- a/src/bsv/peripheral_gen/base.py +++ b/src/bsv/peripheral_gen/base.py @@ -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 diff --git a/src/bsv/peripheral_gen/eint.py b/src/bsv/peripheral_gen/eint.py index e67aa8e..3e25401 100644 --- a/src/bsv/peripheral_gen/eint.py +++ b/src/bsv/peripheral_gen/eint.py @@ -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): diff --git a/src/bsv/peripheral_gen/gpio.py b/src/bsv/peripheral_gen/gpio.py index 90671a5..2e6f859 100644 --- a/src/bsv/peripheral_gen/gpio.py +++ b/src/bsv/peripheral_gen/gpio.py @@ -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): diff --git a/src/bsv/pinmux_generator.py b/src/bsv/pinmux_generator.py index 85a81a5..485e180 100644 --- a/src/bsv/pinmux_generator.py +++ b/src/bsv/pinmux_generator.py @@ -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,