From 80b206b500c0b43d2708ef4aaa800e80a29222a1 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 28 Jul 2018 10:52:08 +0100 Subject: [PATCH] redo mkpincon for fast names --- src/bsv/peripheral_gen/base.py | 23 +++++++++++++++++------ src/bsv/peripheral_gen/flexbus.py | 10 ++++++---- src/bsv/pinmux_generator.py | 2 +- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/bsv/peripheral_gen/base.py b/src/bsv/peripheral_gen/base.py index c62a492..ad863de 100644 --- a/src/bsv/peripheral_gen/base.py +++ b/src/bsv/peripheral_gen/base.py @@ -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)) diff --git a/src/bsv/peripheral_gen/flexbus.py b/src/bsv/peripheral_gen/flexbus.py index 074e843..33fb61f 100644 --- a/src/bsv/peripheral_gen/flexbus.py +++ b/src/bsv/peripheral_gen/flexbus.py @@ -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'), diff --git a/src/bsv/pinmux_generator.py b/src/bsv/pinmux_generator.py index 83e0e0e..77300c6 100644 --- a/src/bsv/pinmux_generator.py +++ b/src/bsv/pinmux_generator.py @@ -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() -- 2.30.2