From: Luke Kenneth Casson Leighton Date: Mon, 30 Jul 2018 10:23:48 +0000 (+0100) Subject: add master connection X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3efb5c06f9926f2b6fdd851230e7fcc5d6a0a7ee;p=pinmux.git add master connection --- diff --git a/src/bsv/bsv_lib/soc_template.bsv b/src/bsv/bsv_lib/soc_template.bsv index 0e0886e..d35faf2 100644 --- a/src/bsv/bsv_lib/soc_template.bsv +++ b/src/bsv/bsv_lib/soc_template.bsv @@ -175,6 +175,7 @@ package socgen; mkConnection (dma.mmu, fabric.v_from_masters [fromInteger(valueOf(DMA_master_num))]); `endif +{13} // Connect fabric to memory slaves diff --git a/src/bsv/peripheral_gen/base.py b/src/bsv/peripheral_gen/base.py index 1892fc1..018015c 100644 --- a/src/bsv/peripheral_gen/base.py +++ b/src/bsv/peripheral_gen/base.py @@ -333,23 +333,30 @@ Ifc_sync#({0}) {1}_sync <-mksyncconnection( 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});" + def __mk_master_connection(self, con, aname, fabricname): + txt = "mkConnection ({0}, {2}.v_from_masters\n" + \ + " [fromInteger(valueOf({1}))]);\n" - print "PBase __mk_connection", self.name, aname + print "PBase __mk_master_connection", self.name, aname if not con: return '' - return txt.format(con, aname) + return txt.format(con, aname, fabricname) + + def mk_master_connection(self, count, fabricname, typ, name=None): + if not self.has_axi_master(): + return '' + if name is None: + name = self.name + print "PBase mk_master_conn", self.name, count + aname = self.axi_master_name(name, count, typ) + con = self._mk_connection(name, count, True).format(count, aname) + return self.__mk_master_connection(con, aname, fabricname) 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, 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, fabricname) @@ -505,7 +512,8 @@ class PeripheralIface(object): 'mkfast_peripheral', 'mk_plic', 'mk_ext_ifacedef', '_mk_clk_con', 'mk_ext_ifacedef', - 'mk_connection', 'mk_cellconn', '_mk_pincon']: + 'mk_connection', 'mk_master_connection', + 'mk_cellconn', '_mk_pincon']: fn = CallFn(self, fname) setattr(self, fname, types.MethodType(fn, self)) @@ -715,31 +723,29 @@ class PeripheralInterfaces(object): ret.append(x.format(suffix)) return '\n'.join(li(list(filter(None, ret)), 8)) - def mk_fast_connection(self, *args): + def _mk_connection(self, fabric, typ, indent, master, *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 master: + txt = self.data[name].mk_master_connection(i, fabric, typ) + else: + txt = self.data[name].mk_connection(i, fabric, typ) if name == 'gpioa': print "txt", txt - print self.data[name].mk_connection ret.append(txt) - return '\n'.join(li(list(filter(None, ret)), 12)) + return '\n'.join(li(list(filter(None, ret)), indent)) + + def mk_master_connection(self, *args): + return self._mk_connection("fabric", "fast", 8, True, *args) + + def mk_fast_connection(self, *args): + return self._mk_connection("fabric", "fast", 12, False, *args) 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, "slow_fabric", "") - if name == 'gpioa': - print "txt", txt - print self.data[name].mk_connection - ret.append(txt) - return '\n'.join(li(list(filter(None, ret)), 8)) + return self._mk_connection("slow_fabric", "", 8, False, *args) def mk_cellconn(self): ret = [] diff --git a/src/bsv/peripheral_gen/rgbttl.py b/src/bsv/peripheral_gen/rgbttl.py index 9c917e7..ca2fbad 100644 --- a/src/bsv/peripheral_gen/rgbttl.py +++ b/src/bsv/peripheral_gen/rgbttl.py @@ -16,7 +16,9 @@ class rgbttl(PBase): sz = len(self.peripheral.pinspecs) - 4 # subtract CK, DE, HS, VS return "Ifc_rgbttl_dummy lcd{0} <- mkrgbttl_dummy();" - def _mk_connection(self, name=None, count=0): + def _mk_connection(self, name=None, count=0, master=False): + if master: + return "lcd{0}.master" return "lcd{0}.slave" def pinname_out(self, pname): diff --git a/src/bsv/pinmux_generator.py b/src/bsv/pinmux_generator.py index 87326a7..b348cf4 100644 --- a/src/bsv/pinmux_generator.py +++ b/src/bsv/pinmux_generator.py @@ -152,6 +152,7 @@ def write_soc(soc, soct, fastmf, fastmt, p, ifaces, iocells): fnaddrmap = ifaces.axi_fastaddr_map() mkfast = ifaces.mkfast_peripheral() mkcon = ifaces.mk_fast_connection() + mkmstcon = ifaces.mk_master_connection() mkcellcon = ifaces.mk_cellconn() pincon = ifaces.mk_fast_pincon() inst = ifaces.extfastifinstance() @@ -169,7 +170,7 @@ def write_soc(soc, soct, fastmf, fastmt, p, ifaces, iocells): slavedecl, mastdecl, mkcon, inst, dma, num_dmachannels, pincon, regdef, fnaddrmap, - clockcon, + clockcon, mkmstcon, )) with open(fastmf, "w") as bsv_file: