From 72918b79e3d9205991ce046f8e2977060725f333 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 227bf60..7b1fd8f 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