Use vluint8/16/64 in source code

git-svn-id: file://localhost/svn/verilator/trunk/verilator@789 77ca24e4-aefa-0310-84f0-b9a241c72d87
This commit is contained in:
Wilson Snyder 2006-09-19 15:27:15 +00:00
parent f9697463cc
commit a4db880809
10 changed files with 50 additions and 38 deletions

View File

@ -402,11 +402,14 @@ enable functional coverage.
=item --public =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 Declares all signals and modules public. This will turn off signal
optimizations as if all signals had a /*verilator public*/ comments. This optimizations as if all signals had a /*verilator public*/ comments and
will also turn off inlining as if all modules had a /*verilator inlining. This will also turn off inlining as if all modules had a
public_module*/, unless the module specifically enabled it with /*verilator /*verilator public_module*/, unless the module specifically enabled it with
inline_module*/. /*verilator inline_module*/.
=item --sc =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 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 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) =item /*verilator public*/ (task/function)

View File

@ -40,11 +40,11 @@ using namespace std;
//========================================================================= //=========================================================================
// Basic types // Basic types
typedef uint8_t CData; ///< Verilated data, 1-8 bits typedef vluint8_t CData; ///< Verilated data, 1-8 bits
typedef uint16_t SData; ///< Verilated data, 9-16 bits typedef vluint16_t SData; ///< Verilated data, 9-16 bits
typedef uint32_t IData; ///< Verilated data, 17-32 bits typedef vluint32_t IData; ///< Verilated data, 17-32 bits
typedef vluint64_t QData; ///< Verilated data, 33-64 bits typedef vluint64_t QData; ///< Verilated data, 33-64 bits
typedef uint32_t WData; ///< Verilated data, >64 bits, as an array typedef vluint32_t WData; ///< Verilated data, >64 bits, as an array
typedef const WData* WDataInP; ///< Array input to a function typedef const WData* WDataInP; ///< Array input to a function
typedef WData* WDataOutP; ///< Array output from a function typedef WData* WDataOutP; ///< Array output from a function

View File

@ -68,24 +68,33 @@
#ifdef VL_UINTS_DEFINED #ifdef VL_UINTS_DEFINED
#elif defined(__CYGWIN__) #elif defined(__CYGWIN__)
# include <stdint.h> # include <stdint.h>
typedef unsigned char uint8_t; ///< 8-bit basic type typedef unsigned char uint8_t; ///< 8-bit unsigned type (backward compatibility)
typedef unsigned short int uint16_t; ///< 16-bit basic type typedef unsigned short int uint16_t; ///< 16-bit unsigned type (backward compatibility)
typedef unsigned long uint32_t; ///< 32-bit basic type typedef unsigned long uint32_t; ///< 32-bit unsigned type (backward compatibility)
typedef unsigned long long vluint64_t; ///< 64-bit basic type 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 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 long long vlsint64_t; ///< 64-bit signed type
typedef unsigned long long vluint64_t; ///< 64-bit unsigned type
#elif defined(_WIN32) #elif defined(_WIN32)
typedef unsigned char uint8_t; ///< 8-bit basic type typedef unsigned char uint8_t; ///< 8-bit unsigned type (backward compatibility)
typedef unsigned short int uint16_t; ///< 16-bit basic type typedef unsigned short int uint16_t; ///< 16-bit unsigned type (backward compatibility)
typedef unsigned int uint32_t; ///< 32-bit basic type typedef unsigned long uint32_t; ///< 32-bit unsigned type (backward compatibility)
typedef unsigned __int64 vluint64_t; ///< 64-bit basic type 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 int vlsint32_t; ///< 32-bit signed type
typedef unsigned int vluint32_t; ///< 32-bit unsigned type
typedef __int64 vlsint64_t; ///< 64-bit signed 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 <stdint.h> # include <stdint.h>
typedef unsigned long long vluint64_t; ///< 64-bit basic type typedef uint8_t vluint8_t; ///< 32-bit unsigned type
typedef long vlsint32_t; ///< 32-bit signed 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 long long vlsint64_t; ///< 64-bit signed type
typedef unsigned long long vluint64_t; ///< 64-bit unsigned type
#endif #endif
//========================================================================= //=========================================================================

View File

@ -33,8 +33,8 @@
//====================================================================== //======================================================================
// Statics // Statics
uint64_t AstNode::s_editCntGbl=0; vluint64_t AstNode::s_editCntGbl=0;
uint64_t AstNode::s_editCntLast=0; vluint64_t AstNode::s_editCntLast=0;
// To allow for fast clearing of all user pointers, we keep a "timestamp" // 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 // along with each userp, and thus by bumping this count we can make it look

View File

@ -391,9 +391,9 @@ private:
static int s_cloneCntGbl; // Count of which userp is set static int s_cloneCntGbl; // Count of which userp is set
FileLine* m_fileline; // Where it was declared FileLine* m_fileline; // Where it was declared
uint64_t m_editCount; // When it was last edited vluint64_t m_editCount; // When it was last edited
static uint64_t s_editCntGbl;// Global edit counter static vluint64_t s_editCntGbl; // Global edit counter
static uint64_t s_editCntLast;// Global edit counter, last value for printing * near node #s static vluint64_t s_editCntLast;// Global edit counter, last value for printing * near node #s
// Attributes // Attributes
bool m_signed; // Node is signed bool m_signed; // Node is signed
@ -539,10 +539,10 @@ public:
void user5(int val) { user5p(AstNUser::fromInt(val)); } void user5(int val) { user5p(AstNUser::fromInt(val)); }
static void user5ClearTree() { s_user5CntGbl++; } // Clear userp()'s across the entire tree 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++; } void editCountInc() { m_editCount = s_editCntGbl++; }
static uint64_t editCountLast() { return s_editCntLast; } static vluint64_t editCountLast() { return s_editCntLast; }
static uint64_t editCountGbl() { return s_editCntGbl; } static vluint64_t editCountGbl() { return s_editCntGbl; }
static void editCountSetLast() { s_editCntLast = editCountGbl(); } static void editCountSetLast() { s_editCntLast = editCountGbl(); }
// ACCESSORS for specific types // ACCESSORS for specific types

View File

@ -1279,7 +1279,7 @@ void EmitCImp::emitWrapEval(AstModule* modp) {
void EmitCStmts::emitVarList(AstNode* firstp, EisWhich which, const string& prefixIfImp) { void EmitCStmts::emitVarList(AstNode* firstp, EisWhich which, const string& prefixIfImp) {
// Put out a list of signal declarations // 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 // This aids cache packing and locality
// Largest->smallest reduces the number of pad variables. // 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. // But for now, Smallest->largest makes it more likely a small offset will allow access to the signal.

View File

@ -124,14 +124,14 @@ void EmitCSyms::emitInt() {
//puts("\n// STATIC STATE\n"); //puts("\n// STATIC STATE\n");
puts("\n// LOCAL 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. puts("const char* __Vm_namep;\n"); // Must be before subcells, as constructor order needed before _vlCoverInsert.
ofp()->putAlign(V3OutFile::AL_AUTO, sizeof(bool)); ofp()->putAlign(V3OutFile::AL_AUTO, sizeof(bool));
puts("bool\t__Vm_activity;\t\t///< Used by trace routines to determine change occurred\n"); puts("bool\t__Vm_activity;\t\t///< Used by trace routines to determine change occurred\n");
ofp()->putAlign(V3OutFile::AL_AUTO, sizeof(bool)); ofp()->putAlign(V3OutFile::AL_AUTO, sizeof(bool));
puts("bool\t__Vm_didInit;\n"); 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"); puts("\n// SUBCELL STATE\n");
for (vector<ScopeModPair>::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) { for (vector<ScopeModPair>::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) {
AstScope* scopep = it->first; AstModule* modp = it->second; AstScope* scopep = it->first; AstModule* modp = it->second;

View File

@ -64,7 +64,7 @@ class GraphNfaToDfa : GraphAlg {
private: private:
// TYPES // TYPES
typedef deque<DfaVertex*> DfaStates; typedef deque<DfaVertex*> DfaStates;
typedef multimap<uint64_t,DfaVertex*> HashMap; typedef multimap<vluint64_t,DfaVertex*> HashMap;
// MEMBERS // MEMBERS
uint32_t m_step; // Processing step, so we can avoid clearUser all the time uint32_t m_step; // Processing step, so we can avoid clearUser all the time

View File

@ -62,7 +62,7 @@ private:
// "this" must be a element inside of *basep // "this" must be a element inside of *basep
// Use that to determine a structure offset, then apply to the new base // Use that to determine a structure offset, then apply to the new base
// to get our new pointer information // to get our new pointer information
return (V3ListEnt*) ( ((uint8_t*)newbasep) + offset); return (V3ListEnt*) ( ((vluint8_t*)newbasep) + offset);
} }
public: public:
V3ListEnt() V3ListEnt()
@ -78,7 +78,7 @@ public:
// METHODS // METHODS
void pushBack (V3List<T>& listr, T newp) { void pushBack (V3List<T>& listr, T newp) {
// "this" must be a element inside of *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; m_nextp = NULL;
if (!listr.m_headp) listr.m_headp = newp; if (!listr.m_headp) listr.m_headp = newp;
m_prevp = listr.m_tailp; m_prevp = listr.m_tailp;
@ -87,7 +87,7 @@ public:
} }
void pushFront (V3List<T>& listr, T newp) { void pushFront (V3List<T>& listr, T newp) {
// "this" must be a element inside of *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; m_nextp = listr.m_headp;
if (m_nextp) baseToListEnt(m_nextp,offset)->m_prevp = newp; if (m_nextp) baseToListEnt(m_nextp,offset)->m_prevp = newp;
listr.m_headp = newp; listr.m_headp = newp;
@ -97,7 +97,7 @@ public:
// Unlink from side // Unlink from side
void unlink (V3List<T>& listr, T oldp) { void unlink (V3List<T>& listr, T oldp) {
// "this" must be a element inside of *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; if (m_nextp) baseToListEnt(m_nextp,offset)->m_prevp = m_prevp;
else listr.m_tailp = m_prevp; else listr.m_tailp = m_prevp;
if (m_prevp) baseToListEnt(m_prevp,offset)->m_nextp = m_nextp; if (m_prevp) baseToListEnt(m_prevp,offset)->m_nextp = m_nextp;

View File

@ -36,7 +36,7 @@ public:
~V3Double0() {} ~V3Double0() {}
// Implicit conversion operators: // 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; }; inline operator const double () const { return m_d; };
// Explicit operators: // Explicit operators: