From: Luke Kenneth Casson Leighton Date: Mon, 22 Mar 2021 12:51:02 +0000 (+0000) Subject: sort out naming of IOpads for bi-directional pins X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cba78e3d60e6f67ce99adbdcbf6a09f9728dc849;p=libresoc-litex.git sort out naming of IOpads for bi-directional pins --- diff --git a/libresoc/core.py b/libresoc/core.py index aa178c3..db16aef 100644 --- a/libresoc/core.py +++ b/libresoc/core.py @@ -48,6 +48,9 @@ def make_pad(res, dirn, name, suffix, cpup, iop): res[cname], res[pname] = cpup, iop def get_field(rec, name): + for f in rec.layout: + f = f[0] + print ("get_field", f, name) for f in rec.layout: f = f[0] if f.endswith(name): @@ -64,6 +67,7 @@ def make_jtag_ioconn(res, pin, cpupads, iopads): else: cpu = cpupads[fn] io = iopads[fn] + print ("make_jtag_ioconn", scan_idx) print ("cpupads", cpupads) print ("iopads", iopads) print ("pin", fn, pin, iotype, pin_name) @@ -107,18 +111,26 @@ def make_jtag_ioconn(res, pin, cpupads, iopads): if fn == 'gpio': # sigh decode GPIO special-case idx = int(pin[1:]) oe_idx = idx - elif fn == 'sdr': # sigh + pfx = '' + elif fn.startswith('sd') and pin.startswith('data'): + idx = int(pin[-1]) + oe_idx = 0 + pfx = pin[:-1]+"_" + elif fn == 'sdr': idx = int(pin.split('_')[-1]) oe_idx = 0 + pfx = pin.split('_')[0]+"_" else: idx = 0 oe_idx = 0 + pfx = pin+"_" print ("gpio tri", fn, pin, iotype, pin_name, scan_idx, idx) - cpup, iop = get_field(cpu, "i")[idx], get_field(io, "i")[idx] - make_pad(res, True, name, "i", cpup, iop) - cpup, iop = get_field(cpu, "o")[idx], get_field(io, "o")[idx] + cpup, iop = get_field(cpu, pfx+"i")[idx], get_field(io, pfx+"i")[idx] + make_pad(res, False, name, "i", cpup, iop) + cpup, iop = get_field(cpu, pfx+"o")[idx], get_field(io, pfx+"o")[idx] make_pad(res, True, name, "o", cpup, iop) - cpup, iop = get_field(cpu, "oe")[oe_idx], get_field(io, "oe")[oe_idx] + cpup, iop = get_field(cpu, pfx+"oe")[oe_idx], \ + get_field(io, pfx+"oe")[oe_idx] make_pad(res, True, name, "oe", cpup, iop) if iotype in (IOType.In, IOType.InTriOut):