Fix coverage of real arrays giving operator^ not defined

This commit is contained in:
Wilson Snyder 2024-02-07 20:11:27 -05:00
parent 715dce546f
commit c20634e4f8
4 changed files with 17 additions and 11 deletions

View File

@ -122,8 +122,15 @@ class ClockVisitor final : public VNVisitor {
AstNodeExpr* const origp = nodep->origp()->unlinkFrBack(); AstNodeExpr* const origp = nodep->origp()->unlinkFrBack();
AstNodeExpr* const changeWrp = nodep->changep()->unlinkFrBack(); AstNodeExpr* const changeWrp = nodep->changep()->unlinkFrBack();
AstNodeExpr* const changeRdp = ConvertWriteRefsToRead::main(changeWrp->cloneTree(false)); AstNodeExpr* const changeRdp = ConvertWriteRefsToRead::main(changeWrp->cloneTree(false));
AstIf* const newp AstNodeExpr* comparedp = nullptr;
= new AstIf{nodep->fileline(), new AstXor{nodep->fileline(), origp, changeRdp}, incp}; // Xor will optimize better than Eq, when CoverToggle has bit selects,
// but can only use Xor with non-opaque types
if (const AstBasicDType* const bdtypep
= VN_CAST(origp->dtypep()->skipRefp(), BasicDType)) {
if (!bdtypep->isOpaque()) comparedp = new AstXor{nodep->fileline(), origp, changeRdp};
}
if (!comparedp) comparedp = AstEq::newTyped(nodep->fileline(), origp, changeRdp);
AstIf* const newp = new AstIf{nodep->fileline(), comparedp, incp};
// We could add another IF to detect posedges, and only increment if so. // We could add another IF to detect posedges, and only increment if so.
// It's another whole branch though versus a potential memory miss. // It's another whole branch though versus a potential memory miss.
// We'll go with the miss. // We'll go with the miss.

View File

@ -7,13 +7,12 @@
module t (/*AUTOARG*/ module t (/*AUTOARG*/
// Inputs // Inputs
clk, clk, check_real, check_array_real, check_string
check_real,
check_string
); );
000019 input clk; 000019 input clk;
input real check_real; // Check issue #2741 input real check_real; // Check issue #2741
000021 input real check_array_real [1:0];
input string check_string; // Check issue #2766 input string check_string; // Check issue #2766
typedef struct packed { typedef struct packed {

View File

@ -6,13 +6,12 @@
module t (/*AUTOARG*/ module t (/*AUTOARG*/
// Inputs // Inputs
clk, clk, check_real, check_array_real, check_string
check_real,
check_string
); );
input clk; input clk;
input real check_real; // Check issue #2741 input real check_real; // Check issue #2741
input real check_array_real [1:0];
input string check_string; // Check issue #2766 input string check_string; // Check issue #2766
typedef struct packed { typedef struct packed {

View File

@ -7,14 +7,15 @@
module t (/*AUTOARG*/ module t (/*AUTOARG*/
// Inputs // Inputs
clk, clk, check_real, check_array_real, check_string
check_real,
check_string
); );
000019 input clk; 000019 input clk;
+000019 point: comment=clk +000019 point: comment=clk
input real check_real; // Check issue #2741 input real check_real; // Check issue #2741
000021 input real check_array_real [1:0];
+000021 point: comment=check_array_real[0]
+000021 point: comment=check_array_real[1]
input string check_string; // Check issue #2766 input string check_string; // Check issue #2766
typedef struct packed { typedef struct packed {