From b6447a903281fb77bdb6f217a9f1667c9a22ae47 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Fri, 15 Jan 2010 08:20:25 -0500 Subject: [PATCH] Internal cleanup: Prep for strings --- include/verilated.h | 13 ++++++++----- src/V3Ast.h | 14 +++++++------- src/V3AstNodes.h | 2 +- src/V3EmitC.cpp | 1 + test_regress/t/t_math_const.v | 2 ++ 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/include/verilated.h b/include/verilated.h index e729a0275..bdd8e1bfd 100644 --- a/include/verilated.h +++ b/include/verilated.h @@ -42,11 +42,14 @@ using namespace std; //========================================================================= // Basic types -typedef vluint8_t CData; ///< Verilated data, 1-8 bits -typedef vluint16_t SData; ///< Verilated data, 9-16 bits -typedef vluint32_t IData; ///< Verilated data, 17-32 bits -typedef vluint64_t QData; ///< Verilated data, 33-64 bits -typedef vluint32_t WData; ///< Verilated data, >64 bits, as an array +typedef vluint8_t CData; ///< Verilated pack data, 1-8 bits +typedef vluint16_t SData; ///< Verilated pack data, 9-16 bits +typedef vluint32_t IData; ///< Verilated pack data, 17-32 bits +typedef vluint64_t QData; ///< Verilated pack data, 33-64 bits +typedef vluint32_t WData; ///< Verilated pack data, >64 bits, as an array +// float F // No typedef needed; Verilator uses float +// double G // No typedef needed; Verilator uses double +// string N // No typedef needed; Verilator uses double typedef const WData* WDataInP; ///< Array input to a function typedef WData* WDataOutP; ///< Array output from a function diff --git a/src/V3Ast.h b/src/V3Ast.h index 6902b24d8..012dd1d6f 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -228,7 +228,7 @@ public: static const char* names[] = { "unsigned char", "char", "void*", "int", "int", "svLogic", "long long", "double", "double", "short int", "float", "long long", - "char*", + "const char*", "dpiScope", "const char*", "" }; @@ -253,23 +253,23 @@ public: default: return 0; } } - int isSigned() const { + bool isSigned() const { return m_e==BYTE || m_e==SHORTINT || m_e==INT || m_e==LONGINT || m_e==INTEGER; } - int isFourstate() const { + bool isFourstate() const { return m_e==INTEGER || m_e==LOGIC || m_e==LOGIC_IMPLICIT; } - int isZeroInit() const { // Otherwise initializes to X + bool isZeroInit() const { // Otherwise initializes to X return (m_e==BIT || m_e==BYTE || m_e==CHANDLE || m_e==INT || m_e==LONGINT || m_e==SHORTINT || m_e==STRING); } - int isSloppy() const { // Don't be as anal about width warnings + bool isSloppy() const { // Don't be as anal about width warnings return !(m_e==LOGIC || m_e==BIT); } - int isBitLogic() const { // Don't be as anal about width warnings + bool isBitLogic() const { // Don't be as anal about width warnings return (m_e==LOGIC || m_e==BIT); } - int isDpiUnsupported() const { + bool isDpiUnsupported() const { return (m_e==LOGIC || m_e==TIME || m_e==REALTIME); } }; diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index 19aca66ae..952e784bc 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -1590,7 +1590,7 @@ struct AstFOpen : public AstNodeStmt { setOp3p(modep); } ASTNODE_NODE_FUNCS(FOpen, FOPEN) - virtual string verilogKwd() const { return "$fclose"; } + virtual string verilogKwd() const { return "$fopen"; } virtual bool isGateOptimizable() const { return false; } virtual bool isPredictOptimizable() const { return false; } virtual bool isSplittable() const { return false; } diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index 3f019d1c8..cabca5cc8 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -74,6 +74,7 @@ public: void emitVarCtors(); bool emitSimpleOk(AstNodeMath* nodep); void emitIQW(AstNode* nodep) { + // Other abbrevs: "C"har, "S"hort, "F"loat, "G"double, stri"N"g puts (nodep->isWide()?"W":(nodep->isQuad()?"Q":"I")); } void emitScIQW(AstVar* nodep) { diff --git a/test_regress/t/t_math_const.v b/test_regress/t/t_math_const.v index 7c47c5d41..505dcbe8e 100644 --- a/test_regress/t/t_math_const.v +++ b/test_regress/t/t_math_const.v @@ -82,6 +82,8 @@ module t (/*AUTOARG*/ con__ascii = "abcdefghijklmnop"; if ( con__ascii !== {"abcd","efgh","ijkl","mnop"}) $stop; + con__ascii = "abcdefghijklm"; + if ( con__ascii !== {24'h0,"a","bcde","fghi","jklm"}) $stop; if ( 3'dx !== 3'hx) $stop;