hdl.ast: cast Mux() selector to bool if it is not a 1-bit value.
Fixes #232.
This commit is contained in:
parent
7777b7b98c
commit
b227352258
2 changed files with 7 additions and 0 deletions
|
|
@ -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])
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue