From adfe1c44c9492c7fab632f257fe5353dca1a59ce Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 24 Jan 2022 16:42:57 +0000 Subject: [PATCH] add GPIO mux bank select, pullup and pulldown to IOConn layout as optional features --- c4m/nmigen/jtag/tap.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/c4m/nmigen/jtag/tap.py b/c4m/nmigen/jtag/tap.py index 1f3d424..18d8c5d 100755 --- a/c4m/nmigen/jtag/tap.py +++ b/c4m/nmigen/jtag/tap.py @@ -192,9 +192,13 @@ class IOConn(Record): Input to pad with pad output value. oe: Signal(1), present only for IOType.TriOut and IOType.InTriOut. Input to pad with pad output enable value. + + bank select, pullup and pulldown may also be optionally added to + both core and pad + """ @staticmethod - def layout(iotype): + def layout(iotype, banksel=0, pullup=False, pulldown=False): sigs = [] if iotype in (IOType.In, IOType.InTriOut): sigs.append(("i", 1)) @@ -202,14 +206,24 @@ class IOConn(Record): sigs.append(("o", 1)) if iotype in (IOType.TriOut, IOType.InTriOut): sigs.append(("oe", 1)) + if banksel > 0: + sigs.append(("sel", banksel)) + if pullup: + sigs.append(("pu", 1)) + if pulldown: + sigs.append(("pd", 1)) return Layout((("core", sigs), ("pad", sigs))) - def __init__(self, *, iotype, name=None, src_loc_at=0): - super().__init__(self.__class__.layout(iotype), name=name, - src_loc_at=src_loc_at+1) + def __init__(self, *, iotype, name=None, src_loc_at=0, + banksel=0, pullup=False, pulldown=False): + layout = self.__class__.layout(iotype, banksel, pullup, pulldown) + super().__init__(layout, name=name, src_loc_at=src_loc_at+1) self._iotype = iotype + self._banksel = banksel + self._pullup = pullup + self._pulldown = pulldown class _IDBypassBlock(Elaboratable): -- 2.30.2