From 338acabe2b54432b447ec06e326911f3ecf2c36a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Risto=20Peja=C5=A1inovi=C4=87?= Date: Wed, 31 May 2023 05:44:48 +0200 Subject: [PATCH] Fix AstStructSel clean when data type is structure (#4241) (#4244) --- src/V3Clean.cpp | 5 +++++ test_regress/t/t_unpacked_struct_eq.v | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/V3Clean.cpp b/src/V3Clean.cpp index 303480fd2..f69d0e153 100644 --- a/src/V3Clean.cpp +++ b/src/V3Clean.cpp @@ -234,6 +234,11 @@ private: operandTriop(nodep); setClean(nodep, nodep->cleanOut()); } + void visit(AstStructSel* nodep) override { + iterateChildren(nodep); + AstStructDType* dtypep = VN_CAST(nodep->dtypep()->skipRefp(), StructDType); + setClean(nodep, dtypep && !dtypep->packed()); + } void visit(AstUCFunc* nodep) override { iterateChildren(nodep); computeCppWidth(nodep); diff --git a/test_regress/t/t_unpacked_struct_eq.v b/test_regress/t/t_unpacked_struct_eq.v index 726922e24..5757cae2e 100644 --- a/test_regress/t/t_unpacked_struct_eq.v +++ b/test_regress/t/t_unpacked_struct_eq.v @@ -38,9 +38,8 @@ module t; assign s2.arr[1] = 8'h33; initial begin - if(s1 != s2) begin - $fatal; - end + if(s1 != s2) $stop; + if(s1.sub != s2.sub) $stop; if(s1 == s2) begin $write("*-* All Finished *-*\n"); $finish;