hdl.ast: cast Mux() selector to bool if it is not a 1-bit value.

Fixes #232.
This commit is contained in:
whitequark 2019-09-23 13:39:31 +00:00
parent 7777b7b98c
commit b227352258
2 changed files with 7 additions and 0 deletions

View file

@ -523,6 +523,8 @@ def Mux(sel, val1, val0):
Value, out
Output ``Value``. If ``sel`` is asserted, the Mux returns ``val1``, else ``val0``.
"""
if len(sel) != 1:
sel = Value.wrap(sel).bool()
return Operator("m", [sel, val1, val0])