From b532a47e4a9d0cf8d71ef8200e987e1f32c28747 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Wed, 4 Oct 2017 21:15:19 -0400 Subject: [PATCH] Internals: Prep for V3Slice rewrite. No functional change intended. --- src/V3Ast.h | 1 + src/V3AstNodes.h | 4 ++++ src/V3Delayed.cpp | 2 +- src/V3Expand.cpp | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/V3Ast.h b/src/V3Ast.h index 02337c860..d5bc08457 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -1458,6 +1458,7 @@ public: virtual bool sizeMattersLhs() { return false; } virtual bool sizeMattersRhs() { return false; } virtual bool sizeMattersThs() { return false; } virtual int instrCount() const { return instrCountBranch(); } + virtual AstNode* cloneType(AstNode* condp, AstNode* expr1p, AstNode* expr2p) = 0; }; class AstNodePreSel : public AstNode { diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index 4b8beaa63..d25ba2f92 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -2183,6 +2183,8 @@ public: AstCond(FileLine* fl, AstNode* condp, AstNode* expr1p, AstNode* expr2p) : AstNodeCond(fl, condp, expr1p, expr2p) {} ASTNODE_NODE_FUNCS(Cond) + virtual AstNode* cloneType(AstNode* condp, AstNode* expr1p, AstNode* expr2p) { + return new AstCond(this->fileline(), condp, expr1p, expr2p); } }; class AstCondBound : public AstNodeCond { @@ -2193,6 +2195,8 @@ public: AstCondBound(FileLine* fl, AstNode* condp, AstNode* expr1p, AstNode* expr2p) : AstNodeCond(fl, condp, expr1p, expr2p) {} ASTNODE_NODE_FUNCS(CondBound) + virtual AstNode* cloneType(AstNode* condp, AstNode* expr1p, AstNode* expr2p) { + return new AstCondBound(this->fileline(), condp, expr1p, expr2p); } }; class AstCoverDecl : public AstNodeStmt { diff --git a/src/V3Delayed.cpp b/src/V3Delayed.cpp index b3c9ed451..d3197a60f 100644 --- a/src/V3Delayed.cpp +++ b/src/V3Delayed.cpp @@ -195,7 +195,7 @@ private: arrayselp = lhsp->castArraySel(); } if (!arrayselp) nodep->v3fatalSrc("No arraysel under bitsel?"); - if (arrayselp->length()!=1) nodep->v3fatalSrc("ArraySel with length!=1 should have been removed in V3Slice"); + if (arrayselp->dtypep()->skipRefp()->castUnpackArrayDType()) nodep->v3fatalSrc("ArraySel with unpacked arrays should have been removed in V3Slice"); UINFO(4,"AssignDlyArray: "<length()!=1) nodep->v3fatalSrc("ArraySel with length!=1 should have been removed in V3Slice"); + if (nodep->dtypep()->skipRefp()->castUnpackArrayDType()) nodep->v3fatalSrc("ArraySel with unpacked arrays should have been removed in V3Slice"); for (int w=0; wwidthWords(); w++) { addWordAssign(nodep, w, newAstWordSelClone (rhsp, w)); }