From 7c6b225b7ef2c7f1bb87de4b4d7e8809f0d2d94a Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Tue, 18 Aug 2026 11:19:40 +0200 Subject: [PATCH] Internals: Make AstConstraintBefore an AstNodeStmt (#6280) (#8141) AstConstraintBefore ('solve x before y') is a constraint item that appears in constraint bodies alongside its siblings AstConstraintExpr, AstConstraintUnique and AstConstraintIf, all of which are AstNodeStmt. Part of #6280. --- src/V3AstNodeOther.h | 16 ---------------- src/V3AstNodeStmt.h | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/V3AstNodeOther.h b/src/V3AstNodeOther.h index 02db326c4..2695c9c49 100644 --- a/src/V3AstNodeOther.h +++ b/src/V3AstNodeOther.h @@ -1041,22 +1041,6 @@ public: void isStatic(bool flag) { m_isStatic = flag; } bool isStatic() const { return m_isStatic; } }; -class AstConstraintBefore final : public AstNode { - // Constraint solve before item - // @astgen op1 := lhssp : List[AstNodeExpr] - // @astgen op2 := rhssp : List[AstNodeExpr] -public: - AstConstraintBefore(FileLine* fl, AstNodeExpr* lhssp, AstNodeExpr* rhssp) - : ASTGEN_SUPER_ConstraintBefore(fl) { - addLhssp(lhssp); - addRhssp(rhssp); - } - ASTGEN_MEMBERS_AstConstraintBefore; - bool isGateOptimizable() const override { return false; } - bool isPredictOptimizable() const override { return false; } - bool sameNode(const AstNode* /*samep*/) const override { return true; } -}; - class AstCoverBin final : public AstNode { // Captures data for a coverpoint 'bins' declaration // @astgen op1 := rangesp : List[AstNode] diff --git a/src/V3AstNodeStmt.h b/src/V3AstNodeStmt.h index 50f7e738b..84003c2cb 100644 --- a/src/V3AstNodeStmt.h +++ b/src/V3AstNodeStmt.h @@ -461,6 +461,21 @@ public: bool sameNode(const AstNode* samep) const override { return true; } // Ignore name in comments virtual bool showAt() const { return m_showAt; } }; +class AstConstraintBefore final : public AstNodeStmt { + // Constraint solve before item + // @astgen op1 := lhssp : List[AstNodeExpr] + // @astgen op2 := rhssp : List[AstNodeExpr] +public: + AstConstraintBefore(FileLine* fl, AstNodeExpr* lhssp, AstNodeExpr* rhssp) + : ASTGEN_SUPER_ConstraintBefore(fl) { + addLhssp(lhssp); + addRhssp(rhssp); + } + ASTGEN_MEMBERS_AstConstraintBefore; + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } +}; class AstConstraintExpr final : public AstNodeStmt { // Constraint expression // @astgen op1 := exprp : AstNodeExpr