From 6abb5547b866973e1e0df49b56b965d905c89c88 Mon Sep 17 00:00:00 2001 From: John McMaster Date: Fri, 8 Dec 2017 11:03:41 -0800 Subject: [PATCH] vtemplate update Signed-off-by: John McMaster Signed-off-by: Tim 'mithro' Ansell --- utils/vtemplate | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/utils/vtemplate b/utils/vtemplate index 8143da2f..a847ea30 100755 --- a/utils/vtemplate +++ b/utils/vtemplate @@ -22,22 +22,38 @@ for l in txt.split('\n'): # input CLKARDCLK, # input [13:0] ADDRARDADDR, # output [1:0] DOPBDOP - m = re.match(r'(input|output)( \[([0-9]*):([0:9]*)\] | )([a-zA-Z0-9_]+)', l) + m = re.match(r'(input|output)( \[([0-9]*):([0:9]*)\] | )([a-zA-Z0-9_ ,]+)', l) if m: - name = m.group(5) + names = m.group(5) aio = m.group(1) + + for name in names.split(','): + name = name.strip() + if not name: + continue + wout = None + width = m.group(2).strip() + if width: + mw = re.match(r'\[([0-9]*):([0:9]*)\]', width) + wl = int(mw.group(1)) + wr = int(mw.group(2)) + wout = (wl, wr) - wout = None - width = m.group(2).strip() - if width: - mw = re.match(r'\[([0-9]*):([0:9]*)\]', width) - wl = int(mw.group(1)) - wr = int(mw.group(2)) - wout = (wl, wr) - - ios.append((name, aio, wout)) + ios.append((name, aio, wout)) continue + # output DPO, SPO, + # input D, WCLK, WE, + m = re.match(r'(input|output)(.*)', l) + if m: + aio = m.group(1) + wout = None + for name in m.group(2).split(','): + name = name.strip() + if not name: + continue + ios.append((name, aio, wout)) + # parameter SIM_DEVICE = "VIRTEX6"; m = re.match(r'parameter([ ])([a-zA-Z0-9_]+) = (.+);', l) if m: @@ -49,6 +65,8 @@ for l in txt.split('\n'): params.append((name, wout, defval)) + # input A0, A1, A2, A3, A4, A5, D, WCLK, WE; + modinst = modname print '''\