From: Luke Kenneth Casson Leighton Date: Tue, 28 Sep 2021 12:14:10 +0000 (+0100) Subject: remove Mux Value.cast before passing to 1st argument __Mux__ X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3df28b89fb027baba85396e52762b5d766fb0a8b;p=nmigen.git remove Mux Value.cast before passing to 1st argument __Mux__ only one case requires Mux to perform Value.cast, which is when the sel argument is a python bool --- diff --git a/nmigen/hdl/ast.py b/nmigen/hdl/ast.py index 9ddc717..6a1a05e 100644 --- a/nmigen/hdl/ast.py +++ b/nmigen/hdl/ast.py @@ -732,9 +732,8 @@ class Operator(Value): def Mux(sel, val1, val0): - sel = Value.cast(sel) - if len(sel) != 1: - sel = sel.bool() + if isinstance(sel, bool): # one instance where Mux is passed an actual bool + sel = Value.cast(sel) return sel.__Mux__(val1, val0)