Skip to content

Commit 3aaed1f

Browse files
committed
Remove 64-bit limitation from Compiler
1 parent c421ebd commit 3aaed1f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

snakehdl/compilers/compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _toposort(self, op: BOp, seen: set[BOp]) -> None:
6060
def _assign_bits(self, op: BOp) -> int:
6161
if op.op is BOps.INPUT or op.op is BOps.CONST:
6262
if op._bits is None: raise RuntimeError(f'{op.op} missing bits\n' + str(op))
63-
if op._bits < 1 or op._bits > 64: raise RuntimeError(f'{op.op} bits must be 1-64\n' + str(op))
63+
if op._bits < 1: raise RuntimeError(f'{op.op} bits must be > 0\n' + str(op))
6464
return op._bits
6565
elif op.op is BOps.BIT:
6666
res = self._assign_bits(op.src[0])

tests/test_compiler.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ def test_validation_input_missing_label(self):
269269
with pytest.raises(RuntimeError):
270270
PythonCompiler(output(a=input_bits(None))).compile()
271271

272+
def test_validation_bits(self):
273+
with pytest.raises(RuntimeError):
274+
PythonCompiler(output(a=const_bits(0, 0))).compile()
275+
272276
class TestOptimizations:
273277
def test_opt_populate_shared(self):
274278
x = xor(input_bits('a'), input_bits('b'))

0 commit comments

Comments
 (0)