diff --git a/bin/verilator b/bin/verilator index bc759bcd5..7a0f6300a 100755 --- a/bin/verilator +++ b/bin/verilator @@ -402,11 +402,14 @@ enable functional coverage. =item --public +This is only for debug, and may result in mis-simulation of generated +clocks. + Declares all signals and modules public. This will turn off signal -optimizations as if all signals had a /*verilator public*/ comments. This -will also turn off inlining as if all modules had a /*verilator -public_module*/, unless the module specifically enabled it with /*verilator -inline_module*/. +optimizations as if all signals had a /*verilator public*/ comments and +inlining. This will also turn off inlining as if all modules had a +/*verilator public_module*/, unless the module specifically enabled it with +/*verilator inline_module*/. =item --sc @@ -1061,7 +1064,7 @@ Re-enable waveform tracing for all future signals that are declared. Used after a input, output, register, or wire declaration to indicate the signal should be declared so that C code may read or write the value -of the signal. Set for all signals when using the --public switch. +of the signal. =item /*verilator public*/ (task/function) diff --git a/include/verilated.h b/include/verilated.h index 273f444be..bba3bb508 100644 --- a/include/verilated.h +++ b/include/verilated.h @@ -40,11 +40,11 @@ using namespace std; //========================================================================= // Basic types -typedef uint8_t CData; ///< Verilated data, 1-8 bits -typedef uint16_t SData; ///< Verilated data, 9-16 bits -typedef uint32_t IData; ///< Verilated data, 17-32 bits -typedef vluint64_t QData; ///< Verilated data, 33-64 bits -typedef uint32_t WData; ///< Verilated data, >64 bits, as an array +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 const WData* WDataInP; ///< Array input to a function typedef WData* WDataOutP; ///< Array output from a function diff --git a/include/verilatedos.h b/include/verilatedos.h index 797cf5621..eb04fcd5c 100644 --- a/include/verilatedos.h +++ b/include/verilatedos.h @@ -68,24 +68,33 @@ #ifdef VL_UINTS_DEFINED #elif defined(__CYGWIN__) # include -typedef unsigned char uint8_t; ///< 8-bit basic type -typedef unsigned short int uint16_t; ///< 16-bit basic type -typedef unsigned long uint32_t; ///< 32-bit basic type -typedef unsigned long long vluint64_t; ///< 64-bit basic type +typedef unsigned char uint8_t; ///< 8-bit unsigned type (backward compatibility) +typedef unsigned short int uint16_t; ///< 16-bit unsigned type (backward compatibility) +typedef unsigned long uint32_t; ///< 32-bit unsigned type (backward compatibility) +typedef unsigned char vluint8_t; ///< 8-bit unsigned type +typedef unsigned short int vluint16_t; ///< 16-bit unsigned type typedef long vlsint32_t; ///< 32-bit signed type +typedef unsigned long vluint32_t; ///< 32-bit unsigned type typedef long long vlsint64_t; ///< 64-bit signed type +typedef unsigned long long vluint64_t; ///< 64-bit unsigned type #elif defined(_WIN32) -typedef unsigned char uint8_t; ///< 8-bit basic type -typedef unsigned short int uint16_t; ///< 16-bit basic type -typedef unsigned int uint32_t; ///< 32-bit basic type -typedef unsigned __int64 vluint64_t; ///< 64-bit basic type +typedef unsigned char uint8_t; ///< 8-bit unsigned type (backward compatibility) +typedef unsigned short int uint16_t; ///< 16-bit unsigned type (backward compatibility) +typedef unsigned long uint32_t; ///< 32-bit unsigned type (backward compatibility) +typedef unsigned char vluint8_t; ///< 8-bit unsigned type +typedef unsigned short int vluint16_t; ///< 16-bit unsigned type typedef int vlsint32_t; ///< 32-bit signed type +typedef unsigned int vluint32_t; ///< 32-bit unsigned type typedef __int64 vlsint64_t; ///< 64-bit signed type -#else // Linux or compliant Unix flavors +typedef unsigned __int64 vluint64_t; ///< 64-bit unsigned type +#else // Linux or compliant Unix flavors, -m64 # include -typedef unsigned long long vluint64_t; ///< 64-bit basic type -typedef long vlsint32_t; ///< 32-bit signed type +typedef uint8_t vluint8_t; ///< 32-bit unsigned type +typedef uint16_t vluint16_t; ///< 32-bit unsigned type +typedef int vlsint32_t; ///< 32-bit signed type +typedef uint32_t vluint32_t; ///< 32-bit signed type typedef long long vlsint64_t; ///< 64-bit signed type +typedef unsigned long long vluint64_t; ///< 64-bit unsigned type #endif //========================================================================= diff --git a/src/V3Ast.cpp b/src/V3Ast.cpp index 74f3caf22..9d1b9b045 100644 --- a/src/V3Ast.cpp +++ b/src/V3Ast.cpp @@ -33,8 +33,8 @@ //====================================================================== // Statics -uint64_t AstNode::s_editCntGbl=0; -uint64_t AstNode::s_editCntLast=0; +vluint64_t AstNode::s_editCntGbl=0; +vluint64_t AstNode::s_editCntLast=0; // To allow for fast clearing of all user pointers, we keep a "timestamp" // along with each userp, and thus by bumping this count we can make it look diff --git a/src/V3Ast.h b/src/V3Ast.h index d97b0d9e2..c44254d18 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -391,9 +391,9 @@ private: static int s_cloneCntGbl; // Count of which userp is set FileLine* m_fileline; // Where it was declared - uint64_t m_editCount; // When it was last edited - static uint64_t s_editCntGbl;// Global edit counter - static uint64_t s_editCntLast;// Global edit counter, last value for printing * near node #s + vluint64_t m_editCount; // When it was last edited + static vluint64_t s_editCntGbl; // Global edit counter + static vluint64_t s_editCntLast;// Global edit counter, last value for printing * near node #s // Attributes bool m_signed; // Node is signed @@ -539,10 +539,10 @@ public: void user5(int val) { user5p(AstNUser::fromInt(val)); } static void user5ClearTree() { s_user5CntGbl++; } // Clear userp()'s across the entire tree - uint64_t editCount() const { return m_editCount; } + vluint64_t editCount() const { return m_editCount; } void editCountInc() { m_editCount = s_editCntGbl++; } - static uint64_t editCountLast() { return s_editCntLast; } - static uint64_t editCountGbl() { return s_editCntGbl; } + static vluint64_t editCountLast() { return s_editCntLast; } + static vluint64_t editCountGbl() { return s_editCntGbl; } static void editCountSetLast() { s_editCntLast = editCountGbl(); } // ACCESSORS for specific types diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index 173fb096f..ee854ea08 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -1279,7 +1279,7 @@ void EmitCImp::emitWrapEval(AstModule* modp) { void EmitCStmts::emitVarList(AstNode* firstp, EisWhich which, const string& prefixIfImp) { // Put out a list of signal declarations - // in order of 0:clocks, 1:uint8, 2:uint16, 4:uint32, 5:uint64, 6:wide, 7:arrays + // in order of 0:clocks, 1:vluint8, 2:vluint16, 4:vluint32, 5:vluint64, 6:wide, 7:arrays // This aids cache packing and locality // Largest->smallest reduces the number of pad variables. // But for now, Smallest->largest makes it more likely a small offset will allow access to the signal. diff --git a/src/V3EmitCSyms.cpp b/src/V3EmitCSyms.cpp index a95e74555..1cc05a5ba 100644 --- a/src/V3EmitCSyms.cpp +++ b/src/V3EmitCSyms.cpp @@ -124,14 +124,14 @@ void EmitCSyms::emitInt() { //puts("\n// STATIC STATE\n"); puts("\n// LOCAL STATE\n"); - ofp()->putAlign(V3OutFile::AL_AUTO, sizeof(uint64_t)); + ofp()->putAlign(V3OutFile::AL_AUTO, sizeof(vluint64_t)); puts("const char* __Vm_namep;\n"); // Must be before subcells, as constructor order needed before _vlCoverInsert. ofp()->putAlign(V3OutFile::AL_AUTO, sizeof(bool)); puts("bool\t__Vm_activity;\t\t///< Used by trace routines to determine change occurred\n"); ofp()->putAlign(V3OutFile::AL_AUTO, sizeof(bool)); puts("bool\t__Vm_didInit;\n"); - ofp()->putAlign(V3OutFile::AL_AUTO, sizeof(uint64_t)); + ofp()->putAlign(V3OutFile::AL_AUTO, sizeof(vluint64_t)); puts("\n// SUBCELL STATE\n"); for (vector::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) { AstScope* scopep = it->first; AstModule* modp = it->second; diff --git a/src/V3GraphDfa.cpp b/src/V3GraphDfa.cpp index 97225a511..877495339 100644 --- a/src/V3GraphDfa.cpp +++ b/src/V3GraphDfa.cpp @@ -64,7 +64,7 @@ class GraphNfaToDfa : GraphAlg { private: // TYPES typedef deque DfaStates; - typedef multimap HashMap; + typedef multimap HashMap; // MEMBERS uint32_t m_step; // Processing step, so we can avoid clearUser all the time diff --git a/src/V3List.h b/src/V3List.h index e05402c22..c3b1fb5fb 100644 --- a/src/V3List.h +++ b/src/V3List.h @@ -62,7 +62,7 @@ private: // "this" must be a element inside of *basep // Use that to determine a structure offset, then apply to the new base // to get our new pointer information - return (V3ListEnt*) ( ((uint8_t*)newbasep) + offset); + return (V3ListEnt*) ( ((vluint8_t*)newbasep) + offset); } public: V3ListEnt() @@ -78,7 +78,7 @@ public: // METHODS void pushBack (V3List& listr, T newp) { // "this" must be a element inside of *newp - uint32_t offset = (uint8_t*)(this) - (uint8_t*)(newp); + uint32_t offset = (vluint8_t*)(this) - (vluint8_t*)(newp); m_nextp = NULL; if (!listr.m_headp) listr.m_headp = newp; m_prevp = listr.m_tailp; @@ -87,7 +87,7 @@ public: } void pushFront (V3List& listr, T newp) { // "this" must be a element inside of *newp - uint32_t offset = (uint8_t*)(this) - (uint8_t*)(newp); + uint32_t offset = (vluint8_t*)(this) - (vluint8_t*)(newp); m_nextp = listr.m_headp; if (m_nextp) baseToListEnt(m_nextp,offset)->m_prevp = newp; listr.m_headp = newp; @@ -97,7 +97,7 @@ public: // Unlink from side void unlink (V3List& listr, T oldp) { // "this" must be a element inside of *oldp - uint32_t offset = (uint8_t*)(this) - (uint8_t*)(oldp); + uint32_t offset = (vluint8_t*)(this) - (vluint8_t*)(oldp); if (m_nextp) baseToListEnt(m_nextp,offset)->m_prevp = m_prevp; else listr.m_tailp = m_prevp; if (m_prevp) baseToListEnt(m_prevp,offset)->m_nextp = m_nextp; diff --git a/src/V3Stats.h b/src/V3Stats.h index 0ed50755b..58a25d2f2 100644 --- a/src/V3Stats.h +++ b/src/V3Stats.h @@ -36,7 +36,7 @@ public: ~V3Double0() {} // Implicit conversion operators: - inline V3Double0 (const uint64_t v) : m_d(v) { }; + inline V3Double0 (const vluint64_t v) : m_d(v) { }; inline operator const double () const { return m_d; }; // Explicit operators: