From e655c8548977a698609fa96ec1ef4cb651047b94 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Mon, 23 Jul 2012 21:29:53 -0400 Subject: [PATCH] Internals: findBit etc can be const. No functional change. --- src/V3Ast.cpp | 6 +++--- src/V3Ast.h | 6 +++--- src/V3Width.cpp | 4 +++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/V3Ast.cpp b/src/V3Ast.cpp index 2cb19011e..5f63a0ae1 100644 --- a/src/V3Ast.cpp +++ b/src/V3Ast.cpp @@ -1082,17 +1082,17 @@ void AstNode::dtypeChgWidthSigned(int width, int widthMin, bool issigned) { } } -AstNodeDType* AstNode::findBasicDType(AstBasicDTypeKwd kwd) { +AstNodeDType* AstNode::findBasicDType(AstBasicDTypeKwd kwd) const { // For 'simple' types we use the global directory. These are all unsized. // More advanced types land under the module/task/etc return v3Global.rootp()->typeTablep() ->findBasicDType(fileline(), kwd); } -AstNodeDType* AstNode::findBitDType(int width, int widthMin, AstNumeric numeric) { +AstNodeDType* AstNode::findBitDType(int width, int widthMin, AstNumeric numeric) const { return v3Global.rootp()->typeTablep() ->findLogicBitDType(fileline(), AstBasicDTypeKwd::BIT, width, widthMin, numeric); } -AstNodeDType* AstNode::findLogicDType(int width, int widthMin, AstNumeric numeric) { +AstNodeDType* AstNode::findLogicDType(int width, int widthMin, AstNumeric numeric) const { return v3Global.rootp()->typeTablep() ->findLogicBitDType(fileline(), AstBasicDTypeKwd::LOGIC, width, widthMin, numeric); } diff --git a/src/V3Ast.h b/src/V3Ast.h index 66b64cb51..a7b9718ca 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -1070,9 +1070,9 @@ public: AstNodeDType* findSigned32DType() { return findBasicDType(AstBasicDTypeKwd::INTEGER); } AstNodeDType* findUInt32DType() { return findBasicDType(AstBasicDTypeKwd::UINT32); } // Twostate AstNodeDType* findUInt64DType() { return findBasicDType(AstBasicDTypeKwd::UINT64); } // Twostate - AstNodeDType* findBitDType(int width, int widthMin, AstNumeric numeric); - AstNodeDType* findLogicDType(int width, int widthMin, AstNumeric numeric); - AstNodeDType* findBasicDType(AstBasicDTypeKwd kwd); + AstNodeDType* findBitDType(int width, int widthMin, AstNumeric numeric) const; + AstNodeDType* findLogicDType(int width, int widthMin, AstNumeric numeric) const; + AstNodeDType* findBasicDType(AstBasicDTypeKwd kwd) const; AstBasicDType* findInsertSameDType(AstBasicDType* nodep); // METHODS - dump and error diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 43532508a..6c14875aa 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -420,7 +420,9 @@ private: int frommsb = nodep->fromp()->width() - 1; int fromlsb = 0; AstNodeVarRef* varrp = nodep->fromp()->castNodeVarRef(); - if (varrp && varrp->varp()->basicp()->isRanged()) { // Selecting a bit from a multibit register + if (varrp + && varrp->varp()->basicp() + && varrp->varp()->basicp()->isRanged()) { // Selecting a bit from a multibit register frommsb = varrp->varp()->basicp()->msbMaxSelect(); // Corrected for negative lsb fromlsb = varrp->varp()->basicp()->lsb(); }