Call VL_PRINTF/vl_stop/vl_finish/vl_fatal through wrappers as hook for future MT use.
This commit is contained in:
parent
cc0b780412
commit
f4b00d3c64
|
|
@ -81,6 +81,21 @@ void vl_fatal (const char* filename, int linenum, const char* hier, const char*
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
// Non-user overridable wrapper to call user-overridable functions
|
||||||
|
|
||||||
|
void VL_FINISH_MT (const char* filename, int linenum, const char* hier) {
|
||||||
|
vl_finish(filename, linenum, hier);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VL_STOP_MT (const char* filename, int linenum, const char* hier) {
|
||||||
|
vl_stop(filename, linenum, hier);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VL_FATAL_MT (const char* filename, int linenum, const char* hier, const char* msg) {
|
||||||
|
vl_fatal(filename, linenum, hier, msg);
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
// Overall class init
|
// Overall class init
|
||||||
|
|
||||||
|
|
@ -165,9 +180,9 @@ WDataOutP VL_ZERO_RESET_W(int obits, WDataOutP outwp) {
|
||||||
// Debug
|
// Debug
|
||||||
|
|
||||||
void _VL_DEBUG_PRINT_W(int lbits, WDataInP iwp) {
|
void _VL_DEBUG_PRINT_W(int lbits, WDataInP iwp) {
|
||||||
VL_PRINTF(" Data: w%d: ", lbits);
|
VL_PRINTF_MT(" Data: w%d: ", lbits);
|
||||||
for (int i=VL_WORDS_I(lbits)-1; i>=0; --i) { VL_PRINTF("%08x ",iwp[i]); }
|
for (int i=VL_WORDS_I(lbits)-1; i>=0; --i) { VL_PRINTF_MT("%08x ",iwp[i]); }
|
||||||
VL_PRINTF("\n");
|
VL_PRINTF_MT("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
@ -502,7 +517,7 @@ void _vl_vsformat(std::string& output, const char* formatp, va_list ap) {
|
||||||
static_cast<QData>(ld/VL_TIME_MULTIPLIER),
|
static_cast<QData>(ld/VL_TIME_MULTIPLIER),
|
||||||
static_cast<QData>(ld%VL_TIME_MULTIPLIER));
|
static_cast<QData>(ld%VL_TIME_MULTIPLIER));
|
||||||
} else {
|
} else {
|
||||||
vl_fatal(__FILE__,__LINE__,"","Unsupported VL_TIME_MULTIPLIER");
|
VL_FATAL_MT(__FILE__,__LINE__,"","Unsupported VL_TIME_MULTIPLIER");
|
||||||
}
|
}
|
||||||
int needmore = width-digits;
|
int needmore = width-digits;
|
||||||
if (needmore>0) output.append(needmore,' '); // Pre-pad spaces
|
if (needmore>0) output.append(needmore,' '); // Pre-pad spaces
|
||||||
|
|
@ -561,7 +576,7 @@ void _vl_vsformat(std::string& output, const char* formatp, va_list ap) {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
std::string msg = std::string("Unknown _vl_vsformat code: ")+pos[0];
|
std::string msg = std::string("Unknown _vl_vsformat code: ")+pos[0];
|
||||||
vl_fatal(__FILE__,__LINE__,"",msg.c_str());
|
VL_FATAL_MT(__FILE__,__LINE__,"",msg.c_str());
|
||||||
break;
|
break;
|
||||||
} // switch
|
} // switch
|
||||||
}
|
}
|
||||||
|
|
@ -616,7 +631,7 @@ static inline void _vl_vsss_read(FILE* fp, int& floc, WDataInP fromp, const std:
|
||||||
_vl_vsss_advance(fp, floc);
|
_vl_vsss_advance(fp, floc);
|
||||||
}
|
}
|
||||||
*cp++ = '\0';
|
*cp++ = '\0';
|
||||||
//VL_PRINTF("\t_read got='%s'\n", tmpp);
|
//VL_PRINTF_MT("\t_read got='%s'\n", tmpp);
|
||||||
}
|
}
|
||||||
static inline void _vl_vsss_setbit(WDataOutP owp, int obits, int lsb, int nbits, IData ld) {
|
static inline void _vl_vsss_setbit(WDataOutP owp, int obits, int lsb, int nbits, IData ld) {
|
||||||
for (; nbits && lsb<obits; nbits--, lsb++, ld>>=1) {
|
for (; nbits && lsb<obits; nbits--, lsb++, ld>>=1) {
|
||||||
|
|
@ -663,7 +678,7 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
|
||||||
bool inPct = false;
|
bool inPct = false;
|
||||||
const char* pos = formatp;
|
const char* pos = formatp;
|
||||||
for (; *pos && !_vl_vsss_eof(fp,floc); ++pos) {
|
for (; *pos && !_vl_vsss_eof(fp,floc); ++pos) {
|
||||||
//VL_PRINTF("_vlscan fmt='%c' floc=%d file='%c'\n", pos[0], floc, _vl_vsss_peek(fp,floc,fromp,fstr));
|
//VL_PRINTF_MT("_vlscan fmt='%c' floc=%d file='%c'\n", pos[0], floc, _vl_vsss_peek(fp,floc,fromp,fstr));
|
||||||
if (!inPct && pos[0]=='%') {
|
if (!inPct && pos[0]=='%') {
|
||||||
inPct = true;
|
inPct = true;
|
||||||
} else if (!inPct && isspace(pos[0])) { // Format spaces
|
} else if (!inPct && isspace(pos[0])) { // Format spaces
|
||||||
|
|
@ -768,7 +783,7 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
std::string msg = std::string("Unknown _vl_vsscanf code: ")+pos[0];
|
std::string msg = std::string("Unknown _vl_vsscanf code: ")+pos[0];
|
||||||
vl_fatal(__FILE__,__LINE__,"",msg.c_str());
|
VL_FATAL_MT(__FILE__,__LINE__,"",msg.c_str());
|
||||||
break;
|
break;
|
||||||
} // switch
|
} // switch
|
||||||
|
|
||||||
|
|
@ -836,7 +851,7 @@ IData VL_FGETS_IXI(int obits, void* destp, IData fpi) {
|
||||||
char buffer[VL_TO_STRING_MAX_WORDS*VL_WORDSIZE+1];
|
char buffer[VL_TO_STRING_MAX_WORDS*VL_WORDSIZE+1];
|
||||||
// V3Emit has static check that bytes < VL_TO_STRING_MAX_WORDS, but be safe
|
// V3Emit has static check that bytes < VL_TO_STRING_MAX_WORDS, but be safe
|
||||||
if (VL_UNLIKELY(bytes > VL_TO_STRING_MAX_WORDS*VL_WORDSIZE)) {
|
if (VL_UNLIKELY(bytes > VL_TO_STRING_MAX_WORDS*VL_WORDSIZE)) {
|
||||||
vl_fatal(__FILE__,__LINE__,"","Internal: fgets buffer overrun");
|
VL_FATAL_MT(__FILE__,__LINE__,"","Internal: fgets buffer overrun");
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't use fgets, as we must read \0s.
|
// We don't use fgets, as we must read \0s.
|
||||||
|
|
@ -963,8 +978,7 @@ void VL_WRITEF(const char* formatp, ...) {
|
||||||
_vl_vsformat(output, formatp, ap);
|
_vl_vsformat(output, formatp, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
// Users can redefine VL_PRINTF if they wish.
|
VL_PRINTF_MT("%s", output.c_str());
|
||||||
VL_PRINTF("%s", output.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VL_FWRITEF(IData fpi, const char* formatp, ...) {
|
void VL_FWRITEF(IData fpi, const char* formatp, ...) {
|
||||||
|
|
@ -1045,7 +1059,7 @@ void VL_READMEM_N(bool hex, int width, int depth, int array_lsb, int fnwords,
|
||||||
FILE* fp = fopen(ofilenamep.c_str(), "r");
|
FILE* fp = fopen(ofilenamep.c_str(), "r");
|
||||||
if (VL_UNLIKELY(!fp)) {
|
if (VL_UNLIKELY(!fp)) {
|
||||||
// We don't report the Verilog source filename as it slow to have to pass it down
|
// We don't report the Verilog source filename as it slow to have to pass it down
|
||||||
vl_fatal (ofilenamep.c_str(), 0, "", "$readmem file not found");
|
VL_FATAL_MT (ofilenamep.c_str(), 0, "", "$readmem file not found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Prep for reading
|
// Prep for reading
|
||||||
|
|
@ -1091,7 +1105,7 @@ void VL_READMEM_N(bool hex, int width, int depth, int array_lsb, int fnwords,
|
||||||
//printf(" Value width=%d @%x = %c\n", width, addr, c);
|
//printf(" Value width=%d @%x = %c\n", width, addr, c);
|
||||||
if (VL_UNLIKELY(addr >= static_cast<IData>(depth+array_lsb)
|
if (VL_UNLIKELY(addr >= static_cast<IData>(depth+array_lsb)
|
||||||
|| addr < static_cast<IData>(array_lsb))) {
|
|| addr < static_cast<IData>(array_lsb))) {
|
||||||
vl_fatal (ofilenamep.c_str(), linenum, "", "$readmem file address beyond bounds of array");
|
VL_FATAL_MT (ofilenamep.c_str(), linenum, "", "$readmem file address beyond bounds of array");
|
||||||
} else {
|
} else {
|
||||||
int entry = addr - array_lsb;
|
int entry = addr - array_lsb;
|
||||||
QData shift = hex ? VL_ULL(4) : VL_ULL(1);
|
QData shift = hex ? VL_ULL(4) : VL_ULL(1);
|
||||||
|
|
@ -1120,14 +1134,14 @@ void VL_READMEM_N(bool hex, int width, int depth, int array_lsb, int fnwords,
|
||||||
datap[0] |= value;
|
datap[0] |= value;
|
||||||
}
|
}
|
||||||
if (VL_UNLIKELY(value>=(1<<shift))) {
|
if (VL_UNLIKELY(value>=(1<<shift))) {
|
||||||
vl_fatal (ofilenamep.c_str(), linenum, "", "$readmemb (binary) file contains hex characters");
|
VL_FATAL_MT (ofilenamep.c_str(), linenum, "", "$readmemb (binary) file contains hex characters");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
innum = true;
|
innum = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vl_fatal (ofilenamep.c_str(), linenum, "", "$readmem file syntax error");
|
VL_FATAL_MT (ofilenamep.c_str(), linenum, "", "$readmem file syntax error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastc = c;
|
lastc = c;
|
||||||
|
|
@ -1137,7 +1151,7 @@ void VL_READMEM_N(bool hex, int width, int depth, int array_lsb, int fnwords,
|
||||||
// Final checks
|
// Final checks
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
if (VL_UNLIKELY(end != VL_UL(0xffffffff) && addr != (end+1))) {
|
if (VL_UNLIKELY(end != VL_UL(0xffffffff) && addr != (end+1))) {
|
||||||
vl_fatal (ofilenamep.c_str(), linenum, "", "$readmem file ended before specified ending-address");
|
VL_FATAL_MT (ofilenamep.c_str(), linenum, "", "$readmem file ended before specified ending-address");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1303,7 +1317,7 @@ void Verilated::flushCb(VerilatedVoidCb cb) {
|
||||||
else if (!s_flushCb) { s_flushCb=cb; }
|
else if (!s_flushCb) { s_flushCb=cb; }
|
||||||
else {
|
else {
|
||||||
// Someday we may allow multiple callbacks ala atexit(), but until then
|
// Someday we may allow multiple callbacks ala atexit(), but until then
|
||||||
vl_fatal("unknown",0,"", "Verilated::flushCb called twice with different callbacks");
|
VL_FATAL_MT("unknown",0,"", "Verilated::flushCb called twice with different callbacks");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1412,7 +1426,7 @@ void VerilatedScope::exportInsert(int finalize, const char* namep, void* cb) {
|
||||||
if (funcnum >= m_funcnumMax) { m_funcnumMax = funcnum+1; }
|
if (funcnum >= m_funcnumMax) { m_funcnumMax = funcnum+1; }
|
||||||
} else {
|
} else {
|
||||||
if (VL_UNLIKELY(funcnum >= m_funcnumMax)) {
|
if (VL_UNLIKELY(funcnum >= m_funcnumMax)) {
|
||||||
vl_fatal(__FILE__,__LINE__,"","Internal: Bad funcnum vs. pre-finalize maximum");
|
VL_FATAL_MT(__FILE__,__LINE__,"","Internal: Bad funcnum vs. pre-finalize maximum");
|
||||||
}
|
}
|
||||||
if (VL_UNLIKELY(!m_callbacksp)) { // First allocation
|
if (VL_UNLIKELY(!m_callbacksp)) { // First allocation
|
||||||
m_callbacksp = new void* [m_funcnumMax];
|
m_callbacksp = new void* [m_funcnumMax];
|
||||||
|
|
@ -1445,7 +1459,7 @@ void VerilatedScope::varInsert(int finalize, const char* namep, void* datap,
|
||||||
} else {
|
} else {
|
||||||
// We could have a linked list of ranges, but really this whole thing needs
|
// We could have a linked list of ranges, but really this whole thing needs
|
||||||
// to be generalized to support structs and unions, etc.
|
// to be generalized to support structs and unions, etc.
|
||||||
vl_fatal(__FILE__,__LINE__,"",(std::string("Unsupported multi-dimensional public varInsert: ")+namep).c_str());
|
VL_FATAL_MT(__FILE__,__LINE__,"",(std::string("Unsupported multi-dimensional public varInsert: ")+namep).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
@ -1469,7 +1483,7 @@ void* VerilatedScope::exportFindNullError(int funcnum) {
|
||||||
std::string msg = (std::string("Testbench C called '")
|
std::string msg = (std::string("Testbench C called '")
|
||||||
+VerilatedImp::exportName(funcnum)
|
+VerilatedImp::exportName(funcnum)
|
||||||
+"' but scope wasn't set, perhaps due to dpi import call without 'context'");
|
+"' but scope wasn't set, perhaps due to dpi import call without 'context'");
|
||||||
vl_fatal("unknown",0,"", msg.c_str());
|
VL_FATAL_MT("unknown",0,"", msg.c_str());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1479,22 +1493,22 @@ void* VerilatedScope::exportFindError(int funcnum) const {
|
||||||
+VerilatedImp::exportName(funcnum)
|
+VerilatedImp::exportName(funcnum)
|
||||||
+"' but this DPI export function exists only in other scopes, not scope '"
|
+"' but this DPI export function exists only in other scopes, not scope '"
|
||||||
+name()+"'");
|
+name()+"'");
|
||||||
vl_fatal("unknown",0,"", msg.c_str());
|
VL_FATAL_MT("unknown",0,"", msg.c_str());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VerilatedScope::scopeDump() const {
|
void VerilatedScope::scopeDump() const {
|
||||||
VL_PRINTF(" SCOPE %p: %s\n", this, name());
|
VL_PRINTF_MT(" SCOPE %p: %s\n", this, name());
|
||||||
for (int i=0; i<m_funcnumMax; ++i) {
|
for (int i=0; i<m_funcnumMax; ++i) {
|
||||||
if (m_callbacksp && m_callbacksp[i]) {
|
if (m_callbacksp && m_callbacksp[i]) {
|
||||||
VL_PRINTF(" DPI-EXPORT %p: %s\n",
|
VL_PRINTF_MT(" DPI-EXPORT %p: %s\n",
|
||||||
m_callbacksp[i], VerilatedImp::exportName(i));
|
m_callbacksp[i], VerilatedImp::exportName(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (VerilatedVarNameMap* varsp = this->varsp()) {
|
if (VerilatedVarNameMap* varsp = this->varsp()) {
|
||||||
for (VerilatedVarNameMap::const_iterator it = varsp->begin();
|
for (VerilatedVarNameMap::const_iterator it = varsp->begin();
|
||||||
it != varsp->end(); ++it) {
|
it != varsp->end(); ++it) {
|
||||||
VL_PRINTF(" VAR %p: %s\n", &(it->second), it->first);
|
VL_PRINTF_MT(" VAR %p: %s\n", &(it->second), it->first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -159,16 +159,6 @@ public:
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//=========================================================================
|
|
||||||
// Functions overridable by user defines
|
|
||||||
|
|
||||||
#ifndef VL_PRINTF
|
|
||||||
# define VL_PRINTF printf ///< Print ala printf; may redefine if desired
|
|
||||||
#endif
|
|
||||||
#ifndef VL_VPRINTF
|
|
||||||
# define VL_VPRINTF vprintf ///< Print ala vprintf; may redefine if desired
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
/// Verilator symbol table base class
|
/// Verilator symbol table base class
|
||||||
|
|
||||||
|
|
@ -329,17 +319,42 @@ public:
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
// Extern functions -- User may override -- See verilated.cpp
|
// Extern functions -- User may override -- See verilated.cpp
|
||||||
|
|
||||||
|
#ifndef VL_PRINTF
|
||||||
|
# define VL_PRINTF printf ///< Print ala printf; may redefine if desired
|
||||||
|
#endif
|
||||||
|
#ifndef VL_VPRINTF
|
||||||
|
# define VL_VPRINTF vprintf ///< Print ala vprintf; may redefine if desired
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Routine to call for $finish
|
/// Routine to call for $finish
|
||||||
|
/// User code may wish to replace this function, to do so, define VL_USER_FINISH.
|
||||||
|
/// Verilator internal code must call VL_FINISH_MT instead, which eventually calls this.
|
||||||
extern void vl_finish (const char* filename, int linenum, const char* hier);
|
extern void vl_finish (const char* filename, int linenum, const char* hier);
|
||||||
|
|
||||||
/// Routine to call for $stop
|
/// Routine to call for $stop
|
||||||
|
/// User code may wish to replace this function, to do so, define VL_USER_STOP.
|
||||||
|
/// Verilator internal code must call VL_FINISH_MT instead, which eventually calls this.
|
||||||
extern void vl_stop (const char* filename, int linenum, const char* hier);
|
extern void vl_stop (const char* filename, int linenum, const char* hier);
|
||||||
|
|
||||||
/// Routine to call for a couple of fatal messages
|
/// Routine to call for a couple of fatal messages
|
||||||
|
/// User code may wish to replace this function, to do so, define VL_USER_FATAL.
|
||||||
|
/// Verilator internal code must call VL_FINISH_MT instead, which eventually calls this.
|
||||||
extern void vl_fatal (const char* filename, int linenum, const char* hier,
|
extern void vl_fatal (const char* filename, int linenum, const char* hier,
|
||||||
const char* msg);
|
const char* msg);
|
||||||
|
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
// Extern functions -- Slow path
|
// Extern functions -- Slow path
|
||||||
|
|
||||||
|
/// Multithread safe wrapper for calls to $finish
|
||||||
|
extern void VL_FINISH_MT (const char* filename, int linenum, const char* hier);
|
||||||
|
/// Multithread safe wrapper for calls to $stop
|
||||||
|
extern void VL_STOP_MT (const char* filename, int linenum, const char* hier);
|
||||||
|
/// Multithread safe wrapper to call for a couple of fatal messages
|
||||||
|
extern void VL_FATAL_MT (const char* filename, int linenum, const char* hier,
|
||||||
|
const char* msg);
|
||||||
|
/// Print a string, multithread safe. Eventually VL_PRINTF will get called.
|
||||||
|
#define VL_PRINTF_MT VL_PRINTF
|
||||||
|
|
||||||
extern IData VL_RANDOM_I(int obits); ///< Randomize a signal
|
extern IData VL_RANDOM_I(int obits); ///< Randomize a signal
|
||||||
extern QData VL_RANDOM_Q(int obits); ///< Randomize a signal
|
extern QData VL_RANDOM_Q(int obits); ///< Randomize a signal
|
||||||
extern WDataOutP VL_RANDOM_W(int obits, WDataOutP outwp); ///< Randomize a signal
|
extern WDataOutP VL_RANDOM_W(int obits, WDataOutP outwp); ///< Randomize a signal
|
||||||
|
|
|
||||||
|
|
@ -208,14 +208,14 @@ private:
|
||||||
}
|
}
|
||||||
static void selftest() {
|
static void selftest() {
|
||||||
// Little selftest
|
// Little selftest
|
||||||
if (combineHier ("a.b.c","a.b.c") !="a.b.c") vl_fatal(__FILE__,__LINE__,"","%Error: selftest\n");
|
if (combineHier ("a.b.c","a.b.c") !="a.b.c") VL_FATAL_MT(__FILE__,__LINE__,"","%Error: selftest\n");
|
||||||
if (combineHier ("a.b.c","a.b") !="a.b*") vl_fatal(__FILE__,__LINE__,"","%Error: selftest\n");
|
if (combineHier ("a.b.c","a.b") !="a.b*") VL_FATAL_MT(__FILE__,__LINE__,"","%Error: selftest\n");
|
||||||
if (combineHier ("a.x.c","a.y.c") !="a.*.c") vl_fatal(__FILE__,__LINE__,"","%Error: selftest\n");
|
if (combineHier ("a.x.c","a.y.c") !="a.*.c") VL_FATAL_MT(__FILE__,__LINE__,"","%Error: selftest\n");
|
||||||
if (combineHier ("a.z.z.z.c","a.b.c") !="a.*.c") vl_fatal(__FILE__,__LINE__,"","%Error: selftest\n");
|
if (combineHier ("a.z.z.z.c","a.b.c") !="a.*.c") VL_FATAL_MT(__FILE__,__LINE__,"","%Error: selftest\n");
|
||||||
if (combineHier ("z","a") !="*") vl_fatal(__FILE__,__LINE__,"","%Error: selftest\n");
|
if (combineHier ("z","a") !="*") VL_FATAL_MT(__FILE__,__LINE__,"","%Error: selftest\n");
|
||||||
if (combineHier ("q.a","q.b") !="q.*") vl_fatal(__FILE__,__LINE__,"","%Error: selftest\n");
|
if (combineHier ("q.a","q.b") !="q.*") VL_FATAL_MT(__FILE__,__LINE__,"","%Error: selftest\n");
|
||||||
if (combineHier ("q.za","q.zb") !="q.z*") vl_fatal(__FILE__,__LINE__,"","%Error: selftest\n");
|
if (combineHier ("q.za","q.zb") !="q.z*") VL_FATAL_MT(__FILE__,__LINE__,"","%Error: selftest\n");
|
||||||
if (combineHier ("1.2.3.a","9.8.7.a") !="*.a") vl_fatal(__FILE__,__LINE__,"","%Error: selftest\n");
|
if (combineHier ("1.2.3.a","9.8.7.a") !="*.a") VL_FATAL_MT(__FILE__,__LINE__,"","%Error: selftest\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -303,7 +303,7 @@ public:
|
||||||
addKeynum++;
|
addKeynum++;
|
||||||
if (!legalKey(key)) {
|
if (!legalKey(key)) {
|
||||||
std::string msg = "%Error: Coverage keys of one character, or letter+digit are illegal: "+key;
|
std::string msg = "%Error: Coverage keys of one character, or letter+digit are illegal: "+key;
|
||||||
vl_fatal("",0,"",msg.c_str());
|
VL_FATAL_MT("",0,"",msg.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -314,14 +314,14 @@ public:
|
||||||
|
|
||||||
void write (const char* filename) {
|
void write (const char* filename) {
|
||||||
#ifndef VM_COVERAGE
|
#ifndef VM_COVERAGE
|
||||||
vl_fatal("",0,"","%Error: Called VerilatedCov::write when VM_COVERAGE disabled\n");
|
VL_FATAL_MT("",0,"","%Error: Called VerilatedCov::write when VM_COVERAGE disabled\n");
|
||||||
#endif
|
#endif
|
||||||
selftest();
|
selftest();
|
||||||
|
|
||||||
std::ofstream os (filename);
|
std::ofstream os (filename);
|
||||||
if (os.fail()) {
|
if (os.fail()) {
|
||||||
std::string msg = std::string("%Error: Can't write '")+filename+"'";
|
std::string msg = std::string("%Error: Can't write '")+filename+"'";
|
||||||
vl_fatal("",0,"",msg.c_str());
|
VL_FATAL_MT("",0,"",msg.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
os << "# SystemC::Coverage-3\n";
|
os << "# SystemC::Coverage-3\n";
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,11 @@
|
||||||
|
|
||||||
// Not supported yet
|
// Not supported yet
|
||||||
#define _VL_SVDPI_UNIMP() \
|
#define _VL_SVDPI_UNIMP() \
|
||||||
vl_fatal(__FILE__,__LINE__,"",(std::string("%%Error: Unsupported DPI function: ")+VL_FUNC).c_str())
|
VL_FATAL_MT(__FILE__,__LINE__,"",(std::string("%%Error: Unsupported DPI function: ")+VL_FUNC).c_str())
|
||||||
|
|
||||||
// Function requires a "context" in the import declaration
|
// Function requires a "context" in the import declaration
|
||||||
#define _VL_SVDPI_CONTEXT_WARN() \
|
#define _VL_SVDPI_CONTEXT_WARN() \
|
||||||
VL_PRINTF("%%Warning: DPI C Function called by Verilog DPI import with missing 'context' keyword.\n");
|
VL_PRINTF_MT("%%Warning: DPI C Function called by Verilog DPI import with missing 'context' keyword.\n");
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
//======================================================================
|
//======================================================================
|
||||||
|
|
|
||||||
|
|
@ -78,13 +78,13 @@ public: // But only for verilated*.cpp
|
||||||
}
|
}
|
||||||
~VerilatedImp() {}
|
~VerilatedImp() {}
|
||||||
static void internalsDump() {
|
static void internalsDump() {
|
||||||
VL_PRINTF("internalsDump:\n");
|
VL_PRINTF_MT("internalsDump:\n");
|
||||||
VL_PRINTF(" Argv:");
|
VL_PRINTF_MT(" Argv:");
|
||||||
for (ArgVec::const_iterator it=s_s.m_argVec.begin(); it!=s_s.m_argVec.end(); ++it) {
|
for (ArgVec::const_iterator it=s_s.m_argVec.begin(); it!=s_s.m_argVec.end(); ++it) {
|
||||||
VL_PRINTF(" %s",it->c_str());
|
VL_PRINTF_MT(" %s",it->c_str());
|
||||||
}
|
}
|
||||||
VL_PRINTF("\n");
|
VL_PRINTF_MT("\n");
|
||||||
VL_PRINTF(" Version: %s %s\n", Verilated::productName(), Verilated::productVersion());
|
VL_PRINTF_MT(" Version: %s %s\n", Verilated::productName(), Verilated::productVersion());
|
||||||
scopesDump();
|
scopesDump();
|
||||||
exportsDump();
|
exportsDump();
|
||||||
userDump();
|
userDump();
|
||||||
|
|
@ -105,9 +105,9 @@ public: // But only for verilated*.cpp
|
||||||
size_t len = strlen(prefixp);
|
size_t len = strlen(prefixp);
|
||||||
if (VL_UNLIKELY(!s_s.m_argVecLoaded)) {
|
if (VL_UNLIKELY(!s_s.m_argVecLoaded)) {
|
||||||
s_s.m_argVecLoaded = true; // Complain only once
|
s_s.m_argVecLoaded = true; // Complain only once
|
||||||
vl_fatal("unknown",0,"",
|
VL_FATAL_MT("unknown",0,"",
|
||||||
"%Error: Verilog called $test$plusargs or $value$plusargs without"
|
"%Error: Verilog called $test$plusargs or $value$plusargs without"
|
||||||
" testbench C first calling Verilated::commandArgs(argc,argv).");
|
" testbench C first calling Verilated::commandArgs(argc,argv).");
|
||||||
}
|
}
|
||||||
for (ArgVec::const_iterator it=s_s.m_argVec.begin(); it!=s_s.m_argVec.end(); ++it) {
|
for (ArgVec::const_iterator it=s_s.m_argVec.begin(); it!=s_s.m_argVec.end(); ++it) {
|
||||||
if ((*it)[0]=='+') {
|
if ((*it)[0]=='+') {
|
||||||
|
|
@ -147,8 +147,8 @@ private:
|
||||||
static void userDump() {
|
static void userDump() {
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (UserMap::const_iterator it=s_s.m_userMap.begin(); it!=s_s.m_userMap.end(); ++it) {
|
for (UserMap::const_iterator it=s_s.m_userMap.begin(); it!=s_s.m_userMap.end(); ++it) {
|
||||||
if (first) { VL_PRINTF(" userDump:\n"); first=false; }
|
if (first) { VL_PRINTF_MT(" userDump:\n"); first=false; }
|
||||||
VL_PRINTF(" DPI_USER_DATA scope %p key %p: %p\n",
|
VL_PRINTF_MT(" DPI_USER_DATA scope %p key %p: %p\n",
|
||||||
it->first.first, it->first.second, it->second);
|
it->first.first, it->first.second, it->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -174,12 +174,12 @@ public: // But only for verilated*.cpp
|
||||||
if (it != s_s.m_nameMap.end()) s_s.m_nameMap.erase(it);
|
if (it != s_s.m_nameMap.end()) s_s.m_nameMap.erase(it);
|
||||||
}
|
}
|
||||||
static void scopesDump() {
|
static void scopesDump() {
|
||||||
VL_PRINTF(" scopesDump:\n");
|
VL_PRINTF_MT(" scopesDump:\n");
|
||||||
for (VerilatedScopeNameMap::const_iterator it=s_s.m_nameMap.begin(); it!=s_s.m_nameMap.end(); ++it) {
|
for (VerilatedScopeNameMap::const_iterator it=s_s.m_nameMap.begin(); it!=s_s.m_nameMap.end(); ++it) {
|
||||||
const VerilatedScope* scopep = it->second;
|
const VerilatedScope* scopep = it->second;
|
||||||
scopep->scopeDump();
|
scopep->scopeDump();
|
||||||
}
|
}
|
||||||
VL_PRINTF("\n");
|
VL_PRINTF_MT("\n");
|
||||||
}
|
}
|
||||||
static const VerilatedScopeNameMap* scopeNameMap() {
|
static const VerilatedScopeNameMap* scopeNameMap() {
|
||||||
return &s_s.m_nameMap;
|
return &s_s.m_nameMap;
|
||||||
|
|
@ -209,7 +209,7 @@ public: // But only for verilated*.cpp
|
||||||
if (VL_LIKELY(it != s_s.m_exportMap.end())) return it->second;
|
if (VL_LIKELY(it != s_s.m_exportMap.end())) return it->second;
|
||||||
std::string msg = (std::string("%Error: Testbench C called ")+namep
|
std::string msg = (std::string("%Error: Testbench C called ")+namep
|
||||||
+" but no such DPI export function name exists in ANY model");
|
+" but no such DPI export function name exists in ANY model");
|
||||||
vl_fatal("unknown",0,"", msg.c_str());
|
VL_FATAL_MT("unknown",0,"", msg.c_str());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
static const char* exportName(int funcnum) {
|
static const char* exportName(int funcnum) {
|
||||||
|
|
@ -222,8 +222,8 @@ public: // But only for verilated*.cpp
|
||||||
static void exportsDump() {
|
static void exportsDump() {
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (ExportNameMap::const_iterator it=s_s.m_exportMap.begin(); it!=s_s.m_exportMap.end(); ++it) {
|
for (ExportNameMap::const_iterator it=s_s.m_exportMap.begin(); it!=s_s.m_exportMap.end(); ++it) {
|
||||||
if (first) { VL_PRINTF(" exportDump:\n"); first=false; }
|
if (first) { VL_PRINTF_MT(" exportDump:\n"); first=false; }
|
||||||
VL_PRINTF(" DPI_EXPORT_NAME %05d: %s\n", it->second, it->first);
|
VL_PRINTF_MT(" DPI_EXPORT_NAME %05d: %s\n", it->second, it->first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// We don't free up m_exportMap until the end, because we can't be sure
|
// We don't free up m_exportMap until the end, because we can't be sure
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ VerilatedDeserialize& VerilatedDeserialize::readAssert (const void* __restrict d
|
||||||
if (VL_UNLIKELY(readDiffers(datap,size))) {
|
if (VL_UNLIKELY(readDiffers(datap,size))) {
|
||||||
std::string fn = filename();
|
std::string fn = filename();
|
||||||
std::string msg = std::string("Can't deserialize save-restore file as was made from different model");
|
std::string msg = std::string("Can't deserialize save-restore file as was made from different model");
|
||||||
vl_fatal(fn.c_str(), 0, "", msg.c_str());
|
VL_FATAL_MT(fn.c_str(), 0, "", msg.c_str());
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
return *this; // For function chaining
|
return *this; // For function chaining
|
||||||
|
|
@ -83,7 +83,7 @@ void VerilatedDeserialize::header() {
|
||||||
if (VL_UNLIKELY(os.readDiffers(VLTSAVE_HEADER_STR, strlen(VLTSAVE_HEADER_STR)))) {
|
if (VL_UNLIKELY(os.readDiffers(VLTSAVE_HEADER_STR, strlen(VLTSAVE_HEADER_STR)))) {
|
||||||
std::string fn = filename();
|
std::string fn = filename();
|
||||||
std::string msg = std::string("Can't deserialize; file has wrong header signature");
|
std::string msg = std::string("Can't deserialize; file has wrong header signature");
|
||||||
vl_fatal(fn.c_str(), 0, "", msg.c_str());
|
VL_FATAL_MT(fn.c_str(), 0, "", msg.c_str());
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
os.read(Verilated::serializedPtr(), Verilated::serializedSize());
|
os.read(Verilated::serializedPtr(), Verilated::serializedSize());
|
||||||
|
|
@ -100,7 +100,7 @@ void VerilatedDeserialize::trailer() {
|
||||||
if (VL_UNLIKELY(os.readDiffers(VLTSAVE_TRAILER_STR, strlen(VLTSAVE_TRAILER_STR)))) {
|
if (VL_UNLIKELY(os.readDiffers(VLTSAVE_TRAILER_STR, strlen(VLTSAVE_TRAILER_STR)))) {
|
||||||
std::string fn = filename();
|
std::string fn = filename();
|
||||||
std::string msg = std::string("Can't deserialize; file has wrong end-of-file signature");
|
std::string msg = std::string("Can't deserialize; file has wrong end-of-file signature");
|
||||||
vl_fatal(fn.c_str(), 0, "", msg.c_str());
|
VL_FATAL_MT(fn.c_str(), 0, "", msg.c_str());
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -112,7 +112,7 @@ void VerilatedDeserialize::trailer() {
|
||||||
|
|
||||||
void VerilatedSave::open (const char* filenamep) {
|
void VerilatedSave::open (const char* filenamep) {
|
||||||
if (isOpen()) return;
|
if (isOpen()) return;
|
||||||
VL_DEBUG_IF(VL_PRINTF("-vltSave: opening save file %s\n",filenamep););
|
VL_DEBUG_IF(VL_PRINTF_MT("-vltSave: opening save file %s\n",filenamep););
|
||||||
|
|
||||||
if (filenamep[0]=='|') {
|
if (filenamep[0]=='|') {
|
||||||
assert(0); // Not supported yet.
|
assert(0); // Not supported yet.
|
||||||
|
|
@ -134,7 +134,7 @@ void VerilatedSave::open (const char* filenamep) {
|
||||||
|
|
||||||
void VerilatedRestore::open (const char* filenamep) {
|
void VerilatedRestore::open (const char* filenamep) {
|
||||||
if (isOpen()) return;
|
if (isOpen()) return;
|
||||||
VL_DEBUG_IF(VL_PRINTF("-vltRestore: opening restore file %s\n",filenamep););
|
VL_DEBUG_IF(VL_PRINTF_MT("-vltRestore: opening restore file %s\n",filenamep););
|
||||||
|
|
||||||
if (filenamep[0]=='|') {
|
if (filenamep[0]=='|') {
|
||||||
assert(0); // Not supported yet.
|
assert(0); // Not supported yet.
|
||||||
|
|
@ -188,7 +188,7 @@ void VerilatedSave::flush() {
|
||||||
if (errno != EAGAIN && errno != EINTR) {
|
if (errno != EAGAIN && errno != EINTR) {
|
||||||
// write failed, presume error (perhaps out of disk space)
|
// write failed, presume error (perhaps out of disk space)
|
||||||
std::string msg = std::string(__FUNCTION__)+": "+strerror(errno);
|
std::string msg = std::string(__FUNCTION__)+": "+strerror(errno);
|
||||||
vl_fatal("",0,"",msg.c_str());
|
VL_FATAL_MT("",0,"",msg.c_str());
|
||||||
close();
|
close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -216,7 +216,7 @@ void VerilatedRestore::fill() {
|
||||||
if (errno != EAGAIN && errno != EINTR) {
|
if (errno != EAGAIN && errno != EINTR) {
|
||||||
// write failed, presume error (perhaps out of disk space)
|
// write failed, presume error (perhaps out of disk space)
|
||||||
std::string msg = std::string(__FUNCTION__)+": "+strerror(errno);
|
std::string msg = std::string(__FUNCTION__)+": "+strerror(errno);
|
||||||
vl_fatal("",0,"",msg.c_str());
|
VL_FATAL_MT("",0,"",msg.c_str());
|
||||||
close();
|
close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -314,7 +314,7 @@ void VerilatedVcd::printTime (vluint64_t timeui) {
|
||||||
static bool backTime = false;
|
static bool backTime = false;
|
||||||
if (!backTime) {
|
if (!backTime) {
|
||||||
backTime = true;
|
backTime = true;
|
||||||
VL_PRINTF("VCD time is moving backwards, wave file may be incorrect.\n");
|
VL_PRINTF_MT("VCD time is moving backwards, wave file may be incorrect.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_timeLastDump = timeui;
|
m_timeLastDump = timeui;
|
||||||
|
|
@ -353,7 +353,7 @@ void VerilatedVcd::bufferFlush () {
|
||||||
if (errno != EAGAIN && errno != EINTR) {
|
if (errno != EAGAIN && errno != EINTR) {
|
||||||
// write failed, presume error (perhaps out of disk space)
|
// write failed, presume error (perhaps out of disk space)
|
||||||
std::string msg = std::string("VerilatedVcd::bufferFlush: ")+strerror(errno);
|
std::string msg = std::string("VerilatedVcd::bufferFlush: ")+strerror(errno);
|
||||||
vl_fatal("",0,"",msg.c_str());
|
VL_FATAL_MT("",0,"",msg.c_str());
|
||||||
closeErr();
|
closeErr();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -504,7 +504,7 @@ void VerilatedVcd::module (const std::string& name) {
|
||||||
|
|
||||||
void VerilatedVcd::declare (vluint32_t code, const char* name, const char* wirep,
|
void VerilatedVcd::declare (vluint32_t code, const char* name, const char* wirep,
|
||||||
int arraynum, bool tri, bool bussed, int msb, int lsb) {
|
int arraynum, bool tri, bool bussed, int msb, int lsb) {
|
||||||
if (!code) { vl_fatal(__FILE__,__LINE__,"","Internal: internal trace problem, code 0 is illegal"); }
|
if (!code) { VL_FATAL_MT(__FILE__,__LINE__,"","Internal: internal trace problem, code 0 is illegal"); }
|
||||||
|
|
||||||
int bits = ((msb>lsb)?(msb-lsb):(lsb-msb))+1;
|
int bits = ((msb>lsb)?(msb-lsb):(lsb-msb))+1;
|
||||||
int codesNeeded = 1+int(bits/32);
|
int codesNeeded = 1+int(bits/32);
|
||||||
|
|
@ -623,7 +623,7 @@ void VerilatedVcd::addCallback (
|
||||||
{
|
{
|
||||||
if (VL_UNLIKELY(isOpen())) {
|
if (VL_UNLIKELY(isOpen())) {
|
||||||
std::string msg = std::string("Internal: ")+__FILE__+"::"+__FUNCTION__+" called with already open file";
|
std::string msg = std::string("Internal: ")+__FILE__+"::"+__FUNCTION__+" called with already open file";
|
||||||
vl_fatal(__FILE__,__LINE__,"",msg.c_str());
|
VL_FATAL_MT(__FILE__,__LINE__,"",msg.c_str());
|
||||||
}
|
}
|
||||||
VerilatedVcdCallInfo* vci = new VerilatedVcdCallInfo(initcb, fullcb, changecb, userthis, nextCode());
|
VerilatedVcdCallInfo* vci = new VerilatedVcdCallInfo(initcb, fullcb, changecb, userthis, nextCode());
|
||||||
m_callbacks.push_back(vci);
|
m_callbacks.push_back(vci);
|
||||||
|
|
|
||||||
|
|
@ -389,7 +389,7 @@ const char* VerilatedVpiError::strFromVpiProp(PLI_INT32 vpiVal) {
|
||||||
std::string msg = std::string("%Error: ") \
|
std::string msg = std::string("%Error: ") \
|
||||||
+ "GOT = '"+((got)?(got):"<null>")+"'" \
|
+ "GOT = '"+((got)?(got):"<null>")+"'" \
|
||||||
+ " EXP = '"+((exp)?(exp):"<null>")+"'"; \
|
+ " EXP = '"+((exp)?(exp):"<null>")+"'"; \
|
||||||
vl_fatal(__FILE__,__LINE__,"",msg.c_str()); \
|
VL_FATAL_MT(__FILE__,__LINE__,"",msg.c_str()); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHECK_ENUM_STR(fn, enum) \
|
#define CHECK_ENUM_STR(fn, enum) \
|
||||||
|
|
@ -444,7 +444,7 @@ vpiHandle vpi_register_cb(p_cb_data cb_data_p) {
|
||||||
QData time = 0;
|
QData time = 0;
|
||||||
if (cb_data_p->time) time = _VL_SET_QII(cb_data_p->time->high, cb_data_p->time->low);
|
if (cb_data_p->time) time = _VL_SET_QII(cb_data_p->time->high, cb_data_p->time->low);
|
||||||
VerilatedVpioCb* vop = new VerilatedVpioCb(cb_data_p, VL_TIME_Q()+time);
|
VerilatedVpioCb* vop = new VerilatedVpioCb(cb_data_p, VL_TIME_Q()+time);
|
||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: vpi_register_cb %d %p delay=%" VL_PRI64 "u\n",cb_data_p->reason,vop,time););
|
VL_DEBUG_IF_PLI(VL_PRINTF_MT("-vltVpi: vpi_register_cb %d %p delay=%" VL_PRI64 "u\n",cb_data_p->reason,vop,time););
|
||||||
VerilatedVpi::cbTimedAdd(vop);
|
VerilatedVpi::cbTimedAdd(vop);
|
||||||
return vop->castVpiHandle();
|
return vop->castVpiHandle();
|
||||||
}
|
}
|
||||||
|
|
@ -459,7 +459,7 @@ vpiHandle vpi_register_cb(p_cb_data cb_data_p) {
|
||||||
case cbExitInteractive: // FALLTHRU // NOP, but need to return handle, so make object
|
case cbExitInteractive: // FALLTHRU // NOP, but need to return handle, so make object
|
||||||
case cbInteractiveScopeChange: { // FALLTHRU // NOP, but need to return handle, so make object
|
case cbInteractiveScopeChange: { // FALLTHRU // NOP, but need to return handle, so make object
|
||||||
VerilatedVpioCb* vop = new VerilatedVpioCb(cb_data_p, 0);
|
VerilatedVpioCb* vop = new VerilatedVpioCb(cb_data_p, 0);
|
||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: vpi_register_cb %d %p\n",cb_data_p->reason,vop););
|
VL_DEBUG_IF_PLI(VL_PRINTF_MT("-vltVpi: vpi_register_cb %d %p\n",cb_data_p->reason,vop););
|
||||||
VerilatedVpi::cbReasonAdd(vop);
|
VerilatedVpi::cbReasonAdd(vop);
|
||||||
return vop->castVpiHandle();
|
return vop->castVpiHandle();
|
||||||
}
|
}
|
||||||
|
|
@ -471,7 +471,7 @@ vpiHandle vpi_register_cb(p_cb_data cb_data_p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PLI_INT32 vpi_remove_cb(vpiHandle object) {
|
PLI_INT32 vpi_remove_cb(vpiHandle object) {
|
||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: vpi_remove_cb %p\n",object););
|
VL_DEBUG_IF_PLI(VL_PRINTF_MT("-vltVpi: vpi_remove_cb %p\n",object););
|
||||||
VerilatedVpioCb* vop = VerilatedVpioCb::castp(object);
|
VerilatedVpioCb* vop = VerilatedVpioCb::castp(object);
|
||||||
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
||||||
if (VL_UNLIKELY(!vop)) return 0;
|
if (VL_UNLIKELY(!vop)) return 0;
|
||||||
|
|
@ -498,7 +498,7 @@ void vpi_get_systf_info(vpiHandle object, p_vpi_systf_data systf_data_p) {
|
||||||
vpiHandle vpi_handle_by_name(PLI_BYTE8* namep, vpiHandle scope) {
|
vpiHandle vpi_handle_by_name(PLI_BYTE8* namep, vpiHandle scope) {
|
||||||
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
||||||
if (VL_UNLIKELY(!namep)) return NULL;
|
if (VL_UNLIKELY(!namep)) return NULL;
|
||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: vpi_handle_by_name %s %p\n",namep,scope););
|
VL_DEBUG_IF_PLI(VL_PRINTF_MT("-vltVpi: vpi_handle_by_name %s %p\n",namep,scope););
|
||||||
VerilatedVpioScope* voScopep = VerilatedVpioScope::castp(scope);
|
VerilatedVpioScope* voScopep = VerilatedVpioScope::castp(scope);
|
||||||
const VerilatedVar* varp;
|
const VerilatedVar* varp;
|
||||||
const VerilatedScope* scopep;
|
const VerilatedScope* scopep;
|
||||||
|
|
@ -530,7 +530,7 @@ vpiHandle vpi_handle_by_name(PLI_BYTE8* namep, vpiHandle scope) {
|
||||||
|
|
||||||
vpiHandle vpi_handle_by_index(vpiHandle object, PLI_INT32 indx) {
|
vpiHandle vpi_handle_by_index(vpiHandle object, PLI_INT32 indx) {
|
||||||
// Used to get array entries
|
// Used to get array entries
|
||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: vpi_handle_by_index %p %d\n",object, indx););
|
VL_DEBUG_IF_PLI(VL_PRINTF_MT("-vltVpi: vpi_handle_by_index %p %d\n",object, indx););
|
||||||
VerilatedVpioVar* varop = VerilatedVpioVar::castp(object);
|
VerilatedVpioVar* varop = VerilatedVpioVar::castp(object);
|
||||||
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
||||||
if (VL_LIKELY(varop)) {
|
if (VL_LIKELY(varop)) {
|
||||||
|
|
@ -555,7 +555,7 @@ vpiHandle vpi_handle_by_index(vpiHandle object, PLI_INT32 indx) {
|
||||||
// for traversing relationships
|
// for traversing relationships
|
||||||
|
|
||||||
vpiHandle vpi_handle(PLI_INT32 type, vpiHandle object) {
|
vpiHandle vpi_handle(PLI_INT32 type, vpiHandle object) {
|
||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: vpi_handle %d %p\n",type,object););
|
VL_DEBUG_IF_PLI(VL_PRINTF_MT("-vltVpi: vpi_handle %d %p\n",type,object););
|
||||||
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case vpiLeftRange: {
|
case vpiLeftRange: {
|
||||||
|
|
@ -597,7 +597,7 @@ vpiHandle vpi_handle_multi(PLI_INT32 type, vpiHandle refHandle1, vpiHandle refHa
|
||||||
}
|
}
|
||||||
|
|
||||||
vpiHandle vpi_iterate(PLI_INT32 type, vpiHandle object) {
|
vpiHandle vpi_iterate(PLI_INT32 type, vpiHandle object) {
|
||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: vpi_iterate %d %p\n",type,object););
|
VL_DEBUG_IF_PLI(VL_PRINTF_MT("-vltVpi: vpi_iterate %d %p\n",type,object););
|
||||||
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case vpiMemoryWord: {
|
case vpiMemoryWord: {
|
||||||
|
|
@ -634,7 +634,7 @@ vpiHandle vpi_iterate(PLI_INT32 type, vpiHandle object) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vpiHandle vpi_scan(vpiHandle object) {
|
vpiHandle vpi_scan(vpiHandle object) {
|
||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: vpi_scan %p\n",object););
|
VL_DEBUG_IF_PLI(VL_PRINTF_MT("-vltVpi: vpi_scan %p\n",object););
|
||||||
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
||||||
VerilatedVpio* vop = VerilatedVpio::castp(object);
|
VerilatedVpio* vop = VerilatedVpio::castp(object);
|
||||||
if (VL_UNLIKELY(!vop)) return NULL;
|
if (VL_UNLIKELY(!vop)) return NULL;
|
||||||
|
|
@ -645,7 +645,7 @@ vpiHandle vpi_scan(vpiHandle object) {
|
||||||
|
|
||||||
PLI_INT32 vpi_get(PLI_INT32 property, vpiHandle object) {
|
PLI_INT32 vpi_get(PLI_INT32 property, vpiHandle object) {
|
||||||
// Leave this in the header file - in many cases the compiler can constant propagate "object"
|
// Leave this in the header file - in many cases the compiler can constant propagate "object"
|
||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: vpi_get %d %p\n",property,object););
|
VL_DEBUG_IF_PLI(VL_PRINTF_MT("-vltVpi: vpi_get %d %p\n",property,object););
|
||||||
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
||||||
switch (property) {
|
switch (property) {
|
||||||
case vpiTimePrecision: {
|
case vpiTimePrecision: {
|
||||||
|
|
@ -686,7 +686,7 @@ PLI_INT64 vpi_get64(PLI_INT32 property, vpiHandle object) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PLI_BYTE8 *vpi_get_str(PLI_INT32 property, vpiHandle object) {
|
PLI_BYTE8 *vpi_get_str(PLI_INT32 property, vpiHandle object) {
|
||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: vpi_get_str %d %p\n",property,object););
|
VL_DEBUG_IF_PLI(VL_PRINTF_MT("-vltVpi: vpi_get_str %d %p\n",property,object););
|
||||||
VerilatedVpio* vop = VerilatedVpio::castp(object);
|
VerilatedVpio* vop = VerilatedVpio::castp(object);
|
||||||
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
||||||
if (VL_UNLIKELY(!vop)) return NULL;
|
if (VL_UNLIKELY(!vop)) return NULL;
|
||||||
|
|
@ -724,7 +724,7 @@ void vpi_get_value(vpiHandle object, p_vpi_value value_p) {
|
||||||
static VL_THREAD_LOCAL char outStr[1+VL_MULS_MAX_WORDS*32]; // Maximum required size is for binary string, one byte per bit plus null termination
|
static VL_THREAD_LOCAL char outStr[1+VL_MULS_MAX_WORDS*32]; // Maximum required size is for binary string, one byte per bit plus null termination
|
||||||
// cppcheck-suppress variableScope
|
// cppcheck-suppress variableScope
|
||||||
static VL_THREAD_LOCAL int outStrSz = sizeof(outStr)-1;
|
static VL_THREAD_LOCAL int outStrSz = sizeof(outStr)-1;
|
||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: vpi_get_value %p\n",object););
|
VL_DEBUG_IF_PLI(VL_PRINTF_MT("-vltVpi: vpi_get_value %p\n",object););
|
||||||
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
||||||
if (VL_UNLIKELY(!value_p)) return;
|
if (VL_UNLIKELY(!value_p)) return;
|
||||||
if (VerilatedVpioVar* vop = VerilatedVpioVar::castp(object)) {
|
if (VerilatedVpioVar* vop = VerilatedVpioVar::castp(object)) {
|
||||||
|
|
@ -751,7 +751,7 @@ void vpi_get_value(vpiHandle object, p_vpi_value value_p) {
|
||||||
case VLVT_WDATA: {
|
case VLVT_WDATA: {
|
||||||
int words = VL_WORDS_I(vop->varp()->range().elements());
|
int words = VL_WORDS_I(vop->varp()->range().elements());
|
||||||
if (VL_UNLIKELY(words >= VL_MULS_MAX_WORDS)) {
|
if (VL_UNLIKELY(words >= VL_MULS_MAX_WORDS)) {
|
||||||
vl_fatal(__FILE__,__LINE__,"", "vpi_get_value with more than VL_MULS_MAX_WORDS; increase and recompile");
|
VL_FATAL_MT(__FILE__,__LINE__,"", "vpi_get_value with more than VL_MULS_MAX_WORDS; increase and recompile");
|
||||||
}
|
}
|
||||||
WDataInP datap = (reinterpret_cast<IData*>(vop->varDatap()));
|
WDataInP datap = (reinterpret_cast<IData*>(vop->varDatap()));
|
||||||
for (int i=0; i<words; ++i) {
|
for (int i=0; i<words; ++i) {
|
||||||
|
|
@ -979,17 +979,17 @@ void vpi_get_value(vpiHandle object, p_vpi_value value_p) {
|
||||||
|
|
||||||
vpiHandle vpi_put_value(vpiHandle object, p_vpi_value value_p,
|
vpiHandle vpi_put_value(vpiHandle object, p_vpi_value value_p,
|
||||||
p_vpi_time time_p, PLI_INT32 flags) {
|
p_vpi_time time_p, PLI_INT32 flags) {
|
||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: vpi_put_value %p %p\n",object, value_p););
|
VL_DEBUG_IF_PLI(VL_PRINTF_MT("-vltVpi: vpi_put_value %p %p\n",object, value_p););
|
||||||
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
||||||
if (VL_UNLIKELY(!value_p)) {
|
if (VL_UNLIKELY(!value_p)) {
|
||||||
_VL_VPI_WARNING(__FILE__, __LINE__, "Ignoring vpi_put_value with NULL value pointer");
|
_VL_VPI_WARNING(__FILE__, __LINE__, "Ignoring vpi_put_value with NULL value pointer");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (VerilatedVpioVar* vop = VerilatedVpioVar::castp(object)) {
|
if (VerilatedVpioVar* vop = VerilatedVpioVar::castp(object)) {
|
||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: vpi_put_value name=%s fmt=%d vali=%d\n",
|
VL_DEBUG_IF_PLI(VL_PRINTF_MT("-vltVpi: vpi_put_value name=%s fmt=%d vali=%d\n",
|
||||||
vop->fullname(), value_p->format, value_p->value.integer);
|
vop->fullname(), value_p->format, value_p->value.integer);
|
||||||
VL_PRINTF("-vltVpi: varp=%p putatp=%p\n",
|
VL_PRINTF_MT("-vltVpi: varp=%p putatp=%p\n",
|
||||||
vop->varp()->datap(), vop->varDatap()););
|
vop->varp()->datap(), vop->varDatap()););
|
||||||
if (VL_UNLIKELY(!vop->varp()->isPublicRW())) {
|
if (VL_UNLIKELY(!vop->varp()->isPublicRW())) {
|
||||||
_VL_VPI_WARNING(__FILE__, __LINE__, "Ignoring vpi_put_value to signal marked read-only, use public_flat_rw instead: ", vop->fullname());
|
_VL_VPI_WARNING(__FILE__, __LINE__, "Ignoring vpi_put_value to signal marked read-only, use public_flat_rw instead: ", vop->fullname());
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1353,7 +1353,7 @@ PLI_INT32 vpi_free_object(vpiHandle object) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PLI_INT32 vpi_release_handle (vpiHandle object) {
|
PLI_INT32 vpi_release_handle (vpiHandle object) {
|
||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: vpi_release_handle %p\n",object););
|
VL_DEBUG_IF_PLI(VL_PRINTF_MT("-vltVpi: vpi_release_handle %p\n",object););
|
||||||
VerilatedVpio* vop = VerilatedVpio::castp(object);
|
VerilatedVpio* vop = VerilatedVpio::castp(object);
|
||||||
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
||||||
if (VL_UNLIKELY(!vop)) return 0;
|
if (VL_UNLIKELY(!vop)) return 0;
|
||||||
|
|
@ -1387,15 +1387,15 @@ PLI_INT32 vpi_put_userdata(vpiHandle obj, void *userdata) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PLI_INT32 vpi_control(PLI_INT32 operation, ...) {
|
PLI_INT32 vpi_control(PLI_INT32 operation, ...) {
|
||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: vpi_control %d\n",operation););
|
VL_DEBUG_IF_PLI(VL_PRINTF_MT("-vltVpi: vpi_control %d\n",operation););
|
||||||
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
case vpiFinish: {
|
case vpiFinish: {
|
||||||
vl_finish(__FILE__,__LINE__,"*VPI*");
|
VL_FINISH_MT(__FILE__,__LINE__,"*VPI*");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
case vpiStop: {
|
case vpiStop: {
|
||||||
vl_stop(__FILE__,__LINE__,"*VPI*");
|
VL_STOP_MT(__FILE__,__LINE__,"*VPI*");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ public:
|
||||||
// We reserve word zero for the next pointer, as that's safer in case a
|
// We reserve word zero for the next pointer, as that's safer in case a
|
||||||
// dangling reference to the original remains around.
|
// dangling reference to the original remains around.
|
||||||
static size_t chunk = 96;
|
static size_t chunk = 96;
|
||||||
if (VL_UNLIKELY(size>chunk)) vl_fatal(__FILE__,__LINE__,"", "increase chunk");
|
if (VL_UNLIKELY(size>chunk)) VL_FATAL_MT(__FILE__,__LINE__,"", "increase chunk");
|
||||||
if (VL_LIKELY(s_freeHead)) {
|
if (VL_LIKELY(s_freeHead)) {
|
||||||
vluint8_t* newp = s_freeHead;
|
vluint8_t* newp = s_freeHead;
|
||||||
s_freeHead = *((vluint8_t**)newp);
|
s_freeHead = *((vluint8_t**)newp);
|
||||||
|
|
@ -337,7 +337,7 @@ public:
|
||||||
varop->createPrevDatap();
|
varop->createPrevDatap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (VL_UNLIKELY(vop->reason() >= CB_ENUM_MAX_VALUE)) vl_fatal(__FILE__,__LINE__,"", "vpi bb reason too large");
|
if (VL_UNLIKELY(vop->reason() >= CB_ENUM_MAX_VALUE)) VL_FATAL_MT(__FILE__,__LINE__,"", "vpi bb reason too large");
|
||||||
s_s.m_cbObjLists[vop->reason()].push_back(vop);
|
s_s.m_cbObjLists[vop->reason()].push_back(vop);
|
||||||
}
|
}
|
||||||
static void cbTimedAdd(VerilatedVpioCb* vop) {
|
static void cbTimedAdd(VerilatedVpioCb* vop) {
|
||||||
|
|
@ -363,7 +363,7 @@ public:
|
||||||
if (VL_UNLIKELY(it->first <= time)) {
|
if (VL_UNLIKELY(it->first <= time)) {
|
||||||
VerilatedVpioCb* vop = it->second;
|
VerilatedVpioCb* vop = it->second;
|
||||||
++it; // iterator may be deleted by callback
|
++it; // iterator may be deleted by callback
|
||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: timed_callback %p\n",vop););
|
VL_DEBUG_IF_PLI(VL_PRINTF_MT("-vltVpi: timed_callback %p\n",vop););
|
||||||
(vop->cb_rtnp()) (vop->cb_datap());
|
(vop->cb_rtnp()) (vop->cb_datap());
|
||||||
}
|
}
|
||||||
else { ++it; }
|
else { ++it; }
|
||||||
|
|
@ -385,7 +385,7 @@ public:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
VerilatedVpioCb* vop = *it++;
|
VerilatedVpioCb* vop = *it++;
|
||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: reason_callback %d %p\n",reason,vop););
|
VL_DEBUG_IF_PLI(VL_PRINTF_MT("-vltVpi: reason_callback %d %p\n",reason,vop););
|
||||||
(vop->cb_rtnp()) (vop->cb_datap());
|
(vop->cb_rtnp()) (vop->cb_datap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -402,12 +402,12 @@ public:
|
||||||
if (VerilatedVpioVar* varop = VerilatedVpioVar::castp(vop->cb_datap()->obj)) {
|
if (VerilatedVpioVar* varop = VerilatedVpioVar::castp(vop->cb_datap()->obj)) {
|
||||||
void* newDatap = varop->varDatap();
|
void* newDatap = varop->varDatap();
|
||||||
void* prevDatap = varop->prevDatap(); // Was malloced when we added the callback
|
void* prevDatap = varop->prevDatap(); // Was malloced when we added the callback
|
||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: value_test %s v[0]=%d/%d %p %p\n",
|
VL_DEBUG_IF_PLI(VL_PRINTF_MT("-vltVpi: value_test %s v[0]=%d/%d %p %p\n",
|
||||||
varop->fullname(), *((CData*)newDatap), *((CData*)prevDatap),
|
varop->fullname(), *((CData*)newDatap), *((CData*)prevDatap),
|
||||||
newDatap, prevDatap););
|
newDatap, prevDatap););
|
||||||
if (memcmp(prevDatap, newDatap, varop->entSize())) {
|
if (memcmp(prevDatap, newDatap, varop->entSize())) {
|
||||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: value_callback %p %s v[0]=%d\n",
|
VL_DEBUG_IF_PLI(VL_PRINTF_MT("-vltVpi: value_callback %p %s v[0]=%d\n",
|
||||||
vop,varop->fullname(), *((CData*)newDatap)););
|
vop,varop->fullname(), *((CData*)newDatap)););
|
||||||
update.insert(varop);
|
update.insert(varop);
|
||||||
vpi_get_value(vop->cb_datap()->obj, vop->cb_datap()->value);
|
vpi_get_value(vop->cb_datap()->obj, vop->cb_datap()->value);
|
||||||
(vop->cb_rtnp()) (vop->cb_datap());
|
(vop->cb_rtnp()) (vop->cb_datap());
|
||||||
|
|
@ -483,10 +483,10 @@ public:
|
||||||
// Not supported yet
|
// Not supported yet
|
||||||
p_vpi_error_info error_info_p = VerilatedVpi::error_info()->getError();
|
p_vpi_error_info error_info_p = VerilatedVpi::error_info()->getError();
|
||||||
if (error_info_p) {
|
if (error_info_p) {
|
||||||
vl_fatal(error_info_p->file, error_info_p->line, "", error_info_p->message);
|
VL_FATAL_MT(error_info_p->file, error_info_p->line, "", error_info_p->message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
vl_fatal(__FILE__, __LINE__, "", "vpi_unsupported called without error info set");
|
VL_FATAL_MT(__FILE__, __LINE__, "", "vpi_unsupported called without error info set");
|
||||||
}
|
}
|
||||||
static const char* strFromVpiVal(PLI_INT32 vpiVal);
|
static const char* strFromVpiVal(PLI_INT32 vpiVal);
|
||||||
static const char* strFromVpiObjType(PLI_INT32 vpiVal);
|
static const char* strFromVpiObjType(PLI_INT32 vpiVal);
|
||||||
|
|
|
||||||
|
|
@ -434,14 +434,14 @@ public:
|
||||||
puts("}\n");
|
puts("}\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstStop* nodep) {
|
virtual void visit(AstStop* nodep) {
|
||||||
puts("vl_stop(");
|
puts("VL_STOP_MT(");
|
||||||
putsQuoted(nodep->fileline()->filename());
|
putsQuoted(nodep->fileline()->filename());
|
||||||
puts(",");
|
puts(",");
|
||||||
puts(cvtToStr(nodep->fileline()->lineno()));
|
puts(cvtToStr(nodep->fileline()->lineno()));
|
||||||
puts(",\"\");\n");
|
puts(",\"\");\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstFinish* nodep) {
|
virtual void visit(AstFinish* nodep) {
|
||||||
puts("vl_finish(");
|
puts("VL_FINISH_MT(");
|
||||||
putsQuoted(nodep->fileline()->filename());
|
putsQuoted(nodep->fileline()->filename());
|
||||||
puts(",");
|
puts(",");
|
||||||
puts(cvtToStr(nodep->fileline()->lineno()));
|
puts(cvtToStr(nodep->fileline()->lineno()));
|
||||||
|
|
@ -877,7 +877,7 @@ class EmitCImp : EmitCStmts {
|
||||||
puts(modClassName(m_modp)+"::"+nodep->name()
|
puts(modClassName(m_modp)+"::"+nodep->name()
|
||||||
+"("+cFuncArgs(nodep)+") {\n");
|
+"("+cFuncArgs(nodep)+") {\n");
|
||||||
|
|
||||||
puts("VL_DEBUG_IF(VL_PRINTF(\" ");
|
puts("VL_DEBUG_IF(VL_PRINTF_MT(\" ");
|
||||||
for (int i=0;i<m_modp->level();i++) { puts(" "); }
|
for (int i=0;i<m_modp->level();i++) { puts(" "); }
|
||||||
puts(modClassName(m_modp)+"::"+nodep->name()
|
puts(modClassName(m_modp)+"::"+nodep->name()
|
||||||
+"\\n\"); );\n");
|
+"\\n\"); );\n");
|
||||||
|
|
@ -938,7 +938,7 @@ class EmitCImp : EmitCStmts {
|
||||||
if (nodep->lhsp()->castVarRef()) {
|
if (nodep->lhsp()->castVarRef()) {
|
||||||
varname = ": "+nodep->lhsp()->castVarRef()->varp()->prettyName();
|
varname = ": "+nodep->lhsp()->castVarRef()->varp()->prettyName();
|
||||||
}
|
}
|
||||||
puts(")) VL_PRINTF(\"\tCHANGE: "+nodep->fileline()->ascii()
|
puts(")) VL_PRINTF_MT(\"\tCHANGE: "+nodep->fileline()->ascii()
|
||||||
+varname+"\\n\"); );\n");
|
+varname+"\\n\"); );\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1738,18 +1738,18 @@ void EmitCImp::emitWrapEval(AstNodeModule* modp) {
|
||||||
puts("if (VL_UNLIKELY(__Vm_inhibitSim)) return;\n");
|
puts("if (VL_UNLIKELY(__Vm_inhibitSim)) return;\n");
|
||||||
}
|
}
|
||||||
putsDecoration("// Evaluate till stable\n");
|
putsDecoration("// Evaluate till stable\n");
|
||||||
puts("VL_DEBUG_IF(VL_PRINTF(\"\\n----TOP Evaluate "+modClassName(modp)+"::eval\\n\"); );\n");
|
puts("VL_DEBUG_IF(VL_PRINTF_MT(\"\\n----TOP Evaluate "+modClassName(modp)+"::eval\\n\"); );\n");
|
||||||
puts("int __VclockLoop = 0;\n");
|
puts("int __VclockLoop = 0;\n");
|
||||||
puts("QData __Vchange = 1;\n");
|
puts("QData __Vchange = 1;\n");
|
||||||
puts("while (VL_LIKELY(__Vchange)) {\n");
|
puts("while (VL_LIKELY(__Vchange)) {\n");
|
||||||
puts( "VL_DEBUG_IF(VL_PRINTF(\" Clock loop\\n\"););\n");
|
puts( "VL_DEBUG_IF(VL_PRINTF_MT(\" Clock loop\\n\"););\n");
|
||||||
if (v3Global.opt.trace()) {
|
if (v3Global.opt.trace()) {
|
||||||
puts("vlSymsp->__Vm_activity = true;\n");
|
puts("vlSymsp->__Vm_activity = true;\n");
|
||||||
}
|
}
|
||||||
puts( "_eval(vlSymsp);\n");
|
puts( "_eval(vlSymsp);\n");
|
||||||
puts( "__Vchange = _change_request(vlSymsp);\n");
|
puts( "__Vchange = _change_request(vlSymsp);\n");
|
||||||
puts( "if (VL_UNLIKELY(++__VclockLoop > "+cvtToStr(v3Global.opt.convergeLimit())
|
puts( "if (VL_UNLIKELY(++__VclockLoop > "+cvtToStr(v3Global.opt.convergeLimit())
|
||||||
+")) vl_fatal(__FILE__,__LINE__,__FILE__,\"Verilated model didn't converge\");\n");
|
+")) VL_FATAL_MT(__FILE__,__LINE__,__FILE__,\"Verilated model didn't converge\");\n");
|
||||||
puts("}\n");
|
puts("}\n");
|
||||||
puts("}\n");
|
puts("}\n");
|
||||||
splitSizeInc(10);
|
splitSizeInc(10);
|
||||||
|
|
@ -1768,7 +1768,7 @@ void EmitCImp::emitWrapEval(AstNodeModule* modp) {
|
||||||
puts( "_eval(vlSymsp);\n");
|
puts( "_eval(vlSymsp);\n");
|
||||||
puts( "__Vchange = _change_request(vlSymsp);\n");
|
puts( "__Vchange = _change_request(vlSymsp);\n");
|
||||||
puts( "if (VL_UNLIKELY(++__VclockLoop > "+cvtToStr(v3Global.opt.convergeLimit())
|
puts( "if (VL_UNLIKELY(++__VclockLoop > "+cvtToStr(v3Global.opt.convergeLimit())
|
||||||
+")) vl_fatal(__FILE__,__LINE__,__FILE__,\"Verilated model didn't DC converge\");\n");
|
+")) VL_FATAL_MT(__FILE__,__LINE__,__FILE__,\"Verilated model didn't DC converge\");\n");
|
||||||
puts( "}\n");
|
puts( "}\n");
|
||||||
puts("}\n");
|
puts("}\n");
|
||||||
splitSizeInc(10);
|
splitSizeInc(10);
|
||||||
|
|
@ -2211,7 +2211,7 @@ class EmitCTrace : EmitCStmts {
|
||||||
putsDecoration("// Callback from vcd->open()\n");
|
putsDecoration("// Callback from vcd->open()\n");
|
||||||
puts(topClassName()+"* t=("+topClassName()+"*)userthis;\n");
|
puts(topClassName()+"* t=("+topClassName()+"*)userthis;\n");
|
||||||
puts(EmitCBaseVisitor::symClassVar()+" = t->__VlSymsp; // Setup global symbol table\n");
|
puts(EmitCBaseVisitor::symClassVar()+" = t->__VlSymsp; // Setup global symbol table\n");
|
||||||
puts("if (!Verilated::calcUnusedSigs()) vl_fatal(__FILE__,__LINE__,__FILE__,\"Turning on wave traces requires Verilated::traceEverOn(true) call before time 0.\");\n");
|
puts("if (!Verilated::calcUnusedSigs()) VL_FATAL_MT(__FILE__,__LINE__,__FILE__,\"Turning on wave traces requires Verilated::traceEverOn(true) call before time 0.\");\n");
|
||||||
|
|
||||||
puts("vcdp->scopeEscape(' ');\n");
|
puts("vcdp->scopeEscape(' ');\n");
|
||||||
puts("t->traceInitThis (vlSymsp, vcdp, code);\n");
|
puts("t->traceInitThis (vlSymsp, vcdp, code);\n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue