Use C++11 standard types for MacOS portability (#3254) (#3257).

This commit is contained in:
Wilson Snyder 2022-01-01 16:04:20 -05:00
parent f3945e7c02
commit 4cd56b1fb9
17 changed files with 78 additions and 112 deletions

View File

@ -23,7 +23,7 @@ Verilator 4.217 devel
* Support lower dimension looping in foreach loops (#3172). [Ehab Ibrahim]
* Support up to 64 bit enums for .next/.prev/.name (#3244). [Alexander Grobman]
* Reduce .rodata footprint of trace initialization (#3250). [Geza Lore, Shunyao CAD]
* Use C++11 standard types for MacOS portability (#3254). [Adrien Le Masle]
* Use C++11 standard types for MacOS portability (#3254) (#3257). [Adrien Le Masle]
* Fix bad ending address on $readmem (#3205). [Julie Schwartz]
* Fix MSWIN compile error (#2681). [Unai Martinez-Corral]
* Fix break under foreach loop (#3230).

View File

@ -103,8 +103,8 @@ int main(int argc, char** argv, char** env) {
top->eval();
// Read outputs
VL_PRINTF("[%" VL_PRI64 "d] clk=%x rstl=%x iquad=%" VL_PRI64 "x"
" -> oquad=%" VL_PRI64 "x owide=%x_%08x_%08x\n",
VL_PRINTF("[%" PRId64 "] clk=%x rstl=%x iquad=%" PRIx64 " -> oquad=%" PRIx64
" owide=%x_%08x_%08x\n",
contextp->time(), top->clk, top->reset_l, top->in_quad, top->out_quad,
top->out_wide[2], top->out_wide[1], top->out_wide[0]);
}

View File

@ -271,13 +271,13 @@ void VL_DBG_MSGF(const char* formatp, ...) VL_MT_SAFE {
va_start(ap, formatp);
const std::string out = _vl_string_vprintf(formatp, ap);
va_end(ap);
// printf("-imm-V{t%d,%" VL_PRI64 "d}%s", VL_THREAD_ID(), _vl_dbg_sequence_number(),
// printf("-imm-V{t%d,%" PRId64 "}%s", VL_THREAD_ID(), _vl_dbg_sequence_number(),
// out.c_str());
// Using VL_PRINTF not VL_PRINTF_MT so that we can call VL_DBG_MSGF
// from within the guts of the thread execution machinery (and it goes
// to the screen and not into the queues we're debugging)
VL_PRINTF("-V{t%u,%" VL_PRI64 "u}%s", VL_THREAD_ID(), _vl_dbg_sequence_number(), out.c_str());
VL_PRINTF("-V{t%u,%" PRIu64 "}%s", VL_THREAD_ID(), _vl_dbg_sequence_number(), out.c_str());
}
#ifdef VL_THREADED
@ -701,18 +701,17 @@ std::string _vl_vsformat_time(char* tmp, T ld, int timeunit, bool left, size_t w
if (!fracDigits) {
digits = VL_SNPRINTF(tmp, VL_VALUE_STRING_MAX_WIDTH, "%s%s", ptr, suffix.c_str());
} else {
digits = VL_SNPRINTF(tmp, VL_VALUE_STRING_MAX_WIDTH, "%s.%0*" VL_PRI64 "u%s", ptr,
digits = VL_SNPRINTF(tmp, VL_VALUE_STRING_MAX_WIDTH, "%s.%0*" PRIu64 "%s", ptr,
fracDigits, VL_SET_QW(frac), suffix.c_str());
}
} else {
const vluint64_t integer64 = VL_SET_QW(integer);
if (!fracDigits) {
digits = VL_SNPRINTF(tmp, VL_VALUE_STRING_MAX_WIDTH, "%" VL_PRI64 "u%s", integer64,
digits = VL_SNPRINTF(tmp, VL_VALUE_STRING_MAX_WIDTH, "%" PRIu64 "%s", integer64,
suffix.c_str());
} else {
digits = VL_SNPRINTF(tmp, VL_VALUE_STRING_MAX_WIDTH,
"%" VL_PRI64 "u.%0*" VL_PRI64 "u%s", integer64, fracDigits,
VL_SET_QW(frac), suffix.c_str());
digits = VL_SNPRINTF(tmp, VL_VALUE_STRING_MAX_WIDTH, "%" PRIu64 ".%0*" PRIu64 "%s",
integer64, fracDigits, VL_SET_QW(frac), suffix.c_str());
}
}
} else {
@ -874,7 +873,7 @@ void _vl_vsformat(std::string& output, const char* formatp, va_list ap) VL_MT_SA
std::string append;
if (lbits <= VL_QUADSIZE) {
digits = VL_SNPRINTF(
t_tmp, VL_VALUE_STRING_MAX_WIDTH, "%" VL_PRI64 "d",
t_tmp, VL_VALUE_STRING_MAX_WIDTH, "%" PRId64,
static_cast<vlsint64_t>(VL_EXTENDS_QQ(lbits, lbits, ld)));
append = t_tmp;
} else {
@ -903,8 +902,7 @@ void _vl_vsformat(std::string& output, const char* formatp, va_list ap) VL_MT_SA
int digits = 0;
std::string append;
if (lbits <= VL_QUADSIZE) {
digits
= VL_SNPRINTF(t_tmp, VL_VALUE_STRING_MAX_WIDTH, "%" VL_PRI64 "u", ld);
digits = VL_SNPRINTF(t_tmp, VL_VALUE_STRING_MAX_WIDTH, "%" PRIu64, ld);
append = t_tmp;
} else {
append = VL_DECIMAL_NW(lbits, lwp);
@ -1180,7 +1178,7 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
_vl_vsss_read_str(fp, floc, fromp, fstr, t_tmp, "0123456789+-xXzZ?_");
if (!t_tmp[0]) goto done;
vlsint64_t ld = 0;
std::sscanf(t_tmp, "%30" VL_PRI64 "d", &ld);
std::sscanf(t_tmp, "%30" PRId64, &ld);
VL_SET_WQ(owp, ld);
break;
}
@ -1205,7 +1203,7 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
_vl_vsss_read_str(fp, floc, fromp, fstr, t_tmp, "0123456789+-xXzZ?_");
if (!t_tmp[0]) goto done;
QData ld = 0;
std::sscanf(t_tmp, "%30" VL_PRI64 "u", &ld);
std::sscanf(t_tmp, "%30" PRIu64, &ld);
VL_SET_WQ(owp, ld);
break;
}
@ -1639,7 +1637,7 @@ IData VL_VALUEPLUSARGS_INW(int rbits, const std::string& ld, WDataOutP rwp) VL_M
switch (std::tolower(fmt)) {
case 'd': {
vlsint64_t lld = 0;
std::sscanf(dp, "%30" VL_PRI64 "d", &lld);
std::sscanf(dp, "%30" PRId64, &lld);
VL_SET_WQ(rwp, lld);
break;
}
@ -1993,7 +1991,7 @@ VlWriteMem::~VlWriteMem() {
void VlWriteMem::print(QData addr, bool addrstamp, const void* valuep) {
if (VL_UNLIKELY(!m_fp)) return;
if (addr != m_addr && addrstamp) { // Only assoc has time stamps
fprintf(m_fp, "@%" VL_PRI64 "x\n", addr);
fprintf(m_fp, "@%" PRIx64 "\n", addr);
}
m_addr = addr + 1;
if (m_bits <= 8) {

View File

@ -103,7 +103,7 @@ void VerilatedProfiler<T_Entries>::write(const char* modelp,
for (const auto& it : m_records) {
const std::string& name = it.name();
fprintf(fp, "profile_data -model \"%s\" -mtask \"%s\" -cost 64'd%" VL_PRI64 "u\n", modelp,
fprintf(fp, "profile_data -model \"%s\" -mtask \"%s\" -cost 64'd%" PRIu64 "\n", modelp,
name.c_str(), m_counters[it.counterNumber()]);
}

View File

@ -161,12 +161,12 @@ void VlThreadPool::profileDump(const char* filenamep, vluint64_t tickStart, vlui
// TODO Perhaps merge with verilated_coverage output format, so can
// have a common merging and reporting tool, etc.
fprintf(fp, "VLPROFTHREAD 1.1 # Verilator thread profile dump version 1.1\n");
fprintf(fp, "VLPROF arg --threads %" VL_PRI64 "u\n", vluint64_t(m_workers.size() + 1));
fprintf(fp, "VLPROF arg +verilator+prof+threads+start+%" VL_PRI64 "u\n",
fprintf(fp, "VLPROF arg --threads %" PRIu64 "\n", vluint64_t(m_workers.size() + 1));
fprintf(fp, "VLPROF arg +verilator+prof+threads+start+%" PRIu64 "\n",
Verilated::threadContextp()->profThreadsStart());
fprintf(fp, "VLPROF arg +verilator+prof+threads+window+%u\n",
Verilated::threadContextp()->profThreadsWindow());
fprintf(fp, "VLPROF stat yields %" VL_PRI64 "u\n", VlMTaskVertex::yields());
fprintf(fp, "VLPROF stat yields %" PRIu64 "\n", VlMTaskVertex::yields());
// Copy /proc/cpuinfo into this output so verilator_gantt can be run on
// a different machine
@ -191,15 +191,14 @@ void VlThreadPool::profileDump(const char* filenamep, vluint64_t tickStart, vlui
case VlProfileRec::TYPE_EVAL:
if (!printing) break;
fprintf(fp,
"VLPROF eval start %" VL_PRI64 "u elapsed %" VL_PRI64 "u"
" cpu %u on thread %u\n",
"VLPROF eval start %" PRIu64 " elapsed %" PRIu64 " cpu %u on thread %u\n",
ei.m_startTime - tickStart, (ei.m_endTime - ei.m_startTime), ei.m_cpu,
thread_id);
break;
case VlProfileRec::TYPE_EVAL_LOOP:
if (!printing) break;
fprintf(fp,
"VLPROF eval_loop start %" VL_PRI64 "u elapsed %" VL_PRI64 "u"
"VLPROF eval_loop start %" PRIu64 " elapsed %" PRIu64
" cpu %u on thread %u\n",
ei.m_startTime - tickStart, (ei.m_endTime - ei.m_startTime), ei.m_cpu,
thread_id);
@ -208,7 +207,7 @@ void VlThreadPool::profileDump(const char* filenamep, vluint64_t tickStart, vlui
if (!printing) break;
fprintf(fp,
"VLPROF mtask %d"
" start %" VL_PRI64 "u elapsed %" VL_PRI64 "u"
" start %" PRIu64 " elapsed %" PRIu64
" predict_start %u predict_cost %u cpu %u on thread %u\n",
ei.m_mtaskId, ei.m_startTime - tickStart, (ei.m_endTime - ei.m_startTime),
ei.m_predictStart, ei.m_predictCost, ei.m_cpu, thread_id);
@ -217,7 +216,7 @@ void VlThreadPool::profileDump(const char* filenamep, vluint64_t tickStart, vlui
}
}
}
fprintf(fp, "VLPROF stat ticks %" VL_PRI64 "u\n", tickEnd - tickStart);
fprintf(fp, "VLPROF stat ticks %" PRIu64 "\n", tickEnd - tickStart);
std::fclose(fp);
}

View File

@ -400,8 +400,8 @@ void VerilatedTrace<VL_DERIVED_T>::dump(vluint64_t timeui) VL_MT_SAFE_EXCLUDES(m
// chances are the data being dumped will have other problems
const VerilatedLockGuard lock{m_mutex};
if (VL_UNCOVERABLE(m_timeLastDump && timeui <= m_timeLastDump)) { // LCOV_EXCL_START
VL_PRINTF_MT("%%Warning: previous dump at t=%" VL_PRI64 "u, requesting t=%" VL_PRI64
"u, dump call ignored\n",
VL_PRINTF_MT("%%Warning: previous dump at t=%" PRIu64 ", requesting t=%" PRIu64
", dump call ignored\n",
m_timeLastDump, timeui);
return;
} // LCOV_EXCL_STOP

View File

@ -273,7 +273,7 @@ void VerilatedVcd::printStr(const char* str) {
void VerilatedVcd::printQuad(vluint64_t n) {
constexpr size_t LEN_STR_QUAD = 40;
char buf[LEN_STR_QUAD];
VL_SNPRINTF(buf, LEN_STR_QUAD, "%" VL_PRI64 "u", n);
VL_SNPRINTF(buf, LEN_STR_QUAD, "%" PRIu64, n);
printStr(buf);
}

View File

@ -534,7 +534,7 @@ public:
if (VL_UNCOVERABLE(cb_data_p->reason >= CB_ENUM_MAX_VALUE)) {
VL_FATAL_MT(__FILE__, __LINE__, "", "vpi bb reason too large");
}
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: vpi_register_cb reason=%d id=%" VL_PRI64 "d obj=%p\n",
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: vpi_register_cb reason=%d id=%" PRId64 " obj=%p\n",
cb_data_p->reason, id, cb_data_p->obj););
VerilatedVpioVar* varop = nullptr;
if (cb_data_p->reason == cbValueChange) varop = VerilatedVpioVar::castp(cb_data_p->obj);
@ -542,8 +542,8 @@ public:
}
static void cbTimedAdd(vluint64_t id, const s_cb_data* cb_data_p, QData time) {
// The passed cb_data_p was property of the user, so need to recreate
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: vpi_register_cb reason=%d id=%" VL_PRI64
"d delay=%" VL_PRI64 "u\n",
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: vpi_register_cb reason=%d id=%" PRId64
" delay=%" PRIu64 "\n",
cb_data_p->reason, id, time););
s().m_timedCbs.emplace(std::piecewise_construct,
std::forward_as_tuple(std::make_pair(time, id)),
@ -573,7 +573,7 @@ public:
++it;
if (VL_UNLIKELY(!ho.invalid())) {
VL_DEBUG_IF_PLI(
VL_DBG_MSGF("- vpi: timed_callback id=%" VL_PRI64 "d\n", ho.id()););
VL_DBG_MSGF("- vpi: timed_callback id=%" PRId64 "\n", ho.id()););
ho.invalidate(); // Timed callbacks are one-shot
(ho.cb_rtnp())(ho.cb_datap());
}
@ -602,7 +602,7 @@ public:
continue;
}
VerilatedVpiCbHolder& ho = *it;
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: reason_callback reason=%d id=%" VL_PRI64 "d\n",
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: reason_callback reason=%d id=%" PRId64 "\n",
reason, ho.id()););
(ho.cb_rtnp())(ho.cb_datap());
called = true;
@ -636,9 +636,9 @@ public:
*(static_cast<CData*>(prevDatap)), newDatap,
prevDatap););
if (std::memcmp(prevDatap, newDatap, varop->entSize()) != 0) {
VL_DEBUG_IF_PLI(
VL_DBG_MSGF("- vpi: value_callback %" VL_PRI64 "d %s v[0]=%d\n", ho.id(),
varop->fullname(), *(static_cast<CData*>(newDatap))););
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: value_callback %" PRId64 " %s v[0]=%d\n",
ho.id(), varop->fullname(),
*(static_cast<CData*>(newDatap))););
update.insert(varop);
vpi_get_value(ho.cb_datap()->obj, ho.cb_datap()->value);
(ho.cb_rtnp())(ho.cb_datap());

View File

@ -280,6 +280,7 @@ void __gcov_flush(); // gcc sources gcc/gcov-io.h has the prototype
// Now that C++ requires these standard types the vl types are deprecated
#include <cstdint>
#include <cinttypes>
using vluint8_t = uint8_t; ///< 8-bit unsigned type (backward compatibility)
using vluint16_t = uint16_t; ///< 16-bit unsigned type (backward compatibility)
@ -314,16 +315,18 @@ using ssize_t = uint32_t; ///< signed size_t; returned from read()
//=========================================================================
// Printing printf/scanf formats
// Alas cinttypes isn't that standard yet
// Use Microsoft-specific format specifiers for Microsoft Visual C++ only
#ifdef _MSC_VER
# define VL_PRI64 "I64"
#else // use standard C99 format specifiers
# if defined(__WORDSIZE) && (__WORDSIZE == 64)
# define VL_PRI64 "l"
# else
# define VL_PRI64 "ll"
// Deprecated, favor C++11's PRIx64, etc, instead
#ifndef VL_NO_LEGACY
# ifdef _MSC_VER
# define VL_PRI64 "I64" ///< print a vluint64_t (backward compatibility)
# else // use standard C99 format specifiers
# if defined(__WORDSIZE) && (__WORDSIZE == 64)
# define VL_PRI64 "l" ///< print a vluint64_t (backward compatibility)
# else
# define VL_PRI64 "ll" ///< print a vluint64_t (backward compatibility)
# endif
# endif
#endif

View File

@ -542,9 +542,8 @@ void EmitCFunc::emitConstant(AstConst* nodep, AstVarRef* assigntop, const string
}
for (int word = VL_WORDS_I(upWidth) - 1; word >= 0; word--) {
// Only 32 bits - llx + long long here just to appease CPP format warning
ofp()->printf(",0x%08" VL_PRI64 "x",
static_cast<vluint64_t>(
nodep->num().edataWord(word + chunks * EMITC_NUM_CONSTW)));
ofp()->printf(",0x%08" PRIx64, static_cast<vluint64_t>(nodep->num().edataWord(
word + chunks * EMITC_NUM_CONSTW)));
}
puts(")");
}
@ -565,9 +564,8 @@ void EmitCFunc::emitConstant(AstConst* nodep, AstVarRef* assigntop, const string
}
for (int word = EMITC_NUM_CONSTW - 1; word >= 0; word--) {
// Only 32 bits - llx + long long here just to appease CPP format warning
ofp()->printf(",0x%08" VL_PRI64 "x",
static_cast<vluint64_t>(
nodep->num().edataWord(word + chunks * EMITC_NUM_CONSTW)));
ofp()->printf(",0x%08" PRIx64, static_cast<vluint64_t>(nodep->num().edataWord(
word + chunks * EMITC_NUM_CONSTW)));
}
puts(")");
}
@ -583,9 +581,9 @@ void EmitCFunc::emitConstant(AstConst* nodep, AstVarRef* assigntop, const string
} else if (nodep->isQuad()) {
const vluint64_t num = nodep->toUQuad();
if (num < 10) {
ofp()->printf("%" VL_PRI64 "uULL", num);
ofp()->printf("%" PRIu64 "ULL", num);
} else {
ofp()->printf("0x%" VL_PRI64 "xULL", num);
ofp()->printf("0x%" PRIx64 "ULL", num);
}
} else {
const uint32_t num = nodep->toUInt();
@ -593,7 +591,7 @@ void EmitCFunc::emitConstant(AstConst* nodep, AstVarRef* assigntop, const string
if (num < 10) {
puts(cvtToStr(num));
} else {
ofp()->printf("0x%" VL_PRI64 "x", static_cast<vluint64_t>(num));
ofp()->printf("0x%" PRIx64, static_cast<vluint64_t>(num));
}
// If signed, we'll do our own functions
// But must be here, or <= comparisons etc may end up signed

View File

@ -353,7 +353,7 @@ class EmitCImp final : EmitCFunc {
hash.insert(varp->dtypep()->width());
}
}
ofp()->printf("vluint64_t __Vcheckval = 0x%" VL_PRI64 "xULL;\n",
ofp()->printf("vluint64_t __Vcheckval = 0x%" PRIx64 "ULL;\n",
static_cast<vluint64_t>(hash.digestUInt64()));
if (de) {
puts("os.readAssert(__Vcheckval);\n");

View File

@ -320,10 +320,9 @@ uint64_t V3Os::memUsageBytes() {
FILE* fp = fopen(statmFilename, "r");
if (!fp) return 0;
vluint64_t size, resident, share, text, lib, data, dt; // All in pages
const int items = fscanf(fp,
"%" VL_PRI64 "u %" VL_PRI64 "u %" VL_PRI64 "u %" VL_PRI64
"u %" VL_PRI64 "u %" VL_PRI64 "u %" VL_PRI64 "u",
&size, &resident, &share, &text, &lib, &data, &dt);
const int items = fscanf(
fp, "%" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64,
&size, &resident, &share, &text, &lib, &data, &dt);
fclose(fp);
if (VL_UNCOVERABLE(7 != items)) return 0;
return (text + data) * getpagesize();

View File

@ -18,7 +18,6 @@ my $Debug;
if (!-r "$root/.git") {
skip("Not in a git repository");
} else {
uint();
printfll();
cstr();
vsnprintf();
@ -27,31 +26,6 @@ if (!-r "$root/.git") {
ok(1);
sub uint {
### Must trim output before and after our file list
#my $files = "*/*.c* */*.h test_regress/t/*.c* test_regress/t/*.h";
# src isn't clean, and probably doesn't need to be (yet?)
my $files = "include/*.c* include/*.h examples/*/*.c* test_regress/t/*.c* test_regress/t/*.h";
my $cmd = "cd $root && fgrep -n int $files | sort";
print "C $cmd\n";
my $grep = `$cmd`;
my %names;
foreach my $line (split /\n/, $grep) {
$line =~ s!//.*$!!;
next if $line !~ /uint\d+_t\b/;
next if $line =~ /vl[su]int\d+_t/;
next if $line =~ /\b(typedef|using)\b/;
next if $line =~ m!include/svdpi.h!; # Not ours
if ($line =~ /^([^:]+)/) {
$names{$1} = 1;
print "$line\n";
}
}
if (keys %names) {
error("Files with uint32*_t instead of vluint32s: ", join(' ', sort keys %names));
}
}
sub printfll {
my $files = "src/*.c* src/*.h include/*.c* include/*.h examples/*/*.c* test_regress/t/*.c* test_regress/t/*.h";
my $cmd = "cd $root && fgrep -n ll $files | sort";
@ -69,7 +43,7 @@ sub printfll {
}
}
if (keys %names) {
error("Files with %ll instead of VL_PRI64: ", join(' ', sort keys %names));
error("Files with %ll instead of PRIx64: ", join(' ', sort keys %names));
}
}

View File

@ -9,31 +9,26 @@
//
//*************************************************************************
#include <cinttypes>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include "svdpi.h"
// clang-format off
#ifdef _WIN32
# define T_PRI64 "I64"
#else // Linux or compliant Unix flavors
# define T_PRI64 "ll"
#endif
//======================================================================
#if defined(VERILATOR)
# ifdef T_DPI_EXPORT_NOOPT
# include "Vt_dpi_export_noopt__Dpi.h"
# else
# include "Vt_dpi_export__Dpi.h"
# endif
#elif defined(VCS)
# include "../vc_hdrs.h"
#elif defined(CADENCE)
# define NEED_EXTERNS
#ifdef T_DPI_EXPORT_NOOPT
#include "Vt_dpi_export_noopt__Dpi.h"
#else
# error "Unknown simulator for DPI test"
#include "Vt_dpi_export__Dpi.h"
#endif
#elif defined(VCS)
#include "../vc_hdrs.h"
#elif defined(CADENCE)
#define NEED_EXTERNS
#else
#error "Unknown simulator for DPI test"
#endif
// clang-format on
@ -73,11 +68,11 @@ extern void dpix_t_time(const svLogicVecVal* i, svLogicVecVal* o);
#define CHECK_RESULT(type, got, exp) \
if ((got) != (exp)) { \
printf("%%Error: %s:%d:", __FILE__, __LINE__); \
union { type a; long long l; } u; \
union { type a; uint64_t l; } u; \
u.l = 0; u.a = got; if (u.a) {/*used*/} \
printf(" GOT = %" T_PRI64 "x", u.l); \
printf(" GOT = %" PRIx64, u.l); \
u.l = 0; u.a = exp; if (u.a) {/*used*/} \
printf(" EXP = %" T_PRI64 "x\n", u.l); \
printf(" EXP = %" PRIx64 "\n", u.l); \
return __LINE__; \
}
// clang-format on

View File

@ -33,7 +33,7 @@ long long get_memory_usage() {
int items = fscanf(fp,
("%d (%*[^) ]) %*1s %d %*d %*d %*d %*d %u"
" %u %u %u %u %d %d %d %d"
" %*d %*d %*u %*u %d %" VL_PRI64 "u %" VL_PRI64 "u "),
" %*d %*d %*u %*u %d %" PRIu64 " %" PRIu64 " "),
&ps_ign, &ps_ign, &ps_ign, &ps_ign, &ps_ign, &ps_ign, &ps_ign, &ps_ign,
&ps_ign, &ps_ign, &ps_ign, &ps_ign, &ps_vsize, &ps_rss);
fclose(fp);
@ -85,7 +85,7 @@ int main(int argc, char* argv[]) {
make_and_destroy();
}
firstUsage = get_memory_usage();
printf("Memory size %" VL_PRI64 "d bytes\n", firstUsage);
printf("Memory size %" PRId64 " bytes\n", firstUsage);
int loops = 10;
for (int left = loops; left > 0;) {
@ -96,7 +96,7 @@ int main(int argc, char* argv[]) {
vluint64_t leaked = get_memory_usage() - firstUsage;
if (leaked > 64 * 1024) { // Have to allow some slop for this code.
printf("Leaked %" VL_PRI64 "d bytes, or ~ %" VL_PRI64 "d bytes/construt\n", //
printf("Leaked %" PRId64 " bytes, or ~ %" PRId64 " bytes/construt\n", //
leaked, leaked / loops);
vl_fatal(__FILE__, __LINE__, "top", "Leaked memory\n");
}

View File

@ -36,8 +36,8 @@ int main(int argc, char* argv[]) {
| MaskVal(sim->LowMaskSel_Bot, sim->HighMaskSel_Bot));
if (sim->LogicImm != expected) {
printf("%%Error: %d.%d,%d.%d -> %016" VL_PRI64 "x/%016" VL_PRI64
"x -> %016" VL_PRI64 "x (expected %016" VL_PRI64 "x)\n",
printf("%%Error: %d.%d,%d.%d -> %016" PRIx64 "/%016" PRIx64 " -> %016" PRIx64
" (expected %016" PRIx64 ")\n",
sim->LowMaskSel_Top, sim->HighMaskSel_Top, sim->LowMaskSel_Bot,
sim->HighMaskSel_Bot, sim->LowLogicImm, sim->HighLogicImm, sim->LogicImm,
expected);

View File

@ -20,7 +20,7 @@ bool fail = false;
void check(QData got, QData exp) {
if (got != exp) {
VL_PRINTF("%%Error: got=0x%" VL_PRI64 "x exp=0x%" VL_PRI64 "x\n", got, exp);
VL_PRINTF("%%Error: got=0x%" PRIx64 " exp=0x%" PRIx64 "\n", got, exp);
fail = true;
}
}