From: Luke Kenneth Casson Leighton Date: Thu, 26 Jul 2018 05:54:05 +0000 (+0100) Subject: add external interfaces v2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4e4b994fd56ee498cd8c34fb607b74f19f96866d;p=pinmux.git add external interfaces v2 --- diff --git a/src/bsv/bsv_lib/slow_peripherals_template.bsv b/src/bsv/bsv_lib/slow_peripherals_template.bsv index f03e618..1ed48f8 100644 --- a/src/bsv/bsv_lib/slow_peripherals_template.bsv +++ b/src/bsv/bsv_lib/slow_peripherals_template.bsv @@ -218,8 +218,8 @@ package slow_peripherals; */ endinterface interface iocell_side=pinmux.iocell_side; - interface pad_config0= gpioa.pad_config; {9} +{13} /*===================================*/ endmodule endpackage diff --git a/src/bsv/peripheral_gen/base.py b/src/bsv/peripheral_gen/base.py index cb4eadb..3e6fbde 100644 --- a/src/bsv/peripheral_gen/base.py +++ b/src/bsv/peripheral_gen/base.py @@ -273,6 +273,9 @@ class PBase(object): template = " interface {0}{3} = {2}{1};" return template.format(pname, sname, prefix, suffix) + def extifinstance2(self, name, count): + return '' + def extifinstance(self, name, count): return self._extifinstance(name, count, "", "pinmux.peripheral_side.") @@ -362,7 +365,8 @@ class PeripheralIface(object): self.slow = slow(ifacename) self.slow.peripheral = self for fname in ['slowimport', - 'extfastifinstance', 'extifinstance', 'extifdecl', + 'extfastifinstance', + 'extifinstance2', 'extifinstance', 'extifdecl', 'slowifdecl', 'slowifdeclmux', 'fastifdecl', 'mkslow_peripheral', @@ -424,6 +428,14 @@ class PeripheralInterfaces(object): ret.append(self.data[name].extfastifinstance(name, i)) return '\n'.join(list(filter(None, ret))) + def extifinstance2(self, *args): + ret = [] + for (name, count) in self.ifacecount: + for i in range(count): + iname = self.data[name].iname().format(i) + ret.append(self.data[name].extifinstance2(name, i)) + return '\n'.join(list(filter(None, ret))) + def extifinstance(self, *args): ret = [] for (name, count) in self.ifacecount: diff --git a/src/bsv/peripheral_gen/gpio.py b/src/bsv/peripheral_gen/gpio.py index 2e6f859..6ed41b6 100644 --- a/src/bsv/peripheral_gen/gpio.py +++ b/src/bsv/peripheral_gen/gpio.py @@ -8,10 +8,16 @@ class gpio(PBase): " import mux::*;\n" + \ " import gpio::*;\n" + def extifinstance2(self, name, count): + template = "interface pad_config{0} = {1}.pad_config;" + dname = self.mksuffix(self.name, count) + return template.format(dname, name) + def slowifdeclmux(self, name, count): size = len(self.peripheral.pinspecs) - return " interface GPIO_config#(%d) pad_config%d;" % \ - (size, count) + dname = self.mksuffix(self.name, count) + return "interface GPIO_config#(%d) pad_config%s;" % \ + (size, dname) def num_axi_regs32(self): return 2 diff --git a/src/bsv/pinmux_generator.py b/src/bsv/pinmux_generator.py index 3a9a4a0..8b23f0e 100644 --- a/src/bsv/pinmux_generator.py +++ b/src/bsv/pinmux_generator.py @@ -114,6 +114,7 @@ def write_slow(slow, slowt, p, ifaces, iocells): mkcellcon = ifaces.mk_cellconn() pincon = ifaces.mk_pincon() inst = ifaces.extifinstance() + inst2 = ifaces.extifinstance2() mkplic = ifaces.mk_plic() numsloirqs = ifaces.mk_sloirqsdef() ifacedef = ifaces.mk_ext_ifacedef() @@ -122,7 +123,8 @@ def write_slow(slow, slowt, p, ifaces, iocells): bsv_file.write(slowt.format(imports, ifdecl, regdef, slavedecl, fnaddrmap, mkslow, mkcon, mkcellcon, pincon, inst, mkplic, - numsloirqs, ifacedef)) + numsloirqs, ifacedef, + inst2)) def write_soc(soc, soct, p, ifaces, iocells): """ write out the soc.bsv file.