Value, out
Output ``Value``. If ``sel`` is asserted, the Mux returns ``val1``, else ``val0``.
"""
+ sel = Value.wrap(sel)
if len(sel) != 1:
- sel = Value.wrap(sel).bool()
+ sel = sel.bool()
return Operator("m", [sel, val1, val0])
v = Mux(s, Const(0, (4, False)), Const(0, (6, False)))
self.assertEqual(repr(v), "(m (b (const 3'd4)) (const 4'd0) (const 6'd0))")
+ def test_mux_bool(self):
+ v = Mux(True, Const(0), Const(0))
+ self.assertEqual(repr(v), "(m (const 1'd1) (const 1'd0) (const 1'd0))")
+
def test_bool(self):
v = Const(0).bool()
self.assertEqual(repr(v), "(b (const 1'd0))")