From: Luke Kenneth Casson Leighton Date: Mon, 23 Jul 2018 12:28:13 +0000 (+0100) Subject: sort out mkConnection for gpio vectorised X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=526c16d0f57f404bb08485e337d2fd98b881f6ed;p=pinmux.git sort out mkConnection for gpio vectorised --- diff --git a/src/bsv/interface_decl.py b/src/bsv/interface_decl.py index 281c6c3..e535db1 100644 --- a/src/bsv/interface_decl.py +++ b/src/bsv/interface_decl.py @@ -373,7 +373,7 @@ class InterfaceGPIO(Interface): def ifacepfmt(self, *args): return """ interface Put#(Vector#({0}, Bit#(1))) out; - interface Put#(Vector#({0}, Bit#(1))) outen; + interface Put#(Vector#({0}, Bit#(1))) out_en; interface Get#(Vector#({0}, Bit#(1))) in; """.format(len(self.pinspecs)) @@ -398,7 +398,7 @@ class InterfaceGPIO(Interface): {1} endmethod endinterface; - interface outen = interface Put#({0}) + interface out_en = interface Put#({0}) method Action put(Vector#({0},Bit#(1)) in); {2} endmethod diff --git a/src/bsv/peripheral_gen/gpio.py b/src/bsv/peripheral_gen/gpio.py index 93dcd3b..222f144 100644 --- a/src/bsv/peripheral_gen/gpio.py +++ b/src/bsv/peripheral_gen/gpio.py @@ -68,19 +68,13 @@ class gpio(PBase): return "func.gpio_out_en[{0}]".format(pname[1:]) def mk_pincon(self, name, count): - ret = [PBase.mk_pincon(self, name, count)] + #ret = [PBase.mk_pincon(self, name, count)] # special-case for gpio in, store in a temporary vector + ret = [] plen = len(self.peripheral.pinspecs) - ret.append(" rule con_%s%d_in;" % (name, count)) - ret.append(" Vector#({0},Bit#(1)) temp;".format(plen)) - for p in self.peripheral.pinspecs: - typ = p['type'] - pname = p['name'] - idx = pname[1:] - n = name - sname = self.peripheral.pname(pname).format(count) - ps = "pinmux.peripheral_side.%s_in" % sname - ret.append(" temp[{0}]={1};".format(idx, ps)) - ret.append(" {0}.func.gpio_in(temp);".format(name)) - ret.append(" endrule") + template = " mkConnection({0}_{1},\n\t\t\t{2}_{1});" + ps = "pinmux.peripheral_side.%s" % name + n = "{0}.func.gpio".format(name) + for ptype in ['out', 'out_en', 'in']: + ret.append(template.format(ps, ptype, n)) return '\n'.join(ret)