diff --git a/netlist.cc b/netlist.cc index c77f9ff1c..07bce2e7e 100644 --- a/netlist.cc +++ b/netlist.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 1998-2024 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -3270,6 +3270,17 @@ static void check_for_bin_synth(const NetExpr*left,const NetExpr*right, const NetESignal*lsig = dynamic_cast(left); const NetESignal*rsig = dynamic_cast(right); + if (!lsig) { + const NetESelect*lsel = dynamic_cast(left); + if (lsel && (lsel->expr_width() >= lsel->sub_expr()->expr_width())) + lsig = dynamic_cast(lsel->sub_expr()); + } + if (!rsig) { + const NetESelect*rsel = dynamic_cast(right); + if (rsel && (rsel->expr_width() >= rsel->sub_expr()->expr_width())) + rsig = dynamic_cast(rsel->sub_expr()); + } + if (lsig && (lsig->sig() == index)) { check_for_const_synth(right, proc, str, pr_type); } else if (rsig && (rsig->sig() == index)) {