aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim 'mithro' Ansell <me@mith.ro>2018-06-04 23:52:17 -0700
committerTim 'mithro' Ansell <me@mith.ro>2018-06-04 23:57:36 -0700
commiteb9947d3da711adcef9ae3444a288a44b8d05952 (patch)
treef42c89607963092d8146c450685614c1e7a51f06
parent3021d8c1fb910bc9c4270d463114f3600ccbb0bf (diff)
downloadicestorm-eb9947d3da711adcef9ae3444a288a44b8d05952.tar.gz
icestorm-eb9947d3da711adcef9ae3444a288a44b8d05952.tar.bz2
icestorm-eb9947d3da711adcef9ae3444a288a44b8d05952.zip
Improve error message.
Now; ----------------- Parse error in line 364: span4_y9_g7_10 <-> span4_x3_g13_5 conflicting bits ['!B12[8]', '!B12[9]', 'B12[10]'] setting:{(12, 10)} - current clear:{(12, 10), (12, 8)} clearing:{(12, 9), (12, 8)} - current set :{(12, 9)} ----------------- Previously; ----------------- File "icebox_hlc2asc.py", line 742, in apply_directive self.set_bits(bits) File "icebox_hlc2asc.py", line 762, in set_bits raise ParseError("conflicting bits") TypeError: __init__() takes 1 positional argument but 2 were given -----------------
-rwxr-xr-xicebox/icebox_hlc2asc.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/icebox/icebox_hlc2asc.py b/icebox/icebox_hlc2asc.py
index 3f3df90..54c9dc0 100755
--- a/icebox/icebox_hlc2asc.py
+++ b/icebox/icebox_hlc2asc.py
@@ -509,7 +509,6 @@ def logic_expression_to_lut(s, args):
for j in range(len(args)))) else '0'
for i in range(1 << len(args)))
-
class ParseError(Exception):
pass
@@ -749,11 +748,19 @@ class Tile:
bits_set.add((int(match.group(2)), int(match.group(3))))
if set.intersection(bits_set, bits_clear):
- raise ValueError("trying to set/clear the same bit(s) at once")
+ raise ValueError(
+ "trying to set/clear the same bit(s) at once set:{} clear:{}".format(
+ bits_set, bits_clear))
if set.intersection(bits_set, self.bits_cleared) or \
set.intersection(bits_clear, self.bits_set):
- raise ParseError("conflicting bits")
+ raise ParseError("""\
+conflicting bits {}
+ setting:{:<30} - current clear:{}
+clearing:{:<30} - current set :{}""".format(
+ bits,
+ str(bits_set), self.bits_cleared,
+ str(bits_clear), self.bits_set))
self.bits_set.update(bits_set)
self.bits_cleared.update(bits_clear)