From 3df28b89fb027baba85396e52762b5d766fb0a8b Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 28 Sep 2021 13:14:10 +0100 Subject: [PATCH] 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 --- nmigen/hdl/ast.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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) -- 2.30.2