from nmigen.cli import rtlil
from nmutil.plain_data import plain_data
+
class BitwiseMux(Elaboratable):
"""Mux, but treating input/output Signals as bit vectors, rather than
integers. This means each bit in the output is independently multiplexed
vl = rtlil.convert(m)
with open("test_popcount.il", "w") as f:
f.write(vl)
-
def setup(self, m, i):
if self.stage is not None and hasattr(self.stage, "setup"):
- if self.stage is not self: # stop infinite recursion
+ if self.stage is not self: # stop infinite recursion
self.stage.setup(m, i)
def _postprocess(self, i): # XXX DISABLED
def tst_pop_count_int(self, width):
assert isinstance(width, int)
for v in range(1 << width):
- expected = bin(v).count("1") # converts to a string, counts 1s
+ expected = bin(v).count("1") # converts to a string, counts 1s
with self.subTest(v=v, expected=expected):
self.assertEqual(expected, pop_count(v, width=width))