From bc9ff6d1bf192f8af0ce44879469cbb8174ab097 Mon Sep 17 00:00:00 2001 From: Krzysztof Bieganski Date: Mon, 16 Oct 2023 17:05:39 +0200 Subject: [PATCH] Fix interface comparison (#4570) --- src/V3Width.cpp | 3 ++- test_regress/t/t_interface_virtual.out | 4 ++++ test_regress/t/t_interface_virtual.v | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/V3Width.cpp b/src/V3Width.cpp index ed55d1b36..20d5d4954 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -6681,7 +6681,8 @@ private: // child node's width to end up correct for the assignment (etc) widthCheckSized(nodep, side, VN_AS(underp, NodeExpr), expDTypep, extendRule, warnOn); - } else if (!VN_IS(expDTypep->skipRefp(), IfaceRefDType) + } else if (!VN_IS(nodep, Eq) && !VN_IS(nodep, Neq) + && !VN_IS(expDTypep->skipRefp(), IfaceRefDType) && VN_IS(underp->dtypep()->skipRefp(), IfaceRefDType)) { underp->v3error(ucfirst(nodep->prettyOperatorName()) << " expected non-interface on " << side << " but " diff --git a/test_regress/t/t_interface_virtual.out b/test_regress/t/t_interface_virtual.out index 2e63964b4..315bffb65 100644 --- a/test_regress/t/t_interface_virtual.out +++ b/test_regress/t/t_interface_virtual.out @@ -1,3 +1,7 @@ +va==vb? 1 +va!=vb? 0 +va==vb? 0 +va!=vb? 1 va.addr=aa va.data=11 ia.addr=aa ia.data=11 vb.addr=bb vb.data=22 ib.addr=bb ib.data=22 ca.fa.addr=a0 ca.fa.data=11 ca.fa.addr=b0 ca.fb.data=22 diff --git a/test_regress/t/t_interface_virtual.v b/test_regress/t/t_interface_virtual.v index 0e05cf47e..2b36e1a30 100644 --- a/test_regress/t/t_interface_virtual.v +++ b/test_regress/t/t_interface_virtual.v @@ -33,7 +33,12 @@ module t (/*AUTOARG*/); initial begin va = ia; + vb = ia; + $display("va==vb? %b", va==vb); + $display("va!=vb? %b", va!=vb); vb = ib; + $display("va==vb? %b", va==vb); + $display("va!=vb? %b", va!=vb); ca = new; cb = new;