diff --git a/prjxray/util.py b/prjxray/util.py index 60f1c46f..09377c83 100644 --- a/prjxray/util.py +++ b/prjxray/util.py @@ -74,6 +74,7 @@ def db_root_arg(parser): def parse_db_line(line): + '''Return tag name, bit values (if any), mode (if any)''' parts = line.split() # Ex: CLBLL_L.SLICEL_X0.AMUX.A5Q assert len(parts), "Empty line" @@ -84,11 +85,12 @@ def parse_db_line(line): tag), "Invalid tag name: %s, line: %s" % (tag, line) orig_bits = line.replace(tag + " ", "") # <0 candidates> etc - if "<" in orig_bits: - return tag, set(), orig_bits + # Ex: INT_L.BYP_BOUNCE5.BYP_ALT5 always + if "<" in orig_bits or "always" == orig_bits: + return tag, None, orig_bits - # Ex: !30_06 !30_08 !30_11 30_07 bits = frozenset(parts[1:]) + # Ex: CLBLL_L.SLICEL_X0.AOUTMUX.A5Q !30_06 !30_08 !30_11 30_07 for bit in bits: # 19_39 # 100_319 diff --git a/utils/parsedb.py b/utils/parsedb.py index 011a5ab2..b24ad42f 100755 --- a/utils/parsedb.py +++ b/utils/parsedb.py @@ -16,7 +16,8 @@ def run(fnin, fnout=None, strict=False, verbose=False): continue tag, bits, mode = util.parse_db_line(line) if strict: - assert not mode, "strict: got ill defined line: %s" % (line, ) + if mode != "always": + assert not mode, "strict: got ill defined line: %s" % (line, ) if tag in tags: print("Original line: %s" % tags[tag]) print("New line: %s" % line) @@ -24,7 +25,8 @@ def run(fnin, fnout=None, strict=False, verbose=False): assert bits not in bitss, "strict: got duplicate bits %s (ex: %s)" % ( bits, line) tags[tag] = line - bitss.add(bits) + if bits != None: + bitss.add(bits) if fnout: with open(fnout, "w") as fout: