Deprecate 'vluint64_t' and similar types (#3255).

This commit is contained in:
Wilson Snyder 2022-03-27 15:27:40 -04:00
parent 960d0de361
commit e02f97854c
68 changed files with 801 additions and 812 deletions

View File

@ -14,6 +14,7 @@ Verilator 4.221 devel
**Minor:** **Minor:**
* Split --prof-threads into --prof-exec and --prof-pgo (#3365). [Geza Lore, Shunyao CAD] * Split --prof-threads into --prof-exec and --prof-pgo (#3365). [Geza Lore, Shunyao CAD]
* Deprecate 'vluint64_t' and similar types (#3255).
* Fix MSVC localtime_s (#3124). * Fix MSVC localtime_s (#3124).

View File

@ -348,7 +348,7 @@ detailed descriptions of these arguments.
--mod-prefix <topname> Name to prepend to lower classes --mod-prefix <topname> Name to prepend to lower classes
--no-clk <signal-name> Prevent marking specified signal as clock --no-clk <signal-name> Prevent marking specified signal as clock
--no-decoration Disable comments and symbol decorations --no-decoration Disable comments and symbol decorations
--no-pins64 Don't use vluint64_t's for 33-64 bit sigs --no-pins64 Don't use uint64_t's for 33-64 bit sigs
--no-skip-identical Disable skipping identical output --no-skip-identical Disable skipping identical output
+notimingchecks Ignored +notimingchecks Ignored
-O0 Disable optimizations -O0 Disable optimizations

View File

@ -96,7 +96,7 @@ model. Here is a simple example:
Vtop *top; // Instantiation of model Vtop *top; // Instantiation of model
vluint64_t main_time = 0; // Current simulation time uint64_t main_time = 0; // Current simulation time
// This is a 64-bit integer to reduce wrap over issues and // This is a 64-bit integer to reduce wrap over issues and
// allow modulus. This is in units of the timeprecision // allow modulus. This is in units of the timeprecision
// used in Verilog (or from --timescale-override) // used in Verilog (or from --timescale-override)
@ -150,7 +150,7 @@ netlist as an instantiation.
The SC_MODULE gets the same pinout as the Verilog module, with the The SC_MODULE gets the same pinout as the Verilog module, with the
following type conversions: Pins of a single bit become bool. Pins 2-32 following type conversions: Pins of a single bit become bool. Pins 2-32
bits wide become uint32_t's. Pins 33-64 bits wide become sc_bv's or bits wide become uint32_t's. Pins 33-64 bits wide become sc_bv's or
vluint64_t's depending on the :vlopt:`--no-pins64` option. Wider pins uint64_t's depending on the :vlopt:`--no-pins64` option. Wider pins
become sc_bv's. (Uints simulate the fastest so are used where possible.) become sc_bv's. (Uints simulate the fastest so are used where possible.)
Model internals, including lower level sub-modules are not pure SystemC Model internals, including lower level sub-modules are not pure SystemC
@ -429,7 +429,7 @@ accesses the above signal "readme" would be:
#include "verilated.h" #include "verilated.h"
#include "verilated_vpi.h" // Required to get definitions #include "verilated_vpi.h" // Required to get definitions
vluint64_t main_time = 0; // See comments in first example uint64_t main_time = 0; // See comments in first example
double sc_time_stamp() { return main_time; } double sc_time_stamp() { return main_time; }
void read_and_check() { void read_and_check() {

View File

@ -768,7 +768,7 @@ Summary:
.. option:: --pins-bv <width> .. option:: --pins-bv <width>
Specifies SystemC inputs/outputs of greater than or equal to <width> Specifies SystemC inputs/outputs of greater than or equal to <width>
bits wide should use sc_bv's instead of uint32/vluint64_t's. The bits wide should use sc_bv's instead of uint32/uint64_t's. The
default is "--pins-bv 65", and the value must be less than or equal default is "--pins-bv 65", and the value must be less than or equal
to 65. Versions before Verilator 3.671 defaulted to "--pins-bv 33". to 65. Versions before Verilator 3.671 defaulted to "--pins-bv 33".
The more sc_bv is used, the worse for performance. Use the The more sc_bv is used, the worse for performance. Use the
@ -1647,7 +1647,7 @@ The grammar of configuration commands is as follows:
.. option:: sc_bv -module "<modulename>" [-function "<funcname>"] -var "<signame>" .. option:: sc_bv -module "<modulename>" [-function "<funcname>"] -var "<signame>"
Sets the port to be of :code:`sc_bv<{width}>` type, instead of bool, Sets the port to be of :code:`sc_bv<{width}>` type, instead of bool,
vluint32_t or vluint64_t. Same as :option:`/*verilator&32;sc_bv*/` uint32_t or uint64_t. Same as :option:`/*verilator&32;sc_bv*/`
metacomment. metacomment.
.. option:: sformat [-module "<modulename>"] [-task "<taskname>"] -var "<signame>" .. option:: sformat [-module "<modulename>"] [-task "<taskname>"] -var "<signame>"

View File

@ -445,7 +445,7 @@ or "`ifdef`"'s may break other tools.
.. option:: /*verilator&32;sc_bv*/ .. option:: /*verilator&32;sc_bv*/
Used after a port declaration. It sets the port to be of Used after a port declaration. It sets the port to be of
:code:`sc_bv<{width}>` type, instead of bool, vluint32_t or vluint64_t. :code:`sc_bv<{width}>` type, instead of bool, uint32_t or uint64_t.
This may be useful if the port width is parameterized and the This may be useful if the port width is parameterized and the
instantiating C++ code wants to always have a sc_bv so it can accept any instantiating C++ code wants to always have a sc_bv so it can accept any
width. In general you should avoid using this attribute when not width. In general you should avoid using this attribute when not

View File

@ -445,7 +445,7 @@ the signal, as you would any other member variable.
Signals are the smallest of 8-bit unsigned chars (equivalent to uint8_t), Signals are the smallest of 8-bit unsigned chars (equivalent to uint8_t),
16-bit unsigned shorts (uint16_t), 32-bit unsigned longs (uint32_t), or 16-bit unsigned shorts (uint16_t), 32-bit unsigned longs (uint32_t), or
64-bit unsigned long longs (uint64_t) that fits the width of the signal. 64-bit unsigned long longs (uint64_t) that fits the width of the signal.
Generally, you can use just uint32_t's for 1 to 32 bits, or vluint64_t for Generally, you can use just uint32_t's for 1 to 32 bits, or uint64_t for
1 to 64 bits, and the compiler will properly up-convert smaller entities. 1 to 64 bits, and the compiler will properly up-convert smaller entities.
Note even signed ports are declared as unsigned; you must sign extend Note even signed ports are declared as unsigned; you must sign extend
yourself to the appropriate signal width. yourself to the appropriate signal width.

View File

@ -58,11 +58,11 @@ int sc_main(int argc, char* argv[]) {
// Define interconnect // Define interconnect
sc_signal<bool> reset_l; sc_signal<bool> reset_l;
sc_signal<vluint32_t> in_small; sc_signal<uint32_t> in_small;
sc_signal<vluint64_t> in_quad; sc_signal<uint64_t> in_quad;
sc_signal<sc_bv<70>> in_wide; sc_signal<sc_bv<70>> in_wide;
sc_signal<vluint32_t> out_small; sc_signal<uint32_t> out_small;
sc_signal<vluint64_t> out_quad; sc_signal<uint64_t> out_quad;
sc_signal<sc_bv<70>> out_wide; sc_signal<sc_bv<70>> out_wide;
// Construct the Verilated model, from inside Vtop.h // Construct the Verilated model, from inside Vtop.h

View File

@ -74,10 +74,10 @@ constexpr unsigned VL_VALUE_STRING_MAX_WIDTH = 8192;
//=========================================================================== //===========================================================================
// Static sanity checks // Static sanity checks
static_assert(sizeof(vluint8_t) == 1, "vluint8_t is missized"); static_assert(sizeof(uint8_t) == 1, "uint8_t is missized");
static_assert(sizeof(vluint16_t) == 2, "vluint8_t is missized"); static_assert(sizeof(uint16_t) == 2, "uint8_t is missized");
static_assert(sizeof(vluint32_t) == 4, "vluint8_t is missized"); static_assert(sizeof(uint32_t) == 4, "uint8_t is missized");
static_assert(sizeof(vluint64_t) == 8, "vluint8_t is missized"); static_assert(sizeof(uint64_t) == 8, "uint8_t is missized");
//=========================================================================== //===========================================================================
// Global variables // Global variables
@ -244,21 +244,21 @@ std::string _vl_string_vprintf(const char* formatp, va_list ap) VL_MT_SAFE {
return out; return out;
} }
vluint64_t _vl_dbg_sequence_number() VL_MT_SAFE { uint64_t _vl_dbg_sequence_number() VL_MT_SAFE {
#ifdef VL_THREADED #ifdef VL_THREADED
static std::atomic<vluint64_t> sequence; static std::atomic<uint64_t> sequence;
#else #else
static vluint64_t sequence = 0; static uint64_t sequence = 0;
#endif #endif
return ++sequence; return ++sequence;
} }
vluint32_t VL_THREAD_ID() VL_MT_SAFE { uint32_t VL_THREAD_ID() VL_MT_SAFE {
#ifdef VL_THREADED #ifdef VL_THREADED
// Alternative is to use std::this_thread::get_id, but that returns a // Alternative is to use std::this_thread::get_id, but that returns a
// hard-to-read number and is very slow // hard-to-read number and is very slow
static std::atomic<vluint32_t> s_nextId(0); static std::atomic<uint32_t> s_nextId(0);
static VL_THREAD_LOCAL vluint32_t t_myId = ++s_nextId; static VL_THREAD_LOCAL uint32_t t_myId = ++s_nextId;
return t_myId; return t_myId;
#else #else
return 0; return 0;
@ -296,7 +296,7 @@ void VL_PRINTF_MT(const char* formatp, ...) VL_MT_SAFE {
//=========================================================================== //===========================================================================
// Random -- Mostly called at init time, so not inline. // Random -- Mostly called at init time, so not inline.
static vluint32_t vl_sys_rand32() VL_MT_UNSAFE { static uint32_t vl_sys_rand32() VL_MT_UNSAFE {
// Return random 32-bits using system library. // Return random 32-bits using system library.
// Used only to construct seed for Verilator's PNRG. // Used only to construct seed for Verilator's PNRG.
static VerilatedMutex s_mutex; static VerilatedMutex s_mutex;
@ -309,9 +309,9 @@ static vluint32_t vl_sys_rand32() VL_MT_UNSAFE {
#endif #endif
} }
vluint64_t vl_rand64() VL_MT_SAFE { uint64_t vl_rand64() VL_MT_SAFE {
static VL_THREAD_LOCAL vluint64_t t_state[2]; static VL_THREAD_LOCAL uint64_t t_state[2];
static VL_THREAD_LOCAL vluint32_t t_seedEpoch = 0; static VL_THREAD_LOCAL uint32_t t_seedEpoch = 0;
// For speed, we use a thread-local epoch number to know when to reseed // For speed, we use a thread-local epoch number to know when to reseed
// A thread always belongs to a single context, so this works out ok // A thread always belongs to a single context, so this works out ok
if (VL_UNLIKELY(t_seedEpoch != VerilatedContextImp::randSeedEpoch())) { if (VL_UNLIKELY(t_seedEpoch != VerilatedContextImp::randSeedEpoch())) {
@ -325,7 +325,7 @@ vluint64_t vl_rand64() VL_MT_SAFE {
if (VL_COUNTONES_I(t_state[1]) < 10) t_state[1] = ~t_state[1]; if (VL_COUNTONES_I(t_state[1]) < 10) t_state[1] = ~t_state[1];
} }
// Xoroshiro128+ algorithm // Xoroshiro128+ algorithm
const vluint64_t result = t_state[0] + t_state[1]; const uint64_t result = t_state[0] + t_state[1];
t_state[1] ^= t_state[0]; t_state[1] ^= t_state[0];
t_state[0] = (((t_state[0] << 55) | (t_state[0] >> 9)) ^ t_state[1] ^ (t_state[1] << 14)); t_state[0] = (((t_state[0] << 55) | (t_state[0] >> 9)) ^ t_state[1] ^ (t_state[1] << 14));
t_state[1] = (t_state[1] << 36) | (t_state[1] >> 28); t_state[1] = (t_state[1] << 36) | (t_state[1] >> 28);
@ -410,11 +410,11 @@ WDataOutP _vl_moddiv_w(int lbits, WDataOutP owp, const WDataInP lwp, const WData
const int vw = VL_WORDS_I(vmsbp1); // aka "n" in the algorithm const int vw = VL_WORDS_I(vmsbp1); // aka "n" in the algorithm
if (vw == 1) { // Single divisor word breaks rest of algorithm if (vw == 1) { // Single divisor word breaks rest of algorithm
vluint64_t k = 0; uint64_t k = 0;
for (int j = uw - 1; j >= 0; --j) { for (int j = uw - 1; j >= 0; --j) {
const vluint64_t unw64 = ((k << 32ULL) + static_cast<vluint64_t>(lwp[j])); const uint64_t unw64 = ((k << 32ULL) + static_cast<uint64_t>(lwp[j]));
owp[j] = unw64 / static_cast<vluint64_t>(rwp[0]); owp[j] = unw64 / static_cast<uint64_t>(rwp[0]);
k = unw64 - static_cast<vluint64_t>(owp[j]) * static_cast<vluint64_t>(rwp[0]); k = unw64 - static_cast<uint64_t>(owp[j]) * static_cast<uint64_t>(rwp[0]);
} }
if (is_modulus) { if (is_modulus) {
owp[0] = k; owp[0] = k;
@ -424,8 +424,8 @@ WDataOutP _vl_moddiv_w(int lbits, WDataOutP owp, const WDataInP lwp, const WData
} }
// +1 word as we may shift during normalization // +1 word as we may shift during normalization
vluint32_t un[VL_MULS_MAX_WORDS + 1]; // Fixed size, as MSVC++ doesn't allow [words] here uint32_t un[VL_MULS_MAX_WORDS + 1]; // Fixed size, as MSVC++ doesn't allow [words] here
vluint32_t vn[VL_MULS_MAX_WORDS + 1]; // v normalized uint32_t vn[VL_MULS_MAX_WORDS + 1]; // v normalized
// Zero for ease of debugging and to save having to zero for shifts // Zero for ease of debugging and to save having to zero for shifts
// Note +1 as loop will use extra word // Note +1 as loop will use extra word
@ -434,7 +434,7 @@ WDataOutP _vl_moddiv_w(int lbits, WDataOutP owp, const WDataInP lwp, const WData
// Algorithm requires divisor MSB to be set // Algorithm requires divisor MSB to be set
// Copy and shift to normalize divisor so MSB of vn[vw-1] is set // Copy and shift to normalize divisor so MSB of vn[vw-1] is set
const int s = 31 - VL_BITBIT_I(vmsbp1 - 1); // shift amount (0...31) const int s = 31 - VL_BITBIT_I(vmsbp1 - 1); // shift amount (0...31)
const vluint32_t shift_mask = s ? 0xffffffff : 0; // otherwise >> 32 won't mask the value const uint32_t shift_mask = s ? 0xffffffff : 0; // otherwise >> 32 won't mask the value
for (int i = vw - 1; i > 0; --i) { for (int i = vw - 1; i > 0; --i) {
vn[i] = (rwp[i] << s) | (shift_mask & (rwp[i - 1] >> (32 - s))); vn[i] = (rwp[i] << s) | (shift_mask & (rwp[i - 1] >> (32 - s)));
} }
@ -454,10 +454,10 @@ WDataOutP _vl_moddiv_w(int lbits, WDataOutP owp, const WDataInP lwp, const WData
// Main loop // Main loop
for (int j = uw - vw; j >= 0; --j) { for (int j = uw - vw; j >= 0; --j) {
// Estimate // Estimate
const vluint64_t unw64 = (static_cast<vluint64_t>(un[j + vw]) << 32ULL const uint64_t unw64
| static_cast<vluint64_t>(un[j + vw - 1])); = (static_cast<uint64_t>(un[j + vw]) << 32ULL | static_cast<uint64_t>(un[j + vw - 1]));
vluint64_t qhat = unw64 / static_cast<vluint64_t>(vn[vw - 1]); uint64_t qhat = unw64 / static_cast<uint64_t>(vn[vw - 1]);
vluint64_t rhat = unw64 - qhat * static_cast<vluint64_t>(vn[vw - 1]); uint64_t rhat = unw64 - qhat * static_cast<uint64_t>(vn[vw - 1]);
again: again:
if (qhat >= 0x100000000ULL || ((qhat * vn[vw - 2]) > ((rhat << 32ULL) + un[j + vw - 2]))) { if (qhat >= 0x100000000ULL || ((qhat * vn[vw - 2]) > ((rhat << 32ULL) + un[j + vw - 2]))) {
@ -466,10 +466,10 @@ WDataOutP _vl_moddiv_w(int lbits, WDataOutP owp, const WDataInP lwp, const WData
if (rhat < 0x100000000ULL) goto again; if (rhat < 0x100000000ULL) goto again;
} }
vlsint64_t t = 0; // Must be signed int64_t t = 0; // Must be signed
vluint64_t k = 0; uint64_t k = 0;
for (int i = 0; i < vw; ++i) { for (int i = 0; i < vw; ++i) {
const vluint64_t p = qhat * vn[i]; // Multiply by estimate const uint64_t p = qhat * vn[i]; // Multiply by estimate
t = un[i + j] - k - (p & 0xFFFFFFFFULL); // Subtract t = un[i + j] - k - (p & 0xFFFFFFFFULL); // Subtract
un[i + j] = t; un[i + j] = t;
k = (p >> 32ULL) - (t >> 32ULL); k = (p >> 32ULL) - (t >> 32ULL);
@ -483,7 +483,7 @@ WDataOutP _vl_moddiv_w(int lbits, WDataOutP owp, const WDataInP lwp, const WData
owp[j]--; owp[j]--;
k = 0; k = 0;
for (int i = 0; i < vw; ++i) { for (int i = 0; i < vw; ++i) {
t = static_cast<vluint64_t>(un[i + j]) + static_cast<vluint64_t>(vn[i]) + k; t = static_cast<uint64_t>(un[i + j]) + static_cast<uint64_t>(vn[i]) + k;
un[i + j] = t; un[i + j] = t;
k = t >> 32ULL; k = t >> 32ULL;
} }
@ -614,7 +614,7 @@ double VL_ITOR_D_W(int lbits, const WDataInP lwp) VL_PURE {
} }
double VL_ISTOR_D_W(int lbits, const WDataInP lwp) VL_PURE { double VL_ISTOR_D_W(int lbits, const WDataInP lwp) VL_PURE {
if (!VL_SIGN_W(lbits, lwp)) return VL_ITOR_D_W(lbits, lwp); if (!VL_SIGN_W(lbits, lwp)) return VL_ITOR_D_W(lbits, lwp);
vluint32_t pos[VL_MULS_MAX_WORDS + 1]; // Fixed size, as MSVC++ doesn't allow [words] here uint32_t pos[VL_MULS_MAX_WORDS + 1]; // Fixed size, as MSVC++ doesn't allow [words] here
VL_NEGATE_W(VL_WORDS_I(lbits), pos, lwp); VL_NEGATE_W(VL_WORDS_I(lbits), pos, lwp);
_vl_clean_inplace_w(lbits, pos); _vl_clean_inplace_w(lbits, pos);
return -VL_ITOR_D_W(lbits, pos); return -VL_ITOR_D_W(lbits, pos);
@ -688,7 +688,7 @@ std::string _vl_vsformat_time(char* tmp, T ld, int timeunit, bool left, size_t w
const WDataInP integer = VL_DIV_WWW(b, tmp0, shifted, fracDigitsPow10); const WDataInP integer = VL_DIV_WWW(b, tmp0, shifted, fracDigitsPow10);
const WDataInP frac = VL_MODDIV_WWW(b, tmp1, shifted, fracDigitsPow10); const WDataInP frac = VL_MODDIV_WWW(b, tmp1, shifted, fracDigitsPow10);
const WDataInP max64Bit const WDataInP max64Bit
= VL_EXTEND_WQ(b, 0, tmp2, std::numeric_limits<vluint64_t>::max()); // breaks shifted = VL_EXTEND_WQ(b, 0, tmp2, std::numeric_limits<uint64_t>::max()); // breaks shifted
if (VL_GT_W(w, integer, max64Bit)) { if (VL_GT_W(w, integer, max64Bit)) {
WDataOutP v = VL_ASSIGN_W(b, tmp3, integer); // breaks fracDigitsPow10 WDataOutP v = VL_ASSIGN_W(b, tmp3, integer); // breaks fracDigitsPow10
VlWide<w> zero, ten; VlWide<w> zero, ten;
@ -712,7 +712,7 @@ std::string _vl_vsformat_time(char* tmp, T ld, int timeunit, bool left, size_t w
fracDigits, VL_SET_QW(frac), suffix.c_str()); fracDigits, VL_SET_QW(frac), suffix.c_str());
} }
} else { } else {
const vluint64_t integer64 = VL_SET_QW(integer); const uint64_t integer64 = VL_SET_QW(integer);
if (!fracDigits) { if (!fracDigits) {
digits = VL_SNPRINTF(tmp, VL_VALUE_STRING_MAX_WIDTH, "%" PRIu64 "%s", integer64, digits = VL_SNPRINTF(tmp, VL_VALUE_STRING_MAX_WIDTH, "%" PRIu64 "%s", integer64,
suffix.c_str()); suffix.c_str());
@ -879,9 +879,9 @@ void _vl_vsformat(std::string& output, const char* formatp, va_list ap) VL_MT_SA
int digits = 0; int digits = 0;
std::string append; std::string append;
if (lbits <= VL_QUADSIZE) { if (lbits <= VL_QUADSIZE) {
digits = VL_SNPRINTF( digits
t_tmp, VL_VALUE_STRING_MAX_WIDTH, "%" PRId64, = VL_SNPRINTF(t_tmp, VL_VALUE_STRING_MAX_WIDTH, "%" PRId64,
static_cast<vlsint64_t>(VL_EXTENDS_QQ(lbits, lbits, ld))); static_cast<int64_t>(VL_EXTENDS_QQ(lbits, lbits, ld)));
append = t_tmp; append = t_tmp;
} else { } else {
if (VL_SIGN_E(lbits, lwp[VL_WORDS_I(lbits) - 1])) { if (VL_SIGN_E(lbits, lwp[VL_WORDS_I(lbits) - 1])) {
@ -1184,7 +1184,7 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
_vl_vsss_skipspace(fp, floc, fromp, fstr); _vl_vsss_skipspace(fp, floc, fromp, fstr);
_vl_vsss_read_str(fp, floc, fromp, fstr, t_tmp, "0123456789+-xXzZ?_"); _vl_vsss_read_str(fp, floc, fromp, fstr, t_tmp, "0123456789+-xXzZ?_");
if (!t_tmp[0]) goto done; if (!t_tmp[0]) goto done;
vlsint64_t ld = 0; int64_t ld = 0;
std::sscanf(t_tmp, "%30" PRId64, &ld); std::sscanf(t_tmp, "%30" PRId64, &ld);
VL_SET_WQ(owp, ld); VL_SET_WQ(owp, ld);
break; break;
@ -1198,7 +1198,7 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
// cppcheck-suppress unusedStructMember // It's used // cppcheck-suppress unusedStructMember // It's used
union { union {
double r; double r;
vlsint64_t ld; int64_t ld;
} u; } u;
u.r = std::strtod(t_tmp, nullptr); u.r = std::strtod(t_tmp, nullptr);
VL_SET_WQ(owp, u.ld); VL_SET_WQ(owp, u.ld);
@ -1643,7 +1643,7 @@ IData VL_VALUEPLUSARGS_INW(int rbits, const std::string& ld, WDataOutP rwp) VL_M
VL_ZERO_RESET_W(rbits, rwp); VL_ZERO_RESET_W(rbits, rwp);
switch (std::tolower(fmt)) { switch (std::tolower(fmt)) {
case 'd': { case 'd': {
vlsint64_t lld = 0; int64_t lld = 0;
std::sscanf(dp, "%30" PRId64, &lld); std::sscanf(dp, "%30" PRId64, &lld);
VL_SET_WQ(rwp, lld); VL_SET_WQ(rwp, lld);
break; break;
@ -1768,7 +1768,7 @@ std::string VL_CVT_PACK_STR_NW(int lwords, const WDataInP lwp) VL_MT_SAFE {
std::string VL_PUTC_N(const std::string& lhs, IData rhs, CData ths) VL_PURE { std::string VL_PUTC_N(const std::string& lhs, IData rhs, CData ths) VL_PURE {
std::string lstring = lhs; std::string lstring = lhs;
const vlsint32_t rhs_s = rhs; // To signed value const int32_t rhs_s = rhs; // To signed value
// 6.16.2:str.putc(i, c) does not change the value when i < 0 || i >= str.len() || c == 0 // 6.16.2:str.putc(i, c) does not change the value when i < 0 || i >= str.len() || c == 0
if (0 <= rhs_s && rhs < lhs.length() && ths != 0) lstring[rhs] = ths; if (0 <= rhs_s && rhs < lhs.length() && ths != 0) lstring[rhs] = ths;
return lstring; return lstring;
@ -1776,15 +1776,15 @@ std::string VL_PUTC_N(const std::string& lhs, IData rhs, CData ths) VL_PURE {
CData VL_GETC_N(const std::string& lhs, IData rhs) VL_PURE { CData VL_GETC_N(const std::string& lhs, IData rhs) VL_PURE {
CData v = 0; CData v = 0;
const vlsint32_t rhs_s = rhs; // To signed value const int32_t rhs_s = rhs; // To signed value
// 6.16.3:str.getc(i) returns 0 if i < 0 || i >= str.len() // 6.16.3:str.getc(i) returns 0 if i < 0 || i >= str.len()
if (0 <= rhs_s && rhs < lhs.length()) v = lhs[rhs]; if (0 <= rhs_s && rhs < lhs.length()) v = lhs[rhs];
return v; return v;
} }
std::string VL_SUBSTR_N(const std::string& lhs, IData rhs, IData ths) VL_PURE { std::string VL_SUBSTR_N(const std::string& lhs, IData rhs, IData ths) VL_PURE {
const vlsint32_t rhs_s = rhs; // To signed value const int32_t rhs_s = rhs; // To signed value
const vlsint32_t ths_s = ths; // To signed value const int32_t ths_s = ths; // To signed value
// 6.16.8:str.substr(i, j) returns an empty string when i < 0 || j < i || j >= str.len() // 6.16.8:str.substr(i, j) returns an empty string when i < 0 || j < i || j >= str.len()
if (rhs_s < 0 || ths_s < rhs_s || ths >= lhs.length()) return ""; if (rhs_s < 0 || ths_s < rhs_s || ths >= lhs.length()) return "";
// Second parameter of std::string::substr(i, n) is length, not position as in SystemVerilog // Second parameter of std::string::substr(i, n) is length, not position as in SystemVerilog
@ -1823,7 +1823,7 @@ static const char* memhFormat(int nBits) {
return t_buf; return t_buf;
} }
static const char* formatBinary(int nBits, vluint32_t bits) { static const char* formatBinary(int nBits, uint32_t bits) {
assert((nBits >= 1) && (nBits <= 32)); assert((nBits >= 1) && (nBits <= 32));
static VL_THREAD_LOCAL char t_buf[64]; static VL_THREAD_LOCAL char t_buf[64];
@ -2027,9 +2027,9 @@ void VlWriteMem::print(QData addr, bool addrstamp, const void* valuep) {
} }
} else if (m_bits <= 64) { } else if (m_bits <= 64) {
const QData* const datap = reinterpret_cast<const QData*>(valuep); const QData* const datap = reinterpret_cast<const QData*>(valuep);
const vluint64_t value = VL_MASK_Q(m_bits) & *datap; const uint64_t value = VL_MASK_Q(m_bits) & *datap;
const vluint32_t lo = value & 0xffffffff; const uint32_t lo = value & 0xffffffff;
const vluint32_t hi = value >> 32; const uint32_t hi = value >> 32;
if (m_hex) { if (m_hex) {
fprintf(m_fp, memhFormat(m_bits - 32), hi); fprintf(m_fp, memhFormat(m_bits - 32), hi);
fprintf(m_fp, "%08x\n", lo); fprintf(m_fp, "%08x\n", lo);
@ -2235,8 +2235,8 @@ double vl_time_multiplier(int scale) VL_PURE {
return pow10[scale]; return pow10[scale];
} }
} }
vluint64_t vl_time_pow10(int n) { uint64_t vl_time_pow10(int n) {
static const vluint64_t pow10[20] = { static const uint64_t pow10[20] = {
1ULL, 1ULL,
10ULL, 10ULL,
100ULL, 100ULL,
@ -2348,11 +2348,11 @@ void VerilatedContext::gotFinish(bool flag) VL_MT_SAFE {
const VerilatedLockGuard lock{m_mutex}; const VerilatedLockGuard lock{m_mutex};
m_s.m_gotFinish = flag; m_s.m_gotFinish = flag;
} }
void VerilatedContext::profExecStart(vluint64_t flag) VL_MT_SAFE { void VerilatedContext::profExecStart(uint64_t flag) VL_MT_SAFE {
const VerilatedLockGuard lock{m_mutex}; const VerilatedLockGuard lock{m_mutex};
m_ns.m_profExecStart = flag; m_ns.m_profExecStart = flag;
} }
void VerilatedContext::profExecWindow(vluint64_t flag) VL_MT_SAFE { void VerilatedContext::profExecWindow(uint64_t flag) VL_MT_SAFE {
const VerilatedLockGuard lock{m_mutex}; const VerilatedLockGuard lock{m_mutex};
m_ns.m_profExecWindow = flag; m_ns.m_profExecWindow = flag;
} }
@ -2598,20 +2598,19 @@ void VerilatedContext::randSeed(int val) VL_MT_SAFE {
// and so the rand seed's mutex must also be static // and so the rand seed's mutex must also be static
const VerilatedLockGuard lock{VerilatedContextImp::s().s_randMutex}; const VerilatedLockGuard lock{VerilatedContextImp::s().s_randMutex};
m_s.m_randSeed = val; m_s.m_randSeed = val;
const vluint64_t newEpoch = VerilatedContextImp::s().s_randSeedEpoch + 1; const uint64_t newEpoch = VerilatedContextImp::s().s_randSeedEpoch + 1;
// Obververs must see new epoch AFTER seed updated // Obververs must see new epoch AFTER seed updated
#ifdef VL_THREADED #ifdef VL_THREADED
std::atomic_signal_fence(std::memory_order_release); std::atomic_signal_fence(std::memory_order_release);
#endif #endif
VerilatedContextImp::s().s_randSeedEpoch = newEpoch; VerilatedContextImp::s().s_randSeedEpoch = newEpoch;
} }
vluint64_t VerilatedContextImp::randSeedDefault64() const VL_MT_SAFE { uint64_t VerilatedContextImp::randSeedDefault64() const VL_MT_SAFE {
if (randSeed() != 0) { if (randSeed() != 0) {
return ((static_cast<vluint64_t>(randSeed()) << 32) return ((static_cast<uint64_t>(randSeed()) << 32) ^ (static_cast<uint64_t>(randSeed())));
^ (static_cast<vluint64_t>(randSeed())));
} else { } else {
return ((static_cast<vluint64_t>(vl_sys_rand32()) << 32) return ((static_cast<uint64_t>(vl_sys_rand32()) << 32)
^ (static_cast<vluint64_t>(vl_sys_rand32()))); ^ (static_cast<uint64_t>(vl_sys_rand32())));
} }
} }
@ -2855,8 +2854,8 @@ VerilatedModule::~VerilatedModule() {
// VerilatedVar:: Methods // VerilatedVar:: Methods
// cppcheck-suppress unusedFunction // Used by applications // cppcheck-suppress unusedFunction // Used by applications
vluint32_t VerilatedVarProps::entSize() const { uint32_t VerilatedVarProps::entSize() const {
vluint32_t size = 1; uint32_t size = 1;
switch (vltype()) { switch (vltype()) {
case VLVT_PTR: size = sizeof(void*); break; case VLVT_PTR: size = sizeof(void*); break;
case VLVT_UINT8: size = sizeof(CData); break; case VLVT_UINT8: size = sizeof(CData); break;
@ -2879,7 +2878,7 @@ void* VerilatedVarProps::datapAdjustIndex(void* datap, int dim, int indx) const
if (VL_UNLIKELY(dim <= 0 || dim > udims())) return nullptr; if (VL_UNLIKELY(dim <= 0 || dim > udims())) return nullptr;
if (VL_UNLIKELY(indx < low(dim) || indx > high(dim))) return nullptr; if (VL_UNLIKELY(indx < low(dim) || indx > high(dim))) return nullptr;
const int indxAdj = indx - low(dim); const int indxAdj = indx - low(dim);
vluint8_t* bytep = reinterpret_cast<vluint8_t*>(datap); uint8_t* bytep = reinterpret_cast<uint8_t*>(datap);
// If on index 1 of a 2 index array, then each index 1 is index2sz*entsz // If on index 1 of a 2 index array, then each index 1 is index2sz*entsz
size_t slicesz = entSize(); size_t slicesz = entSize();
for (int d = dim + 1; d <= m_udims; ++d) slicesz *= elements(d); for (int d = dim + 1; d <= m_udims; ++d) slicesz *= elements(d);
@ -2900,7 +2899,7 @@ VerilatedScope::~VerilatedScope() {
} }
void VerilatedScope::configure(VerilatedSyms* symsp, const char* prefixp, const char* suffixp, void VerilatedScope::configure(VerilatedSyms* symsp, const char* prefixp, const char* suffixp,
const char* identifier, vlsint8_t timeunit, const char* identifier, int8_t timeunit,
const Type& type) VL_MT_UNSAFE { const Type& type) VL_MT_UNSAFE {
// Slowpath - called once/scope at construction // Slowpath - called once/scope at construction
// We don't want the space and reference-count access overhead of strings. // We don't want the space and reference-count access overhead of strings.

View File

@ -101,11 +101,11 @@ class VerilatedVcdSc;
// clang-format off // clang-format off
// P // Packed data of bit type (C/S/I/Q/W) // P // Packed data of bit type (C/S/I/Q/W)
using CData = vluint8_t; ///< Data representing 'bit' of 1-8 packed bits using CData = uint8_t; ///< Data representing 'bit' of 1-8 packed bits
using SData = vluint16_t; ///< Data representing 'bit' of 9-16 packed bits using SData = uint16_t; ///< Data representing 'bit' of 9-16 packed bits
using IData = vluint32_t; ///< Data representing 'bit' of 17-32 packed bits using IData = uint32_t; ///< Data representing 'bit' of 17-32 packed bits
using QData = vluint64_t; ///< Data representing 'bit' of 33-64 packed bits using QData = uint64_t; ///< Data representing 'bit' of 33-64 packed bits
using EData = vluint32_t; ///< Data representing one element of WData array using EData = uint32_t; ///< Data representing one element of WData array
using WData = EData; ///< Data representing >64 packed bits (used as pointer) using WData = EData; ///< Data representing >64 packed bits (used as pointer)
// F = float; // No typedef needed; Verilator uses float // F = float; // No typedef needed; Verilator uses float
// D = double; // No typedef needed; Verilator uses double // D = double; // No typedef needed; Verilator uses double
@ -115,7 +115,7 @@ using WData = EData; ///< Data representing >64 packed bits (used as poin
using WDataInP = const WData*; ///< 'bit' of >64 packed bits as array input to a function using WDataInP = const WData*; ///< 'bit' of >64 packed bits as array input to a function
using WDataOutP = WData*; ///< 'bit' of >64 packed bits as array output from a function using WDataOutP = WData*; ///< 'bit' of >64 packed bits as array output from a function
enum VerilatedVarType : vluint8_t { enum VerilatedVarType : uint8_t {
VLVT_UNKNOWN = 0, VLVT_UNKNOWN = 0,
VLVT_PTR, // Pointer to something VLVT_PTR, // Pointer to something
VLVT_UINT8, // AKA CData VLVT_UINT8, // AKA CData
@ -143,7 +143,7 @@ enum VerilatedVarFlags {
// Mutex and threading support // Mutex and threading support
// Return current thread ID (or 0), not super fast, cache if needed // Return current thread ID (or 0), not super fast, cache if needed
extern vluint32_t VL_THREAD_ID() VL_MT_SAFE; extern uint32_t VL_THREAD_ID() VL_MT_SAFE;
#if VL_THREADED #if VL_THREADED
@ -226,7 +226,7 @@ public:
class VerilatedAssertOneThread final { class VerilatedAssertOneThread final {
// MEMBERS // MEMBERS
#if defined(VL_THREADED) && defined(VL_DEBUG) #if defined(VL_THREADED) && defined(VL_DEBUG)
vluint32_t m_threadid; // Thread that is legal uint32_t m_threadid; // Thread that is legal
public: public:
// CONSTRUCTORS // CONSTRUCTORS
// The constructor establishes the thread id for all later calls. // The constructor establishes the thread id for all later calls.
@ -320,10 +320,10 @@ protected:
bool m_fatalOnVpiError = true; // Fatal on vpi error/unsupported bool m_fatalOnVpiError = true; // Fatal on vpi error/unsupported
bool m_gotError = false; // A $finish statement executed bool m_gotError = false; // A $finish statement executed
bool m_gotFinish = false; // A $finish or $stop statement executed bool m_gotFinish = false; // A $finish or $stop statement executed
vluint64_t m_time = 0; // Current $time (unscaled), 0=at zero, or legacy uint64_t m_time = 0; // Current $time (unscaled), 0=at zero, or legacy
// Slow path // Slow path
vlsint8_t m_timeunit; // Time unit as 0..15 int8_t m_timeunit; // Time unit as 0..15
vlsint8_t m_timeprecision; // Time precision as 0..15 int8_t m_timeprecision; // Time precision as 0..15
int m_errorCount = 0; // Number of errors int m_errorCount = 0; // Number of errors
int m_errorLimit = 1; // Stop on error number int m_errorLimit = 1; // Stop on error number
int m_randReset = 0; // Random reset: 0=all 0s, 1=all 1s, 2=random int m_randReset = 0; // Random reset: 0=all 0s, 1=all 1s, 2=random
@ -344,8 +344,8 @@ protected:
struct NonSerialized { // Non-serialized information struct NonSerialized { // Non-serialized information
// These are reloaded from on command-line settings, so do not need to persist // These are reloaded from on command-line settings, so do not need to persist
// Fast path // Fast path
vluint64_t m_profExecStart = 1; // +prof+exec+start time uint64_t m_profExecStart = 1; // +prof+exec+start time
vluint32_t m_profExecWindow = 2; // +prof+exec+window size uint32_t m_profExecWindow = 2; // +prof+exec+window size
// Slow path // Slow path
std::string m_profExecFilename; // +prof+exec+file filename std::string m_profExecFilename; // +prof+exec+file filename
std::string m_profVltFilename; // +prof+vlt filename std::string m_profVltFilename; // +prof+vlt filename
@ -468,16 +468,16 @@ public:
/// timeInc, operating on the thread's context. /// timeInc, operating on the thread's context.
/// ///
/// * Else, if VL_TIME_STAMP64 is defined, time comes from the legacy /// * Else, if VL_TIME_STAMP64 is defined, time comes from the legacy
/// 'vluint64_t vl_time_stamp64()' which must a function be defined by /// 'uint64_t vl_time_stamp64()' which must a function be defined by
/// the user's wrapper. /// the user's wrapper.
/// ///
/// * Else, time comes from the legacy 'double sc_time_stamp()' which /// * Else, time comes from the legacy 'double sc_time_stamp()' which
/// must be a function defined by the user's wrapper. /// must be a function defined by the user's wrapper.
vluint64_t time() const VL_MT_SAFE; uint64_t time() const VL_MT_SAFE;
/// Set current simulation time. See time() for side effect details /// Set current simulation time. See time() for side effect details
void time(vluint64_t value) VL_MT_SAFE { m_s.m_time = value; } void time(uint64_t value) VL_MT_SAFE { m_s.m_time = value; }
/// Advance current simulation time. See time() for side effect details /// Advance current simulation time. See time() for side effect details
void timeInc(vluint64_t add) VL_MT_UNSAFE { m_s.m_time += add; } void timeInc(uint64_t add) VL_MT_UNSAFE { m_s.m_time += add; }
/// Return time units as power-of-ten /// Return time units as power-of-ten
int timeunit() const VL_MT_SAFE { return -m_s.m_timeunit; } int timeunit() const VL_MT_SAFE { return -m_s.m_timeunit; }
/// Set time units as power-of-ten /// Set time units as power-of-ten
@ -519,10 +519,10 @@ public: // But for internal use only
std::string dumpfileCheck() const VL_MT_SAFE_EXCLUDES(m_timeDumpMutex); std::string dumpfileCheck() const VL_MT_SAFE_EXCLUDES(m_timeDumpMutex);
// Internal: --prof-exec related settings // Internal: --prof-exec related settings
void profExecStart(vluint64_t flag) VL_MT_SAFE; void profExecStart(uint64_t flag) VL_MT_SAFE;
vluint64_t profExecStart() const VL_MT_SAFE { return m_ns.m_profExecStart; } uint64_t profExecStart() const VL_MT_SAFE { return m_ns.m_profExecStart; }
void profExecWindow(vluint64_t flag) VL_MT_SAFE; void profExecWindow(uint64_t flag) VL_MT_SAFE;
vluint32_t profExecWindow() const VL_MT_SAFE { return m_ns.m_profExecWindow; } uint32_t profExecWindow() const VL_MT_SAFE { return m_ns.m_profExecWindow; }
void profExecFilename(const std::string& flag) VL_MT_SAFE; void profExecFilename(const std::string& flag) VL_MT_SAFE;
std::string profExecFilename() const VL_MT_SAFE; std::string profExecFilename() const VL_MT_SAFE;
void profVltFilename(const std::string& flag) VL_MT_SAFE; void profVltFilename(const std::string& flag) VL_MT_SAFE;
@ -559,7 +559,7 @@ public: // But for internal use only
class VerilatedScope final { class VerilatedScope final {
public: public:
enum Type : vluint8_t { enum Type : uint8_t {
SCOPE_MODULE, SCOPE_MODULE,
SCOPE_OTHER SCOPE_OTHER
}; // Type of a scope, currently module is only interesting }; // Type of a scope, currently module is only interesting
@ -572,21 +572,21 @@ private:
VerilatedVarNameMap* m_varsp = nullptr; // Variable map VerilatedVarNameMap* m_varsp = nullptr; // Variable map
const char* m_namep = nullptr; // Scope name (Slowpath) const char* m_namep = nullptr; // Scope name (Slowpath)
const char* m_identifierp = nullptr; // Identifier of scope (with escapes removed) const char* m_identifierp = nullptr; // Identifier of scope (with escapes removed)
vlsint8_t m_timeunit = 0; // Timeunit in negative power-of-10 int8_t m_timeunit = 0; // Timeunit in negative power-of-10
Type m_type = SCOPE_OTHER; // Type of the scope Type m_type = SCOPE_OTHER; // Type of the scope
public: // But internals only - called from VerilatedModule's public: // But internals only - called from VerilatedModule's
VerilatedScope() = default; VerilatedScope() = default;
~VerilatedScope(); ~VerilatedScope();
void configure(VerilatedSyms* symsp, const char* prefixp, const char* suffixp, void configure(VerilatedSyms* symsp, const char* prefixp, const char* suffixp,
const char* identifier, vlsint8_t timeunit, const Type& type) VL_MT_UNSAFE; const char* identifier, int8_t timeunit, const Type& type) VL_MT_UNSAFE;
void exportInsert(int finalize, const char* namep, void* cb) VL_MT_UNSAFE; void exportInsert(int finalize, const char* namep, void* cb) VL_MT_UNSAFE;
void varInsert(int finalize, const char* namep, void* datap, bool isParam, void varInsert(int finalize, const char* namep, void* datap, bool isParam,
VerilatedVarType vltype, int vlflags, int dims, ...) VL_MT_UNSAFE; VerilatedVarType vltype, int vlflags, int dims, ...) VL_MT_UNSAFE;
// ACCESSORS // ACCESSORS
const char* name() const { return m_namep; } const char* name() const { return m_namep; }
const char* identifier() const { return m_identifierp; } const char* identifier() const { return m_identifierp; }
vlsint8_t timeunit() const { return m_timeunit; } int8_t timeunit() const { return m_timeunit; }
inline VerilatedSyms* symsp() const { return m_symsp; } inline VerilatedSyms* symsp() const { return m_symsp; }
VerilatedVar* varFind(const char* namep) const VL_MT_SAFE_POSTINIT; VerilatedVar* varFind(const char* namep) const VL_MT_SAFE_POSTINIT;
VerilatedVarNameMap* varsp() const VL_MT_SAFE_POSTINIT { return m_varsp; } VerilatedVarNameMap* varsp() const VL_MT_SAFE_POSTINIT { return m_varsp; }
@ -636,9 +636,9 @@ class Verilated final {
// Fast path // Fast path
VerilatedContext* t_contextp = nullptr; // Thread's context VerilatedContext* t_contextp = nullptr; // Thread's context
#ifdef VL_THREADED #ifdef VL_THREADED
vluint32_t t_mtaskId = 0; // mtask# executing on this thread uint32_t t_mtaskId = 0; // mtask# executing on this thread
// Messages maybe pending on thread, needs end-of-eval calls // Messages maybe pending on thread, needs end-of-eval calls
vluint32_t t_endOfEvalReqd = 0; uint32_t t_endOfEvalReqd = 0;
#endif #endif
const VerilatedScope* t_dpiScopep = nullptr; // DPI context scope const VerilatedScope* t_dpiScopep = nullptr; // DPI context scope
const char* t_dpiFilename = nullptr; // DPI context filename const char* t_dpiFilename = nullptr; // DPI context filename
@ -760,11 +760,11 @@ public:
/// Return VerilatedContext::randSeed using current thread's VerilatedContext /// Return VerilatedContext::randSeed using current thread's VerilatedContext
static int randSeed() VL_MT_SAFE { return Verilated::threadContextp()->randSeed(); } static int randSeed() VL_MT_SAFE { return Verilated::threadContextp()->randSeed(); }
/// Call VerilatedContext::time using current thread's VerilatedContext /// Call VerilatedContext::time using current thread's VerilatedContext
static void time(vluint64_t val) VL_MT_SAFE { Verilated::threadContextp()->time(val); } static void time(uint64_t val) VL_MT_SAFE { Verilated::threadContextp()->time(val); }
/// Return VerilatedContext::time using current thread's VerilatedContext /// Return VerilatedContext::time using current thread's VerilatedContext
static vluint64_t time() VL_MT_SAFE { return Verilated::threadContextp()->time(); } static uint64_t time() VL_MT_SAFE { return Verilated::threadContextp()->time(); }
/// Call VerilatedContext::timeInc using current thread's VerilatedContext /// Call VerilatedContext::timeInc using current thread's VerilatedContext
static void timeInc(vluint64_t add) VL_MT_UNSAFE { Verilated::threadContextp()->timeInc(add); } static void timeInc(uint64_t add) VL_MT_UNSAFE { Verilated::threadContextp()->timeInc(add); }
// Deprecated // Deprecated
static int timeunit() VL_MT_SAFE { return Verilated::threadContextp()->timeunit(); } static int timeunit() VL_MT_SAFE { return Verilated::threadContextp()->timeunit(); }
static int timeprecision() VL_MT_SAFE { return Verilated::threadContextp()->timeprecision(); } static int timeprecision() VL_MT_SAFE { return Verilated::threadContextp()->timeprecision(); }
@ -850,8 +850,8 @@ public:
#ifdef VL_THREADED #ifdef VL_THREADED
// Internal: Set the mtaskId, called when an mtask starts // Internal: Set the mtaskId, called when an mtask starts
// Per thread, so no need to be in VerilatedContext // Per thread, so no need to be in VerilatedContext
static void mtaskId(vluint32_t id) VL_MT_SAFE { t_s.t_mtaskId = id; } static void mtaskId(uint32_t id) VL_MT_SAFE { t_s.t_mtaskId = id; }
static vluint32_t mtaskId() VL_MT_SAFE { return t_s.t_mtaskId; } static uint32_t mtaskId() VL_MT_SAFE { return t_s.t_mtaskId; }
static void endOfEvalReqdInc() VL_MT_SAFE { ++t_s.t_endOfEvalReqd; } static void endOfEvalReqdInc() VL_MT_SAFE { ++t_s.t_endOfEvalReqd; }
static void endOfEvalReqdDec() VL_MT_SAFE { --t_s.t_endOfEvalReqd; } static void endOfEvalReqdDec() VL_MT_SAFE { --t_s.t_endOfEvalReqd; }

View File

@ -59,7 +59,7 @@ public: // But only local to this file
} }
} }
virtual ~VerilatedCovImpItem() = default; virtual ~VerilatedCovImpItem() = default;
virtual vluint64_t count() const = 0; virtual uint64_t count() const = 0;
virtual void zero() const = 0; virtual void zero() const = 0;
}; };
@ -76,7 +76,7 @@ private:
public: public:
// METHODS // METHODS
// cppcheck-suppress truncLongCastReturn // cppcheck-suppress truncLongCastReturn
virtual vluint64_t count() const override { return *m_countp; } virtual uint64_t count() const override { return *m_countp; }
virtual void zero() const override { *m_countp = 0; } virtual void zero() const override { *m_countp = 0; }
// CONSTRUCTORS // CONSTRUCTORS
// cppcheck-suppress noExplicitConstructor // cppcheck-suppress noExplicitConstructor
@ -372,7 +372,7 @@ public:
os << "# SystemC::Coverage-3\n"; os << "# SystemC::Coverage-3\n";
// Build list of events; totalize if collapsing hierarchy // Build list of events; totalize if collapsing hierarchy
std::map<const std::string, std::pair<std::string, vluint64_t>> eventCounts; std::map<const std::string, std::pair<std::string, uint64_t>> eventCounts;
for (const auto& itemp : m_items) { for (const auto& itemp : m_items) {
std::string name; std::string name;
std::string hier; std::string hier;
@ -439,11 +439,11 @@ void VerilatedCovContext::clearNonMatch(const char* matchp) VL_MT_SAFE {
} }
void VerilatedCovContext::zero() VL_MT_SAFE { impp()->zero(); } void VerilatedCovContext::zero() VL_MT_SAFE { impp()->zero(); }
void VerilatedCovContext::write(const char* filenamep) VL_MT_SAFE { impp()->write(filenamep); } void VerilatedCovContext::write(const char* filenamep) VL_MT_SAFE { impp()->write(filenamep); }
void VerilatedCovContext::_inserti(vluint32_t* itemp) VL_MT_SAFE { void VerilatedCovContext::_inserti(uint32_t* itemp) VL_MT_SAFE {
impp()->inserti(new VerilatedCoverItemSpec<vluint32_t>{itemp}); impp()->inserti(new VerilatedCoverItemSpec<uint32_t>{itemp});
} }
void VerilatedCovContext::_inserti(vluint64_t* itemp) VL_MT_SAFE { void VerilatedCovContext::_inserti(uint64_t* itemp) VL_MT_SAFE {
impp()->inserti(new VerilatedCoverItemSpec<vluint64_t>{itemp}); impp()->inserti(new VerilatedCoverItemSpec<uint64_t>{itemp});
} }
void VerilatedCovContext::_insertf(const char* filename, int lineno) VL_MT_SAFE { void VerilatedCovContext::_insertf(const char* filename, int lineno) VL_MT_SAFE {
impp()->insertf(filename, lineno); impp()->insertf(filename, lineno);

View File

@ -72,7 +72,7 @@ class VerilatedCovImp;
/// ///
/// Example: /// Example:
/// ///
/// vluint32_t m_cases[10]; // Storage for coverage data /// uint32_t m_cases[10]; // Storage for coverage data
/// constructor() { /// constructor() {
/// // Initialize /// // Initialize
/// for (int i = 0; i < 10; ++i) m_cases[i] = 0; /// for (int i = 0; i < 10; ++i) m_cases[i] = 0;
@ -126,8 +126,8 @@ public: // But Internal use only
// Call _insert1, followed by _insert2 and _insert3 // Call _insert1, followed by _insert2 and _insert3
// Do not call directly; use VL_COVER_INSERT or higher level macros instead // Do not call directly; use VL_COVER_INSERT or higher level macros instead
// _insert1: Remember item pointer with count. (Not const, as may add zeroing function) // _insert1: Remember item pointer with count. (Not const, as may add zeroing function)
void _inserti(vluint32_t* itemp) VL_MT_SAFE; void _inserti(uint32_t* itemp) VL_MT_SAFE;
void _inserti(vluint64_t* itemp) VL_MT_SAFE; void _inserti(uint64_t* itemp) VL_MT_SAFE;
// _insert2: Set default filename and line number // _insert2: Set default filename and line number
void _insertf(const char* filename, int lineno) VL_MT_SAFE; void _insertf(const char* filename, int lineno) VL_MT_SAFE;
// _insert3: Set parameters // _insert3: Set parameters

View File

@ -144,12 +144,12 @@ void VerilatedFst::flush() VL_MT_SAFE_EXCLUDES(m_mutex) {
fstWriterFlushContext(m_fst); fstWriterFlushContext(m_fst);
} }
void VerilatedFst::emitTimeChange(vluint64_t timeui) { fstWriterEmitTimeChange(m_fst, timeui); } void VerilatedFst::emitTimeChange(uint64_t timeui) { fstWriterEmitTimeChange(m_fst, timeui); }
//============================================================================= //=============================================================================
// Decl // Decl
void VerilatedFst::declDTypeEnum(int dtypenum, const char* name, vluint32_t elements, void VerilatedFst::declDTypeEnum(int dtypenum, const char* name, uint32_t elements,
unsigned int minValbits, const char** itemNamesp, unsigned int minValbits, const char** itemNamesp,
const char** itemValuesp) { const char** itemValuesp) {
const fstEnumHandle enumNum const fstEnumHandle enumNum
@ -157,7 +157,7 @@ void VerilatedFst::declDTypeEnum(int dtypenum, const char* name, vluint32_t elem
m_local2fstdtype[dtypenum] = enumNum; m_local2fstdtype[dtypenum] = enumNum;
} }
void VerilatedFst::declare(vluint32_t code, const char* name, int dtypenum, fstVarDir vardir, void VerilatedFst::declare(uint32_t code, const char* name, int dtypenum, fstVarDir vardir,
fstVarType vartype, bool array, int arraynum, bool bussed, int msb, fstVarType vartype, bool array, int arraynum, bool bussed, int msb,
int lsb) { int lsb) {
const int bits = ((msb > lsb) ? (msb - lsb) : (lsb - msb)) + 1; const int bits = ((msb > lsb) ? (msb - lsb) : (lsb - msb)) + 1;
@ -224,23 +224,23 @@ void VerilatedFst::declare(vluint32_t code, const char* name, int dtypenum, fstV
} }
} }
void VerilatedFst::declBit(vluint32_t code, const char* name, int dtypenum, fstVarDir vardir, void VerilatedFst::declBit(uint32_t code, const char* name, int dtypenum, fstVarDir vardir,
fstVarType vartype, bool array, int arraynum) { fstVarType vartype, bool array, int arraynum) {
declare(code, name, dtypenum, vardir, vartype, array, arraynum, false, 0, 0); declare(code, name, dtypenum, vardir, vartype, array, arraynum, false, 0, 0);
} }
void VerilatedFst::declBus(vluint32_t code, const char* name, int dtypenum, fstVarDir vardir, void VerilatedFst::declBus(uint32_t code, const char* name, int dtypenum, fstVarDir vardir,
fstVarType vartype, bool array, int arraynum, int msb, int lsb) { fstVarType vartype, bool array, int arraynum, int msb, int lsb) {
declare(code, name, dtypenum, vardir, vartype, array, arraynum, true, msb, lsb); declare(code, name, dtypenum, vardir, vartype, array, arraynum, true, msb, lsb);
} }
void VerilatedFst::declQuad(vluint32_t code, const char* name, int dtypenum, fstVarDir vardir, void VerilatedFst::declQuad(uint32_t code, const char* name, int dtypenum, fstVarDir vardir,
fstVarType vartype, bool array, int arraynum, int msb, int lsb) { fstVarType vartype, bool array, int arraynum, int msb, int lsb) {
declare(code, name, dtypenum, vardir, vartype, array, arraynum, true, msb, lsb); declare(code, name, dtypenum, vardir, vartype, array, arraynum, true, msb, lsb);
} }
void VerilatedFst::declArray(vluint32_t code, const char* name, int dtypenum, fstVarDir vardir, void VerilatedFst::declArray(uint32_t code, const char* name, int dtypenum, fstVarDir vardir,
fstVarType vartype, bool array, int arraynum, int msb, int lsb) { fstVarType vartype, bool array, int arraynum, int msb, int lsb) {
declare(code, name, dtypenum, vardir, vartype, array, arraynum, true, msb, lsb); declare(code, name, dtypenum, vardir, vartype, array, arraynum, true, msb, lsb);
} }
void VerilatedFst::declDouble(vluint32_t code, const char* name, int dtypenum, fstVarDir vardir, void VerilatedFst::declDouble(uint32_t code, const char* name, int dtypenum, fstVarDir vardir,
fstVarType vartype, bool array, int arraynum) { fstVarType vartype, bool array, int arraynum) {
declare(code, name, dtypenum, vardir, vartype, array, arraynum, false, 63, 0); declare(code, name, dtypenum, vardir, vartype, array, arraynum, false, 63, 0);
} }
@ -250,13 +250,13 @@ void VerilatedFst::declDouble(vluint32_t code, const char* name, int dtypenum, f
// so always inline them. // so always inline them.
VL_ATTR_ALWINLINE VL_ATTR_ALWINLINE
void VerilatedFst::emitBit(vluint32_t code, CData newval) { void VerilatedFst::emitBit(uint32_t code, CData newval) {
VL_DEBUG_IFDEF(assert(m_symbolp[code]);); VL_DEBUG_IFDEF(assert(m_symbolp[code]););
fstWriterEmitValueChange(m_fst, m_symbolp[code], newval ? "1" : "0"); fstWriterEmitValueChange(m_fst, m_symbolp[code], newval ? "1" : "0");
} }
VL_ATTR_ALWINLINE VL_ATTR_ALWINLINE
void VerilatedFst::emitCData(vluint32_t code, CData newval, int bits) { void VerilatedFst::emitCData(uint32_t code, CData newval, int bits) {
char buf[VL_BYTESIZE]; char buf[VL_BYTESIZE];
VL_DEBUG_IFDEF(assert(m_symbolp[code]);); VL_DEBUG_IFDEF(assert(m_symbolp[code]););
cvtCDataToStr(buf, newval << (VL_BYTESIZE - bits)); cvtCDataToStr(buf, newval << (VL_BYTESIZE - bits));
@ -264,7 +264,7 @@ void VerilatedFst::emitCData(vluint32_t code, CData newval, int bits) {
} }
VL_ATTR_ALWINLINE VL_ATTR_ALWINLINE
void VerilatedFst::emitSData(vluint32_t code, SData newval, int bits) { void VerilatedFst::emitSData(uint32_t code, SData newval, int bits) {
char buf[VL_SHORTSIZE]; char buf[VL_SHORTSIZE];
VL_DEBUG_IFDEF(assert(m_symbolp[code]);); VL_DEBUG_IFDEF(assert(m_symbolp[code]););
cvtSDataToStr(buf, newval << (VL_SHORTSIZE - bits)); cvtSDataToStr(buf, newval << (VL_SHORTSIZE - bits));
@ -272,7 +272,7 @@ void VerilatedFst::emitSData(vluint32_t code, SData newval, int bits) {
} }
VL_ATTR_ALWINLINE VL_ATTR_ALWINLINE
void VerilatedFst::emitIData(vluint32_t code, IData newval, int bits) { void VerilatedFst::emitIData(uint32_t code, IData newval, int bits) {
char buf[VL_IDATASIZE]; char buf[VL_IDATASIZE];
VL_DEBUG_IFDEF(assert(m_symbolp[code]);); VL_DEBUG_IFDEF(assert(m_symbolp[code]););
cvtIDataToStr(buf, newval << (VL_IDATASIZE - bits)); cvtIDataToStr(buf, newval << (VL_IDATASIZE - bits));
@ -280,7 +280,7 @@ void VerilatedFst::emitIData(vluint32_t code, IData newval, int bits) {
} }
VL_ATTR_ALWINLINE VL_ATTR_ALWINLINE
void VerilatedFst::emitQData(vluint32_t code, QData newval, int bits) { void VerilatedFst::emitQData(uint32_t code, QData newval, int bits) {
char buf[VL_QUADSIZE]; char buf[VL_QUADSIZE];
VL_DEBUG_IFDEF(assert(m_symbolp[code]);); VL_DEBUG_IFDEF(assert(m_symbolp[code]););
cvtQDataToStr(buf, newval << (VL_QUADSIZE - bits)); cvtQDataToStr(buf, newval << (VL_QUADSIZE - bits));
@ -288,7 +288,7 @@ void VerilatedFst::emitQData(vluint32_t code, QData newval, int bits) {
} }
VL_ATTR_ALWINLINE VL_ATTR_ALWINLINE
void VerilatedFst::emitWData(vluint32_t code, const WData* newvalp, int bits) { void VerilatedFst::emitWData(uint32_t code, const WData* newvalp, int bits) {
int words = VL_WORDS_I(bits); int words = VL_WORDS_I(bits);
char* wp = m_strbuf; char* wp = m_strbuf;
// Convert the most significant word // Convert the most significant word
@ -304,6 +304,6 @@ void VerilatedFst::emitWData(vluint32_t code, const WData* newvalp, int bits) {
} }
VL_ATTR_ALWINLINE VL_ATTR_ALWINLINE
void VerilatedFst::emitDouble(vluint32_t code, double newval) { void VerilatedFst::emitDouble(uint32_t code, double newval) {
fstWriterEmitValueChange(m_fst, m_symbolp[code], &newval); fstWriterEmitValueChange(m_fst, m_symbolp[code], &newval);
} }

View File

@ -45,7 +45,7 @@ private:
// FST specific internals // FST specific internals
void* m_fst; void* m_fst;
std::map<vluint32_t, fstHandle> m_code2symbol; std::map<uint32_t, fstHandle> m_code2symbol;
std::map<int, fstEnumHandle> m_local2fstdtype; std::map<int, fstEnumHandle> m_local2fstdtype;
std::list<std::string> m_curScope; std::list<std::string> m_curScope;
fstHandle* m_symbolp = nullptr; // same as m_code2symbol, but as an array fstHandle* m_symbolp = nullptr; // same as m_code2symbol, but as an array
@ -53,7 +53,7 @@ private:
// CONSTRUCTORS // CONSTRUCTORS
VL_UNCOPYABLE(VerilatedFst); VL_UNCOPYABLE(VerilatedFst);
void declare(vluint32_t code, const char* name, int dtypenum, fstVarDir vardir, void declare(uint32_t code, const char* name, int dtypenum, fstVarDir vardir,
fstVarType vartype, bool array, int arraynum, bool bussed, int msb, int lsb); fstVarType vartype, bool array, int arraynum, bool bussed, int msb, int lsb);
protected: protected:
@ -61,7 +61,7 @@ protected:
// Implementation of VerilatedTrace interface // Implementation of VerilatedTrace interface
// Implementations of protected virtual methods for VerilatedTrace // Implementations of protected virtual methods for VerilatedTrace
virtual void emitTimeChange(vluint64_t timeui) override; virtual void emitTimeChange(uint64_t timeui) override;
// Hooks called from VerilatedTrace // Hooks called from VerilatedTrace
virtual bool preFullDump() override { return isOpen(); } virtual bool preFullDump() override { return isOpen(); }
@ -69,13 +69,13 @@ protected:
// Implementations of duck-typed methods for VerilatedTrace. These are // Implementations of duck-typed methods for VerilatedTrace. These are
// called from only one place (namely full*) so always inline them. // called from only one place (namely full*) so always inline them.
inline void emitBit(vluint32_t code, CData newval); inline void emitBit(uint32_t code, CData newval);
inline void emitCData(vluint32_t code, CData newval, int bits); inline void emitCData(uint32_t code, CData newval, int bits);
inline void emitSData(vluint32_t code, SData newval, int bits); inline void emitSData(uint32_t code, SData newval, int bits);
inline void emitIData(vluint32_t code, IData newval, int bits); inline void emitIData(uint32_t code, IData newval, int bits);
inline void emitQData(vluint32_t code, QData newval, int bits); inline void emitQData(uint32_t code, QData newval, int bits);
inline void emitWData(vluint32_t code, const WData* newvalp, int bits); inline void emitWData(uint32_t code, const WData* newvalp, int bits);
inline void emitDouble(vluint32_t code, double newval); inline void emitDouble(uint32_t code, double newval);
public: public:
//========================================================================= //=========================================================================
@ -98,25 +98,25 @@ public:
// Internal interface to Verilator generated code // Internal interface to Verilator generated code
// Inside dumping routines, declare a data type // Inside dumping routines, declare a data type
void declDTypeEnum(int dtypenum, const char* name, vluint32_t elements, void declDTypeEnum(int dtypenum, const char* name, uint32_t elements, unsigned int minValbits,
unsigned int minValbits, const char** itemNamesp, const char** itemValuesp); const char** itemNamesp, const char** itemValuesp);
// Inside dumping routines, declare a signal // Inside dumping routines, declare a signal
void declBit(vluint32_t code, const char* name, int dtypenum, fstVarDir vardir, void declBit(uint32_t code, const char* name, int dtypenum, fstVarDir vardir,
fstVarType vartype, bool array, int arraynum); fstVarType vartype, bool array, int arraynum);
void declBus(vluint32_t code, const char* name, int dtypenum, fstVarDir vardir, void declBus(uint32_t code, const char* name, int dtypenum, fstVarDir vardir,
fstVarType vartype, bool array, int arraynum, int msb, int lsb); fstVarType vartype, bool array, int arraynum, int msb, int lsb);
void declQuad(vluint32_t code, const char* name, int dtypenum, fstVarDir vardir, void declQuad(uint32_t code, const char* name, int dtypenum, fstVarDir vardir,
fstVarType vartype, bool array, int arraynum, int msb, int lsb); fstVarType vartype, bool array, int arraynum, int msb, int lsb);
void declArray(vluint32_t code, const char* name, int dtypenum, fstVarDir vardir, void declArray(uint32_t code, const char* name, int dtypenum, fstVarDir vardir,
fstVarType vartype, bool array, int arraynum, int msb, int lsb); fstVarType vartype, bool array, int arraynum, int msb, int lsb);
void declDouble(vluint32_t code, const char* name, int dtypenum, fstVarDir vardir, void declDouble(uint32_t code, const char* name, int dtypenum, fstVarDir vardir,
fstVarType vartype, bool array, int arraynum); fstVarType vartype, bool array, int arraynum);
}; };
#ifndef DOXYGEN #ifndef DOXYGEN
// Declare specialization here as it's used in VerilatedFstC just below // Declare specialization here as it's used in VerilatedFstC just below
template <> void VerilatedTrace<VerilatedFst>::dump(vluint64_t timeui); template <> void VerilatedTrace<VerilatedFst>::dump(uint64_t timeui);
template <> void VerilatedTrace<VerilatedFst>::set_time_unit(const char* unitp); template <> void VerilatedTrace<VerilatedFst>::set_time_unit(const char* unitp);
template <> void VerilatedTrace<VerilatedFst>::set_time_unit(const std::string& unit); template <> void VerilatedTrace<VerilatedFst>::set_time_unit(const std::string& unit);
template <> void VerilatedTrace<VerilatedFst>::set_time_resolution(const char* unitp); template <> void VerilatedTrace<VerilatedFst>::set_time_resolution(const char* unitp);
@ -155,12 +155,12 @@ public:
/// Write one cycle of dump data /// Write one cycle of dump data
/// Call with the current context's time just after eval'ed, /// Call with the current context's time just after eval'ed,
/// e.g. ->dump(contextp->time()) /// e.g. ->dump(contextp->time())
void dump(vluint64_t timeui) { m_sptrace.dump(timeui); } void dump(uint64_t timeui) { m_sptrace.dump(timeui); }
/// Write one cycle of dump data - backward compatible and to reduce /// Write one cycle of dump data - backward compatible and to reduce
/// conversion warnings. It's better to use a vluint64_t time instead. /// conversion warnings. It's better to use a uint64_t time instead.
void dump(double timestamp) { dump(static_cast<vluint64_t>(timestamp)); } void dump(double timestamp) { dump(static_cast<uint64_t>(timestamp)); }
void dump(vluint32_t timestamp) { dump(static_cast<vluint64_t>(timestamp)); } void dump(uint32_t timestamp) { dump(static_cast<uint64_t>(timestamp)); }
void dump(int timestamp) { dump(static_cast<vluint64_t>(timestamp)); } void dump(int timestamp) { dump(static_cast<uint64_t>(timestamp)); }
// METHODS - Internal/backward compatible // METHODS - Internal/backward compatible
// \protectedsection // \protectedsection

View File

@ -90,7 +90,7 @@ extern WDataOutP VL_RANDOM_W(int obits, WDataOutP outwp);
extern IData VL_RANDOM_SEEDED_II(IData& seedr) VL_MT_SAFE; extern IData VL_RANDOM_SEEDED_II(IData& seedr) VL_MT_SAFE;
extern IData VL_URANDOM_SEEDED_II(IData seed) VL_MT_SAFE; extern IData VL_URANDOM_SEEDED_II(IData seed) VL_MT_SAFE;
inline IData VL_URANDOM_RANGE_I(IData hi, IData lo) { inline IData VL_URANDOM_RANGE_I(IData hi, IData lo) {
const vluint64_t rnd = vl_rand64(); const uint64_t rnd = vl_rand64();
if (VL_LIKELY(hi > lo)) { if (VL_LIKELY(hi > lo)) {
// (hi - lo + 1) can be zero when hi is UINT_MAX and lo is zero // (hi - lo + 1) can be zero when hi is UINT_MAX and lo is zero
if (VL_UNLIKELY(hi - lo + 1 == 0)) return rnd; if (VL_UNLIKELY(hi - lo + 1 == 0)) return rnd;
@ -210,29 +210,27 @@ static inline QData VL_CVT_Q_D(double lhs) VL_PURE {
// Return double from lhs (numeric) unsigned // Return double from lhs (numeric) unsigned
double VL_ITOR_D_W(int lbits, WDataInP const lwp) VL_PURE; double VL_ITOR_D_W(int lbits, WDataInP const lwp) VL_PURE;
static inline double VL_ITOR_D_I(int, IData lhs) VL_PURE { static inline double VL_ITOR_D_I(int, IData lhs) VL_PURE {
return static_cast<double>(static_cast<vluint32_t>(lhs)); return static_cast<double>(static_cast<uint32_t>(lhs));
} }
static inline double VL_ITOR_D_Q(int, QData lhs) VL_PURE { static inline double VL_ITOR_D_Q(int, QData lhs) VL_PURE {
return static_cast<double>(static_cast<vluint64_t>(lhs)); return static_cast<double>(static_cast<uint64_t>(lhs));
} }
// Return double from lhs (numeric) signed // Return double from lhs (numeric) signed
double VL_ISTOR_D_W(int lbits, WDataInP const lwp) VL_PURE; double VL_ISTOR_D_W(int lbits, WDataInP const lwp) VL_PURE;
static inline double VL_ISTOR_D_I(int lbits, IData lhs) VL_PURE { static inline double VL_ISTOR_D_I(int lbits, IData lhs) VL_PURE {
if (lbits == 32) return static_cast<double>(static_cast<vlsint32_t>(lhs)); if (lbits == 32) return static_cast<double>(static_cast<int32_t>(lhs));
VlWide<VL_WQ_WORDS_E> lwp; VlWide<VL_WQ_WORDS_E> lwp;
VL_SET_WI(lwp, lhs); VL_SET_WI(lwp, lhs);
return VL_ISTOR_D_W(lbits, lwp); return VL_ISTOR_D_W(lbits, lwp);
} }
static inline double VL_ISTOR_D_Q(int lbits, QData lhs) VL_PURE { static inline double VL_ISTOR_D_Q(int lbits, QData lhs) VL_PURE {
if (lbits == 64) return static_cast<double>(static_cast<vlsint64_t>(lhs)); if (lbits == 64) return static_cast<double>(static_cast<int64_t>(lhs));
VlWide<VL_WQ_WORDS_E> lwp; VlWide<VL_WQ_WORDS_E> lwp;
VL_SET_WQ(lwp, lhs); VL_SET_WQ(lwp, lhs);
return VL_ISTOR_D_W(lbits, lwp); return VL_ISTOR_D_W(lbits, lwp);
} }
// Return QData from double (numeric) // Return QData from double (numeric)
static inline IData VL_RTOI_I_D(double lhs) VL_PURE { static inline IData VL_RTOI_I_D(double lhs) VL_PURE { return static_cast<int32_t>(VL_TRUNC(lhs)); }
return static_cast<vlsint32_t>(VL_TRUNC(lhs));
}
// Sign extend such that if MSB set, we get ffff_ffff, else 0s // Sign extend such that if MSB set, we get ffff_ffff, else 0s
// (Requires clean input) // (Requires clean input)
@ -281,28 +279,28 @@ extern int VL_TIME_STR_CONVERT(const char* strp) VL_PURE;
#if defined(SYSTEMC_VERSION) #if defined(SYSTEMC_VERSION)
/// Return current simulation time /// Return current simulation time
// Already defined: extern sc_time sc_time_stamp(); // Already defined: extern sc_time sc_time_stamp();
inline vluint64_t vl_time_stamp64() { return sc_time_stamp().value(); } inline uint64_t vl_time_stamp64() { return sc_time_stamp().value(); }
#else // Non-SystemC #else // Non-SystemC
# if !defined(VL_TIME_CONTEXT) && !defined(VL_NO_LEGACY) # if !defined(VL_TIME_CONTEXT) && !defined(VL_NO_LEGACY)
# ifdef VL_TIME_STAMP64 # ifdef VL_TIME_STAMP64
// vl_time_stamp64() may be optionally defined by the user to return time. // vl_time_stamp64() may be optionally defined by the user to return time.
// On MSVC++ weak symbols are not supported so must be declared, or define // On MSVC++ weak symbols are not supported so must be declared, or define
// VL_TIME_CONTEXT. // VL_TIME_CONTEXT.
extern vluint64_t vl_time_stamp64() VL_ATTR_WEAK; extern uint64_t vl_time_stamp64() VL_ATTR_WEAK;
# else # else
// sc_time_stamp() may be optionally defined by the user to return time. // sc_time_stamp() may be optionally defined by the user to return time.
// On MSVC++ weak symbols are not supported so must be declared, or define // On MSVC++ weak symbols are not supported so must be declared, or define
// VL_TIME_CONTEXT. // VL_TIME_CONTEXT.
extern double sc_time_stamp() VL_ATTR_WEAK; // Verilator 4.032 and newer extern double sc_time_stamp() VL_ATTR_WEAK; // Verilator 4.032 and newer
inline vluint64_t vl_time_stamp64() { inline uint64_t vl_time_stamp64() {
// clang9.0.1 requires & although we really do want the weak symbol value // clang9.0.1 requires & although we really do want the weak symbol value
return VL_LIKELY(&sc_time_stamp) ? static_cast<vluint64_t>(sc_time_stamp()) : 0; return VL_LIKELY(&sc_time_stamp) ? static_cast<uint64_t>(sc_time_stamp()) : 0;
} }
# endif # endif
# endif # endif
#endif #endif
inline vluint64_t VerilatedContext::time() const VL_MT_SAFE { inline uint64_t VerilatedContext::time() const VL_MT_SAFE {
// When using non-default context, fastest path is return time // When using non-default context, fastest path is return time
if (VL_LIKELY(m_s.m_time)) return m_s.m_time; if (VL_LIKELY(m_s.m_time)) return m_s.m_time;
#if defined(SYSTEMC_VERSION) || (!defined(VL_TIME_CONTEXT) && !defined(VL_NO_LEGACY)) #if defined(SYSTEMC_VERSION) || (!defined(VL_TIME_CONTEXT) && !defined(VL_NO_LEGACY))
@ -327,7 +325,7 @@ inline vluint64_t VerilatedContext::time() const VL_MT_SAFE {
// Return time precision as multiplier of time units // Return time precision as multiplier of time units
double vl_time_multiplier(int scale) VL_PURE; double vl_time_multiplier(int scale) VL_PURE;
// Return power of 10. e.g. returns 100 if n==2 // Return power of 10. e.g. returns 100 if n==2
vluint64_t vl_time_pow10(int n) VL_PURE; uint64_t vl_time_pow10(int n) VL_PURE;
#ifdef VL_DEBUG #ifdef VL_DEBUG
/// Evaluate statement if VL_DEBUG defined /// Evaluate statement if VL_DEBUG defined
@ -873,46 +871,46 @@ static inline int _vl_cmp_w(int words, WDataInP const lwp, WDataInP const rwp) V
static inline IData VL_GTS_III(int lbits, IData lhs, IData rhs) VL_PURE { static inline IData VL_GTS_III(int lbits, IData lhs, IData rhs) VL_PURE {
// For lbits==32, this becomes just a single instruction, otherwise ~5. // For lbits==32, this becomes just a single instruction, otherwise ~5.
// GCC 3.3.4 sign extension bugs on AMD64 architecture force us to use quad logic // GCC 3.3.4 sign extension bugs on AMD64 architecture force us to use quad logic
const vlsint64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); // Q for gcc const int64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); // Q for gcc
const vlsint64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); // Q for gcc const int64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); // Q for gcc
return lhs_signed > rhs_signed; return lhs_signed > rhs_signed;
} }
static inline IData VL_GTS_IQQ(int lbits, QData lhs, QData rhs) VL_PURE { static inline IData VL_GTS_IQQ(int lbits, QData lhs, QData rhs) VL_PURE {
const vlsint64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); const int64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs);
const vlsint64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); const int64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs);
return lhs_signed > rhs_signed; return lhs_signed > rhs_signed;
} }
static inline IData VL_GTES_III(int lbits, IData lhs, IData rhs) VL_PURE { static inline IData VL_GTES_III(int lbits, IData lhs, IData rhs) VL_PURE {
const vlsint64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); // Q for gcc const int64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); // Q for gcc
const vlsint64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); // Q for gcc const int64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); // Q for gcc
return lhs_signed >= rhs_signed; return lhs_signed >= rhs_signed;
} }
static inline IData VL_GTES_IQQ(int lbits, QData lhs, QData rhs) VL_PURE { static inline IData VL_GTES_IQQ(int lbits, QData lhs, QData rhs) VL_PURE {
const vlsint64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); const int64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs);
const vlsint64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); const int64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs);
return lhs_signed >= rhs_signed; return lhs_signed >= rhs_signed;
} }
static inline IData VL_LTS_III(int lbits, IData lhs, IData rhs) VL_PURE { static inline IData VL_LTS_III(int lbits, IData lhs, IData rhs) VL_PURE {
const vlsint64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); // Q for gcc const int64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); // Q for gcc
const vlsint64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); // Q for gcc const int64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); // Q for gcc
return lhs_signed < rhs_signed; return lhs_signed < rhs_signed;
} }
static inline IData VL_LTS_IQQ(int lbits, QData lhs, QData rhs) VL_PURE { static inline IData VL_LTS_IQQ(int lbits, QData lhs, QData rhs) VL_PURE {
const vlsint64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); const int64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs);
const vlsint64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); const int64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs);
return lhs_signed < rhs_signed; return lhs_signed < rhs_signed;
} }
static inline IData VL_LTES_III(int lbits, IData lhs, IData rhs) VL_PURE { static inline IData VL_LTES_III(int lbits, IData lhs, IData rhs) VL_PURE {
const vlsint64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); // Q for gcc const int64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); // Q for gcc
const vlsint64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); // Q for gcc const int64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); // Q for gcc
return lhs_signed <= rhs_signed; return lhs_signed <= rhs_signed;
} }
static inline IData VL_LTES_IQQ(int lbits, QData lhs, QData rhs) VL_PURE { static inline IData VL_LTES_IQQ(int lbits, QData lhs, QData rhs) VL_PURE {
const vlsint64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); const int64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs);
const vlsint64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); const int64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs);
return lhs_signed <= rhs_signed; return lhs_signed <= rhs_signed;
} }
@ -1006,13 +1004,13 @@ static inline WDataOutP VL_MUL_W(int words, WDataOutP owp, WDataInP const lwp,
} }
static inline IData VL_MULS_III(int lbits, IData lhs, IData rhs) VL_PURE { static inline IData VL_MULS_III(int lbits, IData lhs, IData rhs) VL_PURE {
const vlsint32_t lhs_signed = VL_EXTENDS_II(32, lbits, lhs); const int32_t lhs_signed = VL_EXTENDS_II(32, lbits, lhs);
const vlsint32_t rhs_signed = VL_EXTENDS_II(32, lbits, rhs); const int32_t rhs_signed = VL_EXTENDS_II(32, lbits, rhs);
return lhs_signed * rhs_signed; return lhs_signed * rhs_signed;
} }
static inline QData VL_MULS_QQQ(int lbits, QData lhs, QData rhs) VL_PURE { static inline QData VL_MULS_QQQ(int lbits, QData lhs, QData rhs) VL_PURE {
const vlsint64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); const int64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs);
const vlsint64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); const int64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs);
return lhs_signed * rhs_signed; return lhs_signed * rhs_signed;
} }
@ -1058,30 +1056,30 @@ static inline IData VL_DIVS_III(int lbits, IData lhs, IData rhs) VL_PURE {
if (VL_UNLIKELY(rhs == 0)) return 0; if (VL_UNLIKELY(rhs == 0)) return 0;
// -MAX / -1 cannot be represented in twos complement, and will cause SIGFPE // -MAX / -1 cannot be represented in twos complement, and will cause SIGFPE
if (VL_UNLIKELY(lhs == 0x80000000 && rhs == 0xffffffff)) return 0; if (VL_UNLIKELY(lhs == 0x80000000 && rhs == 0xffffffff)) return 0;
const vlsint32_t lhs_signed = VL_EXTENDS_II(VL_IDATASIZE, lbits, lhs); const int32_t lhs_signed = VL_EXTENDS_II(VL_IDATASIZE, lbits, lhs);
const vlsint32_t rhs_signed = VL_EXTENDS_II(VL_IDATASIZE, lbits, rhs); const int32_t rhs_signed = VL_EXTENDS_II(VL_IDATASIZE, lbits, rhs);
return lhs_signed / rhs_signed; return lhs_signed / rhs_signed;
} }
static inline QData VL_DIVS_QQQ(int lbits, QData lhs, QData rhs) VL_PURE { static inline QData VL_DIVS_QQQ(int lbits, QData lhs, QData rhs) VL_PURE {
if (VL_UNLIKELY(rhs == 0)) return 0; if (VL_UNLIKELY(rhs == 0)) return 0;
// -MAX / -1 cannot be represented in twos complement, and will cause SIGFPE // -MAX / -1 cannot be represented in twos complement, and will cause SIGFPE
if (VL_UNLIKELY(lhs == 0x8000000000000000ULL && rhs == 0xffffffffffffffffULL)) return 0; if (VL_UNLIKELY(lhs == 0x8000000000000000ULL && rhs == 0xffffffffffffffffULL)) return 0;
const vlsint64_t lhs_signed = VL_EXTENDS_QQ(VL_QUADSIZE, lbits, lhs); const int64_t lhs_signed = VL_EXTENDS_QQ(VL_QUADSIZE, lbits, lhs);
const vlsint64_t rhs_signed = VL_EXTENDS_QQ(VL_QUADSIZE, lbits, rhs); const int64_t rhs_signed = VL_EXTENDS_QQ(VL_QUADSIZE, lbits, rhs);
return lhs_signed / rhs_signed; return lhs_signed / rhs_signed;
} }
static inline IData VL_MODDIVS_III(int lbits, IData lhs, IData rhs) VL_PURE { static inline IData VL_MODDIVS_III(int lbits, IData lhs, IData rhs) VL_PURE {
if (VL_UNLIKELY(rhs == 0)) return 0; if (VL_UNLIKELY(rhs == 0)) return 0;
if (VL_UNLIKELY(lhs == 0x80000000 && rhs == 0xffffffff)) return 0; if (VL_UNLIKELY(lhs == 0x80000000 && rhs == 0xffffffff)) return 0;
const vlsint32_t lhs_signed = VL_EXTENDS_II(VL_IDATASIZE, lbits, lhs); const int32_t lhs_signed = VL_EXTENDS_II(VL_IDATASIZE, lbits, lhs);
const vlsint32_t rhs_signed = VL_EXTENDS_II(VL_IDATASIZE, lbits, rhs); const int32_t rhs_signed = VL_EXTENDS_II(VL_IDATASIZE, lbits, rhs);
return lhs_signed % rhs_signed; return lhs_signed % rhs_signed;
} }
static inline QData VL_MODDIVS_QQQ(int lbits, QData lhs, QData rhs) VL_PURE { static inline QData VL_MODDIVS_QQQ(int lbits, QData lhs, QData rhs) VL_PURE {
if (VL_UNLIKELY(rhs == 0)) return 0; if (VL_UNLIKELY(rhs == 0)) return 0;
if (VL_UNLIKELY(lhs == 0x8000000000000000ULL && rhs == 0xffffffffffffffffULL)) return 0; if (VL_UNLIKELY(lhs == 0x8000000000000000ULL && rhs == 0xffffffffffffffffULL)) return 0;
const vlsint64_t lhs_signed = VL_EXTENDS_QQ(VL_QUADSIZE, lbits, lhs); const int64_t lhs_signed = VL_EXTENDS_QQ(VL_QUADSIZE, lbits, lhs);
const vlsint64_t rhs_signed = VL_EXTENDS_QQ(VL_QUADSIZE, lbits, rhs); const int64_t rhs_signed = VL_EXTENDS_QQ(VL_QUADSIZE, lbits, rhs);
return lhs_signed % rhs_signed; return lhs_signed % rhs_signed;
} }
@ -1412,8 +1410,8 @@ static inline IData VL_STREAML_FAST_III(int lbits, IData ld, IData rd_log2) VL_P
// ret = 10324--- // ret = 10324---
IData ret = ld; IData ret = ld;
if (rd_log2) { if (rd_log2) {
const vluint32_t lbitsFloor = lbits & ~VL_MASK_I(rd_log2); // max multiple of rd <= lbits const uint32_t lbitsFloor = lbits & ~VL_MASK_I(rd_log2); // max multiple of rd <= lbits
const vluint32_t lbitsRem = lbits - lbitsFloor; // number of bits in most-sig slice (MSS) const uint32_t lbitsRem = lbits - lbitsFloor; // number of bits in most-sig slice (MSS)
const IData msbMask = VL_MASK_I(lbitsRem) << lbitsFloor; // mask to sel only bits in MSS const IData msbMask = VL_MASK_I(lbitsRem) << lbitsFloor; // mask to sel only bits in MSS
ret = (ret & ~msbMask) | ((ret & msbMask) << ((VL_UL(1) << rd_log2) - lbitsRem)); ret = (ret & ~msbMask) | ((ret & msbMask) << ((VL_UL(1) << rd_log2) - lbitsRem));
} }
@ -1432,8 +1430,8 @@ static inline QData VL_STREAML_FAST_QQI(int lbits, QData ld, IData rd_log2) VL_P
// Pre-shift bits in most-significant slice (see comment in VL_STREAML_FAST_III) // Pre-shift bits in most-significant slice (see comment in VL_STREAML_FAST_III)
QData ret = ld; QData ret = ld;
if (rd_log2) { if (rd_log2) {
const vluint32_t lbitsFloor = lbits & ~VL_MASK_I(rd_log2); const uint32_t lbitsFloor = lbits & ~VL_MASK_I(rd_log2);
const vluint32_t lbitsRem = lbits - lbitsFloor; const uint32_t lbitsRem = lbits - lbitsFloor;
const QData msbMask = lbitsFloor == 64 ? 0ULL : VL_MASK_Q(lbitsRem) << lbitsFloor; const QData msbMask = lbitsFloor == 64 ? 0ULL : VL_MASK_Q(lbitsRem) << lbitsFloor;
ret = (ret & ~msbMask) | ((ret & msbMask) << ((1ULL << rd_log2) - lbitsRem)); ret = (ret & ~msbMask) | ((ret & msbMask) << ((1ULL << rd_log2) - lbitsRem));
} }
@ -1931,8 +1929,8 @@ static inline QData VL_RTOIROUND_Q_D(double lhs) VL_PURE {
if (lhs == 0.0) return 0; if (lhs == 0.0) return 0;
const QData q = VL_CVT_Q_D(lhs); const QData q = VL_CVT_Q_D(lhs);
const int lsb = static_cast<int>((q >> 52ULL) & VL_MASK_Q(11)) - 1023 - 52; const int lsb = static_cast<int>((q >> 52ULL) & VL_MASK_Q(11)) - 1023 - 52;
const vluint64_t mantissa = (q & VL_MASK_Q(52)) | (1ULL << 52); const uint64_t mantissa = (q & VL_MASK_Q(52)) | (1ULL << 52);
vluint64_t out = 0; uint64_t out = 0;
if (lsb < 0) { if (lsb < 0) {
out = mantissa >> -lsb; out = mantissa >> -lsb;
} else if (lsb < 64) { } else if (lsb < 64) {
@ -1952,7 +1950,7 @@ static inline WDataOutP VL_RTOIROUND_W_D(int obits, WDataOutP owp, double lhs) V
if (lhs == 0.0) return owp; if (lhs == 0.0) return owp;
const QData q = VL_CVT_Q_D(lhs); const QData q = VL_CVT_Q_D(lhs);
const int lsb = static_cast<int>((q >> 52ULL) & VL_MASK_Q(11)) - 1023 - 52; const int lsb = static_cast<int>((q >> 52ULL) & VL_MASK_Q(11)) - 1023 - 52;
const vluint64_t mantissa = (q & VL_MASK_Q(52)) | (1ULL << 52); const uint64_t mantissa = (q & VL_MASK_Q(52)) | (1ULL << 52);
if (lsb < 0) { if (lsb < 0) {
VL_SET_WQ(owp, mantissa >> -lsb); VL_SET_WQ(owp, mantissa >> -lsb);
} else if (lsb < obits) { } else if (lsb < obits) {

View File

@ -65,7 +65,7 @@ public:
private: private:
// MEMBERS // MEMBERS
vluint32_t m_mtaskId; // MTask that did enqueue uint32_t m_mtaskId; // MTask that did enqueue
std::function<void()> m_cb; // Lambda to execute when message received std::function<void()> m_cb; // Lambda to execute when message received
public: public:
// CONSTRUCTORS // CONSTRUCTORS
@ -78,7 +78,7 @@ public:
VerilatedMsg& operator=(const VerilatedMsg&) = default; VerilatedMsg& operator=(const VerilatedMsg&) = default;
VerilatedMsg& operator=(VerilatedMsg&&) = default; VerilatedMsg& operator=(VerilatedMsg&&) = default;
// METHODS // METHODS
vluint32_t mtaskId() const { return m_mtaskId; } uint32_t mtaskId() const { return m_mtaskId; }
// Execute the lambda function // Execute the lambda function
void run() const { m_cb(); } void run() const { m_cb(); }
}; };
@ -89,7 +89,7 @@ public:
class VerilatedEvalMsgQueue final { class VerilatedEvalMsgQueue final {
using VerilatedThreadQueue = std::multiset<VerilatedMsg, VerilatedMsg::Cmp>; using VerilatedThreadQueue = std::multiset<VerilatedMsg, VerilatedMsg::Cmp>;
std::atomic<vluint64_t> m_depth; // Current depth of queue (see comments below) std::atomic<uint64_t> m_depth; // Current depth of queue (see comments below)
VerilatedMutex m_mutex; // Mutex protecting queue VerilatedMutex m_mutex; // Mutex protecting queue
VerilatedThreadQueue m_queue VL_GUARDED_BY(m_mutex); // Message queue VerilatedThreadQueue m_queue VL_GUARDED_BY(m_mutex); // Message queue
@ -245,8 +245,8 @@ public: // But only for verilated*.cpp
// METHODS - extending into VerilatedContext, call via impp()-> // METHODS - extending into VerilatedContext, call via impp()->
// Random seed handling // Random seed handling
vluint64_t randSeedDefault64() const VL_MT_SAFE; uint64_t randSeedDefault64() const VL_MT_SAFE;
static vluint32_t randSeedEpoch() VL_MT_SAFE { return s().s_randSeedEpoch; } static uint32_t randSeedEpoch() VL_MT_SAFE { return s().s_randSeedEpoch; }
// METHODS - timeformat // METHODS - timeformat
int timeFormatUnits() const VL_MT_SAFE { int timeFormatUnits() const VL_MT_SAFE {

View File

@ -38,11 +38,11 @@ constexpr const char* const VlExecutionRecord::s_ascii[];
//============================================================================= //=============================================================================
// VlPgoProfiler implementation // VlPgoProfiler implementation
vluint16_t VlExecutionRecord::getcpu() { uint16_t VlExecutionRecord::getcpu() {
#if defined(__linux) #if defined(__linux)
return sched_getcpu(); // TODO: this is a system call. Not exactly cheap. return sched_getcpu(); // TODO: this is a system call. Not exactly cheap.
#elif defined(__APPLE__) && !defined(__arm64__) #elif defined(__APPLE__) && !defined(__arm64__)
vluint32_t info[4]; uint32_t info[4];
__cpuid_count(1, 0, info[0], info[1], info[2], info[3]); __cpuid_count(1, 0, info[0], info[1], info[2], info[3]);
// info[1] is EBX, bits 24-31 are APIC ID // info[1] is EBX, bits 24-31 are APIC ID
if ((info[3] & (1 << 9)) == 0) { if ((info[3] & (1 << 9)) == 0) {
@ -79,7 +79,7 @@ void VlExecutionProfiler::configure(const VerilatedContext& context) {
clear(); // Clear the profile after the cache warm-up cycles. clear(); // Clear the profile after the cache warm-up cycles.
m_tickBegin = VL_CPU_TICK(); m_tickBegin = VL_CPU_TICK();
} else if (VL_UNLIKELY(m_windowCount == 0)) { } else if (VL_UNLIKELY(m_windowCount == 0)) {
const vluint64_t tickEnd = VL_CPU_TICK(); const uint64_t tickEnd = VL_CPU_TICK();
VL_DEBUG_IF(VL_DBG_MSGF("+ profile end\n");); VL_DEBUG_IF(VL_DBG_MSGF("+ profile end\n"););
const std::string& fileName = context.profExecFilename(); const std::string& fileName = context.profExecFilename();
dump(fileName.c_str(), tickEnd); dump(fileName.c_str(), tickEnd);
@ -88,7 +88,7 @@ void VlExecutionProfiler::configure(const VerilatedContext& context) {
return; return;
} }
const vluint64_t startReq = context.profExecStart() + 1; // + 1, so we can start at time 0 const uint64_t startReq = context.profExecStart() + 1; // + 1, so we can start at time 0
if (VL_UNLIKELY(m_lastStartReq < startReq && VL_TIME_Q() >= context.profExecStart())) { if (VL_UNLIKELY(m_lastStartReq < startReq && VL_TIME_Q() >= context.profExecStart())) {
VL_DEBUG_IF(VL_DBG_MSGF("+ profile start warmup\n");); VL_DEBUG_IF(VL_DBG_MSGF("+ profile start warmup\n"););
@ -121,7 +121,7 @@ void VlExecutionProfiler::clear() VL_MT_SAFE_EXCLUDES(m_mutex) {
} }
} }
void VlExecutionProfiler::dump(const char* filenamep, vluint64_t tickEnd) void VlExecutionProfiler::dump(const char* filenamep, uint64_t tickEnd)
VL_MT_SAFE_EXCLUDES(m_mutex) { VL_MT_SAFE_EXCLUDES(m_mutex) {
const VerilatedLockGuard lock{m_mutex}; const VerilatedLockGuard lock{m_mutex};
VL_DEBUG_IF(VL_DBG_MSGF("+prof+exec writing to '%s'\n", filenamep);); VL_DEBUG_IF(VL_DBG_MSGF("+prof+exec writing to '%s'\n", filenamep););
@ -159,7 +159,7 @@ void VlExecutionProfiler::dump(const char* filenamep, vluint64_t tickEnd)
for (const VlExecutionRecord& er : *tracep) { for (const VlExecutionRecord& er : *tracep) {
const char* const name = VlExecutionRecord::s_ascii[static_cast<uint8_t>(er.m_type)]; const char* const name = VlExecutionRecord::s_ascii[static_cast<uint8_t>(er.m_type)];
const vluint64_t time = er.m_tick - m_tickBegin; const uint64_t time = er.m_tick - m_tickBegin;
fprintf(fp, "VLPROFEXEC %s %" PRIu64, name, time); fprintf(fp, "VLPROFEXEC %s %" PRIu64, name, time);
switch (er.m_type) { switch (er.m_type) {

View File

@ -50,7 +50,7 @@ class VlExecutionProfiler;
// Return high-precision counter for profiling, or 0x0 if not available // Return high-precision counter for profiling, or 0x0 if not available
VL_ATTR_ALWINLINE VL_ATTR_ALWINLINE
inline QData VL_CPU_TICK() { inline QData VL_CPU_TICK() {
vluint64_t val; uint64_t val;
VL_GET_CPU_TICK(val); VL_GET_CPU_TICK(val);
return val; return val;
} }
@ -88,25 +88,25 @@ class VlExecutionRecord final {
union Payload { union Payload {
struct { struct {
vluint32_t m_id; // MTask id uint32_t m_id; // MTask id
vluint32_t m_predictStart; // Time scheduler predicted would start uint32_t m_predictStart; // Time scheduler predicted would start
vluint32_t m_cpu; // Executing CPU id uint32_t m_cpu; // Executing CPU id
} mtaskBegin; } mtaskBegin;
struct { struct {
vluint32_t m_id; // MTask id uint32_t m_id; // MTask id
vluint32_t m_predictCost; // How long scheduler predicted would take uint32_t m_predictCost; // How long scheduler predicted would take
} mtaskEnd; } mtaskEnd;
}; };
// STATE // STATE
// Layout below allows efficient packing. // Layout below allows efficient packing.
const vluint64_t m_tick = VL_CPU_TICK(); // Tick at construction const uint64_t m_tick = VL_CPU_TICK(); // Tick at construction
Payload m_payload; // The record payload Payload m_payload; // The record payload
Type m_type; // The record type Type m_type; // The record type
static_assert(alignof(vluint64_t) >= alignof(Payload), "Padding not allowed"); static_assert(alignof(uint64_t) >= alignof(Payload), "Padding not allowed");
static_assert(alignof(Payload) >= alignof(Type), "Padding not allowed"); static_assert(alignof(Payload) >= alignof(Type), "Padding not allowed");
static vluint16_t getcpu(); // Return currently executing CPU id static uint16_t getcpu(); // Return currently executing CPU id
public: public:
// CONSTRUCTOR // CONSTRUCTOR
@ -117,13 +117,13 @@ public:
void evalEnd() { m_type = Type::EVAL_END; } void evalEnd() { m_type = Type::EVAL_END; }
void evalLoopBegin() { m_type = Type::EVAL_LOOP_BEGIN; } void evalLoopBegin() { m_type = Type::EVAL_LOOP_BEGIN; }
void evalLoopEnd() { m_type = Type::EVAL_LOOP_END; } void evalLoopEnd() { m_type = Type::EVAL_LOOP_END; }
void mtaskBegin(vluint32_t id, vluint32_t predictStart) { void mtaskBegin(uint32_t id, uint32_t predictStart) {
m_payload.mtaskBegin.m_id = id; m_payload.mtaskBegin.m_id = id;
m_payload.mtaskBegin.m_predictStart = predictStart; m_payload.mtaskBegin.m_predictStart = predictStart;
m_payload.mtaskBegin.m_cpu = getcpu(); m_payload.mtaskBegin.m_cpu = getcpu();
m_type = Type::MTASK_BEGIN; m_type = Type::MTASK_BEGIN;
} }
void mtaskEnd(vluint32_t id, vluint32_t predictCost) { void mtaskEnd(uint32_t id, uint32_t predictCost) {
m_payload.mtaskEnd.m_id = id; m_payload.mtaskEnd.m_id = id;
m_payload.mtaskEnd.m_predictCost = predictCost; m_payload.mtaskEnd.m_predictCost = predictCost;
m_type = Type::MTASK_END; m_type = Type::MTASK_END;
@ -161,9 +161,9 @@ class VlExecutionProfiler final {
bool m_enabled = false; // Is profiling currently enabled bool m_enabled = false; // Is profiling currently enabled
vluint64_t m_tickBegin = 0; // Sample time (rdtsc() on x86) at beginning of collection uint64_t m_tickBegin = 0; // Sample time (rdtsc() on x86) at beginning of collection
vluint64_t m_lastStartReq = 0; // Last requested profiling start (in simulation time) uint64_t m_lastStartReq = 0; // Last requested profiling start (in simulation time)
vluint32_t m_windowCount = 0; // Track our position in the cache warmup and profile window uint32_t m_windowCount = 0; // Track our position in the cache warmup and profile window
public: public:
// CONSTRUCTOR // CONSTRUCTOR
@ -185,7 +185,7 @@ public:
// Clear all profiling data // Clear all profiling data
void clear() VL_MT_SAFE_EXCLUDES(m_mutex); void clear() VL_MT_SAFE_EXCLUDES(m_mutex);
// Write profiling data into file // Write profiling data into file
void dump(const char* filenamep, vluint64_t tickEnd) VL_MT_SAFE_EXCLUDES(m_mutex); void dump(const char* filenamep, uint64_t tickEnd) VL_MT_SAFE_EXCLUDES(m_mutex);
}; };
//============================================================================= //=============================================================================
@ -199,7 +199,7 @@ template <std::size_t T_Entries> class VlPgoProfiler final {
}; };
// Counters are stored packed, all together to reduce cache effects // Counters are stored packed, all together to reduce cache effects
std::array<vluint64_t, T_Entries> m_counters; // Time spent on this record std::array<uint64_t, T_Entries> m_counters; // Time spent on this record
std::vector<Record> m_records; // Record information std::vector<Record> m_records; // Record information
public: public:

View File

@ -63,8 +63,8 @@ static const char* const VLTSAVE_TRAILER_STR = "vltsaved";
bool VerilatedDeserialize::readDiffers(const void* __restrict datap, bool VerilatedDeserialize::readDiffers(const void* __restrict datap,
size_t size) VL_MT_UNSAFE_ONE { size_t size) VL_MT_UNSAFE_ONE {
bufferCheck(); bufferCheck();
const vluint8_t* __restrict dp = static_cast<const vluint8_t* __restrict>(datap); const uint8_t* __restrict dp = static_cast<const uint8_t* __restrict>(datap);
vluint8_t miss = 0; uint8_t miss = 0;
while (size--) miss |= (*dp++ ^ *m_cp++); while (size--) miss |= (*dp++ ^ *m_cp++);
return (miss != 0); return (miss != 0);
} }
@ -192,7 +192,7 @@ void VerilatedRestore::close() VL_MT_UNSAFE_ONE {
void VerilatedSave::flush() VL_MT_UNSAFE_ONE { void VerilatedSave::flush() VL_MT_UNSAFE_ONE {
m_assertOne.check(); m_assertOne.check();
if (VL_UNLIKELY(!isOpen())) return; if (VL_UNLIKELY(!isOpen())) return;
const vluint8_t* wp = m_bufp; const uint8_t* wp = m_bufp;
while (true) { while (true) {
const ssize_t remaining = (m_cp - wp); const ssize_t remaining = (m_cp - wp);
if (remaining == 0) break; if (remaining == 0) break;
@ -219,8 +219,8 @@ void VerilatedRestore::fill() VL_MT_UNSAFE_ONE {
m_assertOne.check(); m_assertOne.check();
if (VL_UNLIKELY(!isOpen())) return; if (VL_UNLIKELY(!isOpen())) return;
// Move remaining characters down to start of buffer. (No memcpy, overlaps allowed) // Move remaining characters down to start of buffer. (No memcpy, overlaps allowed)
vluint8_t* rp = m_bufp; uint8_t* rp = m_bufp;
for (vluint8_t* sp = m_cp; sp < m_endp; *rp++ = *sp++) {} // Overlaps for (uint8_t* sp = m_cp; sp < m_endp; *rp++ = *sp++) {} // Overlaps
m_endp = m_bufp + (m_endp - m_cp); m_endp = m_bufp + (m_endp - m_cp);
m_cp = m_bufp; // Reset buffer m_cp = m_bufp; // Reset buffer
// Read into buffer starting at m_endp // Read into buffer starting at m_endp

View File

@ -40,8 +40,8 @@ class VerilatedSerialize VL_NOT_FINAL {
protected: protected:
// MEMBERS // MEMBERS
// For speed, keep m_cp as the first member of this structure // For speed, keep m_cp as the first member of this structure
vluint8_t* m_cp; // Current pointer into m_bufp buffer uint8_t* m_cp; // Current pointer into m_bufp buffer
vluint8_t* m_bufp; // Output buffer uint8_t* m_bufp; // Output buffer
bool m_isOpen = false; // True indicates open file/stream bool m_isOpen = false; // True indicates open file/stream
std::string m_filename; // Filename, for error messages std::string m_filename; // Filename, for error messages
VerilatedAssertOneThread m_assertOne; // Assert only called from single thread VerilatedAssertOneThread m_assertOne; // Assert only called from single thread
@ -58,7 +58,7 @@ protected:
public: public:
/// Construct /// Construct
VerilatedSerialize() { VerilatedSerialize() {
m_bufp = new vluint8_t[bufferSize()]; m_bufp = new uint8_t[bufferSize()];
m_cp = m_bufp; m_cp = m_bufp;
} }
/// Flish, close, and destruct /// Flish, close, and destruct
@ -77,12 +77,12 @@ public:
virtual void flush() VL_MT_UNSAFE_ONE {} virtual void flush() VL_MT_UNSAFE_ONE {}
/// Write data to stream /// Write data to stream
VerilatedSerialize& write(const void* __restrict datap, size_t size) VL_MT_UNSAFE_ONE { VerilatedSerialize& write(const void* __restrict datap, size_t size) VL_MT_UNSAFE_ONE {
const vluint8_t* __restrict dp = (const vluint8_t* __restrict)datap; const uint8_t* __restrict dp = (const uint8_t* __restrict)datap;
while (size) { while (size) {
bufferCheck(); bufferCheck();
size_t blk = size; size_t blk = size;
if (blk > bufferInsertSize()) blk = bufferInsertSize(); if (blk > bufferInsertSize()) blk = bufferInsertSize();
const vluint8_t* __restrict maxp = dp + blk; const uint8_t* __restrict maxp = dp + blk;
for (; dp < maxp; *m_cp++ = *dp++) {} for (; dp < maxp; *m_cp++ = *dp++) {}
size -= blk; size -= blk;
} }
@ -111,9 +111,9 @@ class VerilatedDeserialize VL_NOT_FINAL {
protected: protected:
// MEMBERS // MEMBERS
// For speed, keep m_cp as the first member of this structure // For speed, keep m_cp as the first member of this structure
vluint8_t* m_cp; // Current pointer into m_bufp buffer uint8_t* m_cp; // Current pointer into m_bufp buffer
vluint8_t* m_bufp; // Output buffer uint8_t* m_bufp; // Output buffer
vluint8_t* m_endp = nullptr; // Last valid byte in m_bufp buffer uint8_t* m_endp = nullptr; // Last valid byte in m_bufp buffer
bool m_isOpen = false; // True indicates open file/stream bool m_isOpen = false; // True indicates open file/stream
std::string m_filename; // Filename, for error messages std::string m_filename; // Filename, for error messages
VerilatedAssertOneThread m_assertOne; // Assert only called from single thread VerilatedAssertOneThread m_assertOne; // Assert only called from single thread
@ -131,7 +131,7 @@ protected:
public: public:
/// Construct /// Construct
VerilatedDeserialize() { VerilatedDeserialize() {
m_bufp = new vluint8_t[bufferSize()]; m_bufp = new uint8_t[bufferSize()];
m_cp = m_bufp; m_cp = m_bufp;
} }
/// Destruct /// Destruct
@ -150,12 +150,12 @@ public:
virtual void flush() VL_MT_UNSAFE_ONE {} virtual void flush() VL_MT_UNSAFE_ONE {}
/// Read data from stream /// Read data from stream
VerilatedDeserialize& read(void* __restrict datap, size_t size) VL_MT_UNSAFE_ONE { VerilatedDeserialize& read(void* __restrict datap, size_t size) VL_MT_UNSAFE_ONE {
vluint8_t* __restrict dp = static_cast<vluint8_t* __restrict>(datap); uint8_t* __restrict dp = static_cast<uint8_t* __restrict>(datap);
while (size) { while (size) {
bufferCheck(); bufferCheck();
size_t blk = size; size_t blk = size;
if (blk > bufferInsertSize()) blk = bufferInsertSize(); if (blk > bufferInsertSize()) blk = bufferInsertSize();
const vluint8_t* __restrict maxp = dp + blk; const uint8_t* __restrict maxp = dp + blk;
for (; dp < maxp; *dp++ = *m_cp++) {} for (; dp < maxp; *dp++ = *m_cp++) {}
size -= blk; size -= blk;
} }
@ -165,7 +165,7 @@ public:
// Internal use: // Internal use:
// Read a datum and compare with expected value // Read a datum and compare with expected value
VerilatedDeserialize& readAssert(const void* __restrict datap, size_t size) VL_MT_UNSAFE_ONE; VerilatedDeserialize& readAssert(const void* __restrict datap, size_t size) VL_MT_UNSAFE_ONE;
VerilatedDeserialize& readAssert(vluint64_t data) VL_MT_UNSAFE_ONE { VerilatedDeserialize& readAssert(uint64_t data) VL_MT_UNSAFE_ONE {
return readAssert(&data, sizeof(data)); return readAssert(&data, sizeof(data));
} }
@ -236,28 +236,28 @@ public:
//============================================================================= //=============================================================================
inline VerilatedSerialize& operator<<(VerilatedSerialize& os, const vluint64_t& rhs) { inline VerilatedSerialize& operator<<(VerilatedSerialize& os, const uint64_t& rhs) {
return os.write(&rhs, sizeof(rhs)); return os.write(&rhs, sizeof(rhs));
} }
inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, vluint64_t& rhs) { inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, uint64_t& rhs) {
return os.read(&rhs, sizeof(rhs)); return os.read(&rhs, sizeof(rhs));
} }
inline VerilatedSerialize& operator<<(VerilatedSerialize& os, const vluint32_t& rhs) { inline VerilatedSerialize& operator<<(VerilatedSerialize& os, const uint32_t& rhs) {
return os.write(&rhs, sizeof(rhs)); return os.write(&rhs, sizeof(rhs));
} }
inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, vluint32_t& rhs) { inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, uint32_t& rhs) {
return os.read(&rhs, sizeof(rhs)); return os.read(&rhs, sizeof(rhs));
} }
inline VerilatedSerialize& operator<<(VerilatedSerialize& os, const vluint16_t& rhs) { inline VerilatedSerialize& operator<<(VerilatedSerialize& os, const uint16_t& rhs) {
return os.write(&rhs, sizeof(rhs)); return os.write(&rhs, sizeof(rhs));
} }
inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, vluint16_t& rhs) { inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, uint16_t& rhs) {
return os.read(&rhs, sizeof(rhs)); return os.read(&rhs, sizeof(rhs));
} }
inline VerilatedSerialize& operator<<(VerilatedSerialize& os, const vluint8_t& rhs) { inline VerilatedSerialize& operator<<(VerilatedSerialize& os, const uint8_t& rhs) {
return os.write(&rhs, sizeof(rhs)); return os.write(&rhs, sizeof(rhs));
} }
inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, vluint8_t& rhs) { inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, uint8_t& rhs) {
return os.read(&rhs, sizeof(rhs)); return os.read(&rhs, sizeof(rhs));
} }
inline VerilatedSerialize& operator<<(VerilatedSerialize& os, const bool& rhs) { inline VerilatedSerialize& operator<<(VerilatedSerialize& os, const bool& rhs) {
@ -279,12 +279,12 @@ inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, float& rhs) {
return os.read(&rhs, sizeof(rhs)); return os.read(&rhs, sizeof(rhs));
} }
inline VerilatedSerialize& operator<<(VerilatedSerialize& os, const std::string& rhs) { inline VerilatedSerialize& operator<<(VerilatedSerialize& os, const std::string& rhs) {
const vluint32_t len = rhs.length(); const uint32_t len = rhs.length();
os << len; os << len;
return os.write(rhs.data(), len); return os.write(rhs.data(), len);
} }
inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, std::string& rhs) { inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, std::string& rhs) {
vluint32_t len = 0; uint32_t len = 0;
os >> len; os >> len;
rhs.resize(len); rhs.resize(len);
return os.read((void*)rhs.data(), len); return os.read((void*)rhs.data(), len);
@ -295,7 +295,7 @@ VerilatedDeserialize& operator>>(VerilatedDeserialize& os, VerilatedContext* rhs
template <class T_Key, class T_Value> template <class T_Key, class T_Value>
VerilatedSerialize& operator<<(VerilatedSerialize& os, VlAssocArray<T_Key, T_Value>& rhs) { VerilatedSerialize& operator<<(VerilatedSerialize& os, VlAssocArray<T_Key, T_Value>& rhs) {
os << rhs.atDefault(); os << rhs.atDefault();
const vluint32_t len = rhs.size(); const uint32_t len = rhs.size();
os << len; os << len;
for (const auto& i : rhs) { for (const auto& i : rhs) {
const T_Key index = i.first; // Copy to get around const_iterator const T_Key index = i.first; // Copy to get around const_iterator
@ -307,10 +307,10 @@ VerilatedSerialize& operator<<(VerilatedSerialize& os, VlAssocArray<T_Key, T_Val
template <class T_Key, class T_Value> template <class T_Key, class T_Value>
VerilatedDeserialize& operator>>(VerilatedDeserialize& os, VlAssocArray<T_Key, T_Value>& rhs) { VerilatedDeserialize& operator>>(VerilatedDeserialize& os, VlAssocArray<T_Key, T_Value>& rhs) {
os >> rhs.atDefault(); os >> rhs.atDefault();
vluint32_t len = 0; uint32_t len = 0;
os >> len; os >> len;
rhs.clear(); rhs.clear();
for (vluint32_t i = 0; i < len; ++i) { for (uint32_t i = 0; i < len; ++i) {
T_Key index; T_Key index;
T_Value value; T_Value value;
os >> index; os >> index;

View File

@ -39,10 +39,10 @@
// This class is thread safe (though most of SystemC is not). // This class is thread safe (though most of SystemC is not).
class VlScBvExposer final : public sc_bv_base { class VlScBvExposer final : public sc_bv_base {
public: public:
static const vluint32_t* sp_datap(const sc_bv_base& base) VL_MT_SAFE { static const uint32_t* sp_datap(const sc_bv_base& base) VL_MT_SAFE {
return static_cast<const VlScBvExposer*>(&base)->sp_datatp(); return static_cast<const VlScBvExposer*>(&base)->sp_datatp();
} }
const vluint32_t* sp_datatp() const { return reinterpret_cast<vluint32_t*>(m_data); } const uint32_t* sp_datatp() const { return reinterpret_cast<uint32_t*>(m_data); }
// Above reads this protected element in sc_bv_base: // Above reads this protected element in sc_bv_base:
// sc_digit* m_data; // data array // sc_digit* m_data; // data array
}; };

View File

@ -69,9 +69,9 @@ public:
class VerilatedVarProps VL_NOT_FINAL { class VerilatedVarProps VL_NOT_FINAL {
// TYPES // TYPES
static constexpr vluint32_t MAGIC = 0xddc4f829UL; static constexpr uint32_t MAGIC = 0xddc4f829UL;
// MEMBERS // MEMBERS
const vluint32_t m_magic; // Magic number const uint32_t m_magic; // Magic number
const VerilatedVarType m_vltype; // Data type const VerilatedVarType m_vltype; // Data type
const VerilatedVarFlags m_vlflags; // Direction const VerilatedVarFlags m_vlflags; // Direction
const int m_pdims; // Packed dimensions, 0 = none const int m_pdims; // Packed dimensions, 0 = none
@ -142,7 +142,7 @@ public:
VerilatedVarFlags vldir() const { VerilatedVarFlags vldir() const {
return static_cast<VerilatedVarFlags>(static_cast<int>(m_vlflags) & VLVF_MASK_DIR); return static_cast<VerilatedVarFlags>(static_cast<int>(m_vlflags) & VLVF_MASK_DIR);
} }
vluint32_t entSize() const; uint32_t entSize() const;
bool isPublicRW() const { return ((m_vlflags & VLVF_PUB_RW) != 0); } bool isPublicRW() const { return ((m_vlflags & VLVF_PUB_RW) != 0); }
// DPI compatible C standard layout // DPI compatible C standard layout
bool isDpiCLayout() const { return ((m_vlflags & VLVF_DPI_CLAY) != 0); } bool isDpiCLayout() const { return ((m_vlflags & VLVF_DPI_CLAY) != 0); }

View File

@ -37,12 +37,12 @@
// Internal note: Globals may multi-construct, see verilated.cpp top. // Internal note: Globals may multi-construct, see verilated.cpp top.
std::atomic<vluint64_t> VlMTaskVertex::s_yields; std::atomic<uint64_t> VlMTaskVertex::s_yields;
//============================================================================= //=============================================================================
// VlMTaskVertex // VlMTaskVertex
VlMTaskVertex::VlMTaskVertex(vluint32_t upstreamDepCount) VlMTaskVertex::VlMTaskVertex(uint32_t upstreamDepCount)
: m_upstreamDepsDone{0} : m_upstreamDepsDone{0}
, m_upstreamDepCount{upstreamDepCount} { , m_upstreamDepCount{upstreamDepCount} {
assert(atomic_is_lock_free(&m_upstreamDepsDone)); assert(atomic_is_lock_free(&m_upstreamDepsDone));

View File

@ -60,7 +60,7 @@ using VlExecFnp = void (*)(VlSelfP, bool);
// Track dependencies for a single MTask. // Track dependencies for a single MTask.
class VlMTaskVertex final { class VlMTaskVertex final {
// MEMBERS // MEMBERS
static std::atomic<vluint64_t> s_yields; // Statistics static std::atomic<uint64_t> s_yields; // Statistics
// On even cycles, _upstreamDepsDone increases as upstream // On even cycles, _upstreamDepsDone increases as upstream
// dependencies complete. When it reaches _upstreamDepCount, // dependencies complete. When it reaches _upstreamDepCount,
@ -78,8 +78,8 @@ class VlMTaskVertex final {
// during done-notification. Nobody's quantified that cost though. // during done-notification. Nobody's quantified that cost though.
// If we were really serious about shrinking this class, we could // If we were really serious about shrinking this class, we could
// use 16-bit types here...) // use 16-bit types here...)
std::atomic<vluint32_t> m_upstreamDepsDone; std::atomic<uint32_t> m_upstreamDepsDone;
const vluint32_t m_upstreamDepCount; const uint32_t m_upstreamDepCount;
public: public:
// CONSTRUCTORS // CONSTRUCTORS
@ -87,10 +87,10 @@ public:
// 'upstreamDepCount' is the number of upstream MTaskVertex's // 'upstreamDepCount' is the number of upstream MTaskVertex's
// that must notify this MTaskVertex before it will become ready // that must notify this MTaskVertex before it will become ready
// to run. // to run.
explicit VlMTaskVertex(vluint32_t upstreamDepCount); explicit VlMTaskVertex(uint32_t upstreamDepCount);
~VlMTaskVertex() = default; ~VlMTaskVertex() = default;
static vluint64_t yields() { return s_yields; } static uint64_t yields() { return s_yields; }
static void yieldThread() { static void yieldThread() {
++s_yields; // Statistics ++s_yields; // Statistics
std::this_thread::yield(); std::this_thread::yield();
@ -101,19 +101,19 @@ public:
// false while it's still waiting on more dependencies. // false while it's still waiting on more dependencies.
inline bool signalUpstreamDone(bool evenCycle) { inline bool signalUpstreamDone(bool evenCycle) {
if (evenCycle) { if (evenCycle) {
const vluint32_t upstreamDepsDone const uint32_t upstreamDepsDone
= 1 + m_upstreamDepsDone.fetch_add(1, std::memory_order_release); = 1 + m_upstreamDepsDone.fetch_add(1, std::memory_order_release);
assert(upstreamDepsDone <= m_upstreamDepCount); assert(upstreamDepsDone <= m_upstreamDepCount);
return (upstreamDepsDone == m_upstreamDepCount); return (upstreamDepsDone == m_upstreamDepCount);
} else { } else {
const vluint32_t upstreamDepsDone_prev const uint32_t upstreamDepsDone_prev
= m_upstreamDepsDone.fetch_sub(1, std::memory_order_release); = m_upstreamDepsDone.fetch_sub(1, std::memory_order_release);
assert(upstreamDepsDone_prev > 0); assert(upstreamDepsDone_prev > 0);
return (upstreamDepsDone_prev == 1); return (upstreamDepsDone_prev == 1);
} }
} }
inline bool areUpstreamDepsDone(bool evenCycle) const { inline bool areUpstreamDepsDone(bool evenCycle) const {
const vluint32_t target = evenCycle ? m_upstreamDepCount : 0; const uint32_t target = evenCycle ? m_upstreamDepCount : 0;
return m_upstreamDepsDone.load(std::memory_order_acquire) == target; return m_upstreamDepsDone.load(std::memory_order_acquire) == target;
} }
inline void waitUntilUpstreamDone(bool evenCycle) const { inline void waitUntilUpstreamDone(bool evenCycle) const {

View File

@ -92,7 +92,7 @@ class VerilatedTraceCommand final {
public: public:
// These must all fit in 4 bit at the moment, as the tracing routines // These must all fit in 4 bit at the moment, as the tracing routines
// pack parameters in the top bits. // pack parameters in the top bits.
enum : vluint8_t { enum : uint8_t {
CHG_BIT_0 = 0x0, CHG_BIT_0 = 0x0,
CHG_BIT_1 = 0x1, CHG_BIT_1 = 0x1,
CHG_CDATA = 0x2, CHG_CDATA = 0x2,
@ -120,7 +120,7 @@ public:
//========================================================================= //=========================================================================
// Generic tracing internals // Generic tracing internals
using initCb_t = void (*)(void*, T_Derived*, vluint32_t); // Type of init callbacks using initCb_t = void (*)(void*, T_Derived*, uint32_t); // Type of init callbacks
using dumpCb_t = void (*)(void*, T_Derived*); // Type of all but init callbacks using dumpCb_t = void (*)(void*, T_Derived*); // Type of all but init callbacks
private: private:
@ -142,18 +142,18 @@ private:
, m_userp{userp} {} , m_userp{userp} {}
}; };
vluint32_t* m_sigs_oldvalp; // Old value store uint32_t* m_sigs_oldvalp; // Old value store
EData* m_sigs_enabledp; // Bit vector of enabled codes (nullptr = all on) EData* m_sigs_enabledp; // Bit vector of enabled codes (nullptr = all on)
vluint64_t m_timeLastDump; // Last time we did a dump uint64_t m_timeLastDump; // Last time we did a dump
std::vector<bool> m_sigs_enabledVec; // Staging for m_sigs_enabledp std::vector<bool> m_sigs_enabledVec; // Staging for m_sigs_enabledp
std::vector<CallbackRecord> m_initCbs; // Routines to initialize traciong std::vector<CallbackRecord> m_initCbs; // Routines to initialize traciong
std::vector<CallbackRecord> m_fullCbs; // Routines to perform full dump std::vector<CallbackRecord> m_fullCbs; // Routines to perform full dump
std::vector<CallbackRecord> m_chgCbs; // Routines to perform incremental dump std::vector<CallbackRecord> m_chgCbs; // Routines to perform incremental dump
std::vector<CallbackRecord> m_cleanupCbs; // Routines to call at the end of dump std::vector<CallbackRecord> m_cleanupCbs; // Routines to call at the end of dump
bool m_fullDump; // Whether a full dump is required on the next call to 'dump' bool m_fullDump; // Whether a full dump is required on the next call to 'dump'
vluint32_t m_nextCode; // Next code number to assign uint32_t m_nextCode; // Next code number to assign
vluint32_t m_numSignals; // Number of distinct signals uint32_t m_numSignals; // Number of distinct signals
vluint32_t m_maxBits; // Number of bits in the widest signal uint32_t m_maxBits; // Number of bits in the widest signal
std::vector<std::string> m_namePrefixStack{""}; // Path prefixes to add to signal names std::vector<std::string> m_namePrefixStack{""}; // Path prefixes to add to signal names
std::vector<std::pair<int, std::string>> m_dumpvars; // dumpvar() entries std::vector<std::pair<int, std::string>> m_dumpvars; // dumpvar() entries
char m_scopeEscape; char m_scopeEscape;
@ -174,28 +174,28 @@ private:
#ifdef VL_TRACE_THREADED #ifdef VL_TRACE_THREADED
// Number of total trace buffers that have been allocated // Number of total trace buffers that have been allocated
vluint32_t m_numTraceBuffers; uint32_t m_numTraceBuffers;
// Size of trace buffers // Size of trace buffers
size_t m_traceBufferSize; size_t m_traceBufferSize;
// Buffers handed to worker for processing // Buffers handed to worker for processing
VerilatedThreadQueue<vluint32_t*> m_buffersToWorker; VerilatedThreadQueue<uint32_t*> m_buffersToWorker;
// Buffers returned from worker after processing // Buffers returned from worker after processing
VerilatedThreadQueue<vluint32_t*> m_buffersFromWorker; VerilatedThreadQueue<uint32_t*> m_buffersFromWorker;
// Write pointer into current buffer // Write pointer into current buffer
vluint32_t* m_traceBufferWritep; uint32_t* m_traceBufferWritep;
// End of trace buffer // End of trace buffer
vluint32_t* m_traceBufferEndp; uint32_t* m_traceBufferEndp;
// The worker thread itself // The worker thread itself
std::unique_ptr<std::thread> m_workerThread; std::unique_ptr<std::thread> m_workerThread;
// Get a new trace buffer that can be populated. May block if none available // Get a new trace buffer that can be populated. May block if none available
vluint32_t* getTraceBuffer(); uint32_t* getTraceBuffer();
// The function executed by the worker thread // The function executed by the worker thread
void workerThreadMain(); void workerThreadMain();
// Wait until given buffer is placed in m_buffersFromWorker // Wait until given buffer is placed in m_buffersFromWorker
void waitForBuffer(const vluint32_t* bufferp); void waitForBuffer(const uint32_t* bufferp);
// Shut down and join worker, if it's running, otherwise do nothing // Shut down and join worker, if it's running, otherwise do nothing
void shutdownWorker(); void shutdownWorker();
@ -210,11 +210,11 @@ protected:
VerilatedMutex m_mutex; // Ensure dump() etc only called from single thread VerilatedMutex m_mutex; // Ensure dump() etc only called from single thread
vluint32_t nextCode() const { return m_nextCode; } uint32_t nextCode() const { return m_nextCode; }
vluint32_t numSignals() const { return m_numSignals; } uint32_t numSignals() const { return m_numSignals; }
vluint32_t maxBits() const { return m_maxBits; } uint32_t maxBits() const { return m_maxBits; }
void fullDump(bool value) { m_fullDump = value; } void fullDump(bool value) { m_fullDump = value; }
vluint64_t timeLastDump() { return m_timeLastDump; } uint64_t timeLastDump() { return m_timeLastDump; }
double timeRes() const { return m_timeRes; } double timeRes() const { return m_timeRes; }
double timeUnit() const { return m_timeUnit; } double timeUnit() const { return m_timeUnit; }
@ -223,7 +223,7 @@ protected:
void traceInit() VL_MT_UNSAFE; void traceInit() VL_MT_UNSAFE;
// Declare new signal and return true if enabled // Declare new signal and return true if enabled
bool declCode(vluint32_t code, const char* namep, vluint32_t bits, bool tri); bool declCode(uint32_t code, const char* namep, uint32_t bits, bool tri);
// Is this an escape? // Is this an escape?
bool isScopeEscape(char c) { return std::isspace(c) || c == m_scopeEscape; } bool isScopeEscape(char c) { return std::isspace(c) || c == m_scopeEscape; }
@ -239,7 +239,7 @@ protected:
// Virtual functions to be provided by the format specific implementation // Virtual functions to be provided by the format specific implementation
// Called when the trace moves forward to a new time point // Called when the trace moves forward to a new time point
virtual void emitTimeChange(vluint64_t timeui) = 0; virtual void emitTimeChange(uint64_t timeui) = 0;
// These hooks are called before a full or change based dump is produced. // These hooks are called before a full or change based dump is produced.
// The return value indicates whether to proceed with the dump. // The return value indicates whether to proceed with the dump.
@ -264,7 +264,7 @@ public:
void dumpvars(int level, const std::string& hier) VL_MT_SAFE; void dumpvars(int level, const std::string& hier) VL_MT_SAFE;
// Call // Call
void dump(vluint64_t timeui) VL_MT_SAFE_EXCLUDES(m_mutex); void dump(uint64_t timeui) VL_MT_SAFE_EXCLUDES(m_mutex);
//========================================================================= //=========================================================================
// Non-hot path internal interface to Verilator generated code // Non-hot path internal interface to Verilator generated code
@ -288,69 +288,69 @@ public:
// these here, but we cannot afford dynamic dispatch for calling these as // these here, but we cannot afford dynamic dispatch for calling these as
// this is very hot code during tracing. // this is very hot code during tracing.
// duck-typed void emitBit(vluint32_t code, CData newval) = 0; // duck-typed void emitBit(uint32_t code, CData newval) = 0;
// duck-typed void emitCData(vluint32_t code, CData newval, int bits) = 0; // duck-typed void emitCData(uint32_t code, CData newval, int bits) = 0;
// duck-typed void emitSData(vluint32_t code, SData newval, int bits) = 0; // duck-typed void emitSData(uint32_t code, SData newval, int bits) = 0;
// duck-typed void emitIData(vluint32_t code, IData newval, int bits) = 0; // duck-typed void emitIData(uint32_t code, IData newval, int bits) = 0;
// duck-typed void emitQData(vluint32_t code, QData newval, int bits) = 0; // duck-typed void emitQData(uint32_t code, QData newval, int bits) = 0;
// duck-typed void emitWData(vluint32_t code, const WData* newvalp, int bits) = 0; // duck-typed void emitWData(uint32_t code, const WData* newvalp, int bits) = 0;
// duck-typed void emitDouble(vluint32_t code, double newval) = 0; // duck-typed void emitDouble(uint32_t code, double newval) = 0;
vluint32_t* oldp(vluint32_t code) { return m_sigs_oldvalp + code; } uint32_t* oldp(uint32_t code) { return m_sigs_oldvalp + code; }
// Write to previous value buffer value and emit trace entry. // Write to previous value buffer value and emit trace entry.
void fullBit(vluint32_t* oldp, CData newval); void fullBit(uint32_t* oldp, CData newval);
void fullCData(vluint32_t* oldp, CData newval, int bits); void fullCData(uint32_t* oldp, CData newval, int bits);
void fullSData(vluint32_t* oldp, SData newval, int bits); void fullSData(uint32_t* oldp, SData newval, int bits);
void fullIData(vluint32_t* oldp, IData newval, int bits); void fullIData(uint32_t* oldp, IData newval, int bits);
void fullQData(vluint32_t* oldp, QData newval, int bits); void fullQData(uint32_t* oldp, QData newval, int bits);
void fullWData(vluint32_t* oldp, const WData* newvalp, int bits); void fullWData(uint32_t* oldp, const WData* newvalp, int bits);
void fullDouble(vluint32_t* oldp, double newval); void fullDouble(uint32_t* oldp, double newval);
#ifdef VL_TRACE_THREADED #ifdef VL_TRACE_THREADED
// Threaded tracing. Just dump everything in the trace buffer // Threaded tracing. Just dump everything in the trace buffer
inline void chgBit(vluint32_t code, CData newval) { inline void chgBit(uint32_t code, CData newval) {
m_traceBufferWritep[0] = VerilatedTraceCommand::CHG_BIT_0 | newval; m_traceBufferWritep[0] = VerilatedTraceCommand::CHG_BIT_0 | newval;
m_traceBufferWritep[1] = code; m_traceBufferWritep[1] = code;
m_traceBufferWritep += 2; m_traceBufferWritep += 2;
VL_DEBUG_IF(assert(m_traceBufferWritep <= m_traceBufferEndp);); VL_DEBUG_IF(assert(m_traceBufferWritep <= m_traceBufferEndp););
} }
inline void chgCData(vluint32_t code, CData newval, int bits) { inline void chgCData(uint32_t code, CData newval, int bits) {
m_traceBufferWritep[0] = (bits << 4) | VerilatedTraceCommand::CHG_CDATA; m_traceBufferWritep[0] = (bits << 4) | VerilatedTraceCommand::CHG_CDATA;
m_traceBufferWritep[1] = code; m_traceBufferWritep[1] = code;
m_traceBufferWritep[2] = newval; m_traceBufferWritep[2] = newval;
m_traceBufferWritep += 3; m_traceBufferWritep += 3;
VL_DEBUG_IF(assert(m_traceBufferWritep <= m_traceBufferEndp);); VL_DEBUG_IF(assert(m_traceBufferWritep <= m_traceBufferEndp););
} }
inline void chgSData(vluint32_t code, SData newval, int bits) { inline void chgSData(uint32_t code, SData newval, int bits) {
m_traceBufferWritep[0] = (bits << 4) | VerilatedTraceCommand::CHG_SDATA; m_traceBufferWritep[0] = (bits << 4) | VerilatedTraceCommand::CHG_SDATA;
m_traceBufferWritep[1] = code; m_traceBufferWritep[1] = code;
m_traceBufferWritep[2] = newval; m_traceBufferWritep[2] = newval;
m_traceBufferWritep += 3; m_traceBufferWritep += 3;
VL_DEBUG_IF(assert(m_traceBufferWritep <= m_traceBufferEndp);); VL_DEBUG_IF(assert(m_traceBufferWritep <= m_traceBufferEndp););
} }
inline void chgIData(vluint32_t code, IData newval, int bits) { inline void chgIData(uint32_t code, IData newval, int bits) {
m_traceBufferWritep[0] = (bits << 4) | VerilatedTraceCommand::CHG_IDATA; m_traceBufferWritep[0] = (bits << 4) | VerilatedTraceCommand::CHG_IDATA;
m_traceBufferWritep[1] = code; m_traceBufferWritep[1] = code;
m_traceBufferWritep[2] = newval; m_traceBufferWritep[2] = newval;
m_traceBufferWritep += 3; m_traceBufferWritep += 3;
VL_DEBUG_IF(assert(m_traceBufferWritep <= m_traceBufferEndp);); VL_DEBUG_IF(assert(m_traceBufferWritep <= m_traceBufferEndp););
} }
inline void chgQData(vluint32_t code, QData newval, int bits) { inline void chgQData(uint32_t code, QData newval, int bits) {
m_traceBufferWritep[0] = (bits << 4) | VerilatedTraceCommand::CHG_QDATA; m_traceBufferWritep[0] = (bits << 4) | VerilatedTraceCommand::CHG_QDATA;
m_traceBufferWritep[1] = code; m_traceBufferWritep[1] = code;
*reinterpret_cast<QData*>(m_traceBufferWritep + 2) = newval; *reinterpret_cast<QData*>(m_traceBufferWritep + 2) = newval;
m_traceBufferWritep += 4; m_traceBufferWritep += 4;
VL_DEBUG_IF(assert(m_traceBufferWritep <= m_traceBufferEndp);); VL_DEBUG_IF(assert(m_traceBufferWritep <= m_traceBufferEndp););
} }
inline void chgWData(vluint32_t code, const WData* newvalp, int bits) { inline void chgWData(uint32_t code, const WData* newvalp, int bits) {
m_traceBufferWritep[0] = (bits << 4) | VerilatedTraceCommand::CHG_WDATA; m_traceBufferWritep[0] = (bits << 4) | VerilatedTraceCommand::CHG_WDATA;
m_traceBufferWritep[1] = code; m_traceBufferWritep[1] = code;
m_traceBufferWritep += 2; m_traceBufferWritep += 2;
for (int i = 0; i < (bits + 31) / 32; ++i) { *m_traceBufferWritep++ = newvalp[i]; } for (int i = 0; i < (bits + 31) / 32; ++i) { *m_traceBufferWritep++ = newvalp[i]; }
VL_DEBUG_IF(assert(m_traceBufferWritep <= m_traceBufferEndp);); VL_DEBUG_IF(assert(m_traceBufferWritep <= m_traceBufferEndp););
} }
inline void chgDouble(vluint32_t code, double newval) { inline void chgDouble(uint32_t code, double newval) {
m_traceBufferWritep[0] = VerilatedTraceCommand::CHG_DOUBLE; m_traceBufferWritep[0] = VerilatedTraceCommand::CHG_DOUBLE;
m_traceBufferWritep[1] = code; m_traceBufferWritep[1] = code;
// cppcheck-suppress invalidPointerCast // cppcheck-suppress invalidPointerCast
@ -369,27 +369,27 @@ public:
// thread and are called chg*Impl // thread and are called chg*Impl
// Check previous dumped value of signal. If changed, then emit trace entry // Check previous dumped value of signal. If changed, then emit trace entry
inline void CHG(Bit)(vluint32_t* oldp, CData newval) { inline void CHG(Bit)(uint32_t* oldp, CData newval) {
const vluint32_t diff = *oldp ^ newval; const uint32_t diff = *oldp ^ newval;
if (VL_UNLIKELY(diff)) fullBit(oldp, newval); if (VL_UNLIKELY(diff)) fullBit(oldp, newval);
} }
inline void CHG(CData)(vluint32_t* oldp, CData newval, int bits) { inline void CHG(CData)(uint32_t* oldp, CData newval, int bits) {
const vluint32_t diff = *oldp ^ newval; const uint32_t diff = *oldp ^ newval;
if (VL_UNLIKELY(diff)) fullCData(oldp, newval, bits); if (VL_UNLIKELY(diff)) fullCData(oldp, newval, bits);
} }
inline void CHG(SData)(vluint32_t* oldp, SData newval, int bits) { inline void CHG(SData)(uint32_t* oldp, SData newval, int bits) {
const vluint32_t diff = *oldp ^ newval; const uint32_t diff = *oldp ^ newval;
if (VL_UNLIKELY(diff)) fullSData(oldp, newval, bits); if (VL_UNLIKELY(diff)) fullSData(oldp, newval, bits);
} }
inline void CHG(IData)(vluint32_t* oldp, IData newval, int bits) { inline void CHG(IData)(uint32_t* oldp, IData newval, int bits) {
const vluint32_t diff = *oldp ^ newval; const uint32_t diff = *oldp ^ newval;
if (VL_UNLIKELY(diff)) fullIData(oldp, newval, bits); if (VL_UNLIKELY(diff)) fullIData(oldp, newval, bits);
} }
inline void CHG(QData)(vluint32_t* oldp, QData newval, int bits) { inline void CHG(QData)(uint32_t* oldp, QData newval, int bits) {
const vluint64_t diff = *reinterpret_cast<QData*>(oldp) ^ newval; const uint64_t diff = *reinterpret_cast<QData*>(oldp) ^ newval;
if (VL_UNLIKELY(diff)) fullQData(oldp, newval, bits); if (VL_UNLIKELY(diff)) fullQData(oldp, newval, bits);
} }
inline void CHG(WData)(vluint32_t* oldp, const WData* newvalp, int bits) { inline void CHG(WData)(uint32_t* oldp, const WData* newvalp, int bits) {
for (int i = 0; i < (bits + 31) / 32; ++i) { for (int i = 0; i < (bits + 31) / 32; ++i) {
if (VL_UNLIKELY(oldp[i] ^ newvalp[i])) { if (VL_UNLIKELY(oldp[i] ^ newvalp[i])) {
fullWData(oldp, newvalp, bits); fullWData(oldp, newvalp, bits);
@ -397,7 +397,7 @@ public:
} }
} }
} }
inline void CHG(Double)(vluint32_t* oldp, double newval) { inline void CHG(Double)(uint32_t* oldp, double newval) {
// cppcheck-suppress invalidPointerCast // cppcheck-suppress invalidPointerCast
if (VL_UNLIKELY(*reinterpret_cast<double*>(oldp) != newval)) fullDouble(oldp, newval); if (VL_UNLIKELY(*reinterpret_cast<double*>(oldp) != newval)) fullDouble(oldp, newval);
} }

View File

@ -82,8 +82,8 @@ static std::string doubleToTimescale(double value) {
//========================================================================= //=========================================================================
// Buffer management // Buffer management
template <> vluint32_t* VerilatedTrace<VL_DERIVED_T>::getTraceBuffer() { template <> uint32_t* VerilatedTrace<VL_DERIVED_T>::getTraceBuffer() {
vluint32_t* bufferp; uint32_t* bufferp;
// Some jitter is expected, so some number of alternative trace buffers are // Some jitter is expected, so some number of alternative trace buffers are
// required, but don't allocate more than 8 buffers. // required, but don't allocate more than 8 buffers.
if (m_numTraceBuffers < 8) { if (m_numTraceBuffers < 8) {
@ -92,7 +92,7 @@ template <> vluint32_t* VerilatedTrace<VL_DERIVED_T>::getTraceBuffer() {
++m_numTraceBuffers; ++m_numTraceBuffers;
// Note: over allocate a bit so pointer comparison is well defined // Note: over allocate a bit so pointer comparison is well defined
// if we overflow only by a small amount // if we overflow only by a small amount
bufferp = new vluint32_t[m_traceBufferSize + 16]; bufferp = new uint32_t[m_traceBufferSize + 16];
} }
} else { } else {
// Block until a buffer becomes available // Block until a buffer becomes available
@ -101,10 +101,10 @@ template <> vluint32_t* VerilatedTrace<VL_DERIVED_T>::getTraceBuffer() {
return bufferp; return bufferp;
} }
template <> void VerilatedTrace<VL_DERIVED_T>::waitForBuffer(const vluint32_t* buffp) { template <> void VerilatedTrace<VL_DERIVED_T>::waitForBuffer(const uint32_t* buffp) {
// Slow path code only called on flush/shutdown, so use a simple algorithm. // Slow path code only called on flush/shutdown, so use a simple algorithm.
// Collect buffers from worker and stash them until we get the one we want. // Collect buffers from worker and stash them until we get the one we want.
std::deque<vluint32_t*> stash; std::deque<uint32_t*> stash;
do { stash.push_back(m_buffersFromWorker.get()); } while (stash.back() != buffp); do { stash.push_back(m_buffersFromWorker.get()); } while (stash.back() != buffp);
// Now put them back in the queue, in the original order. // Now put them back in the queue, in the original order.
while (!stash.empty()) { while (!stash.empty()) {
@ -120,18 +120,18 @@ template <> void VerilatedTrace<VL_DERIVED_T>::workerThreadMain() {
bool shutdown = false; bool shutdown = false;
do { do {
vluint32_t* const bufferp = m_buffersToWorker.get(); uint32_t* const bufferp = m_buffersToWorker.get();
VL_TRACE_THREAD_DEBUG(""); VL_TRACE_THREAD_DEBUG("");
VL_TRACE_THREAD_DEBUG("Got buffer: " << bufferp); VL_TRACE_THREAD_DEBUG("Got buffer: " << bufferp);
const vluint32_t* readp = bufferp; const uint32_t* readp = bufferp;
while (true) { while (true) {
const vluint32_t cmd = readp[0]; const uint32_t cmd = readp[0];
const vluint32_t top = cmd >> 4; const uint32_t top = cmd >> 4;
// Always set this up, as it is almost always needed // Always set this up, as it is almost always needed
vluint32_t* const oldp = m_sigs_oldvalp + readp[1]; uint32_t* const oldp = m_sigs_oldvalp + readp[1];
// Note this increment needs to be undone on commands which do not // Note this increment needs to be undone on commands which do not
// actually contain a code, but those are the rare cases. // actually contain a code, but those are the rare cases.
readp += 2; readp += 2;
@ -187,7 +187,7 @@ template <> void VerilatedTrace<VL_DERIVED_T>::workerThreadMain() {
case VerilatedTraceCommand::TIME_CHANGE: case VerilatedTraceCommand::TIME_CHANGE:
VL_TRACE_THREAD_DEBUG("Command TIME_CHANGE " << top); VL_TRACE_THREAD_DEBUG("Command TIME_CHANGE " << top);
readp -= 1; // No code in this command, undo increment readp -= 1; // No code in this command, undo increment
emitTimeChange(*reinterpret_cast<const vluint64_t*>(readp)); emitTimeChange(*reinterpret_cast<const uint64_t*>(readp));
readp += 2; readp += 2;
continue; continue;
@ -226,7 +226,7 @@ template <> void VerilatedTrace<VL_DERIVED_T>::shutdownWorker() {
if (!m_workerThread) return; if (!m_workerThread) return;
// Hand an buffer with a shutdown command to the worker thread // Hand an buffer with a shutdown command to the worker thread
vluint32_t* const bufferp = getTraceBuffer(); uint32_t* const bufferp = getTraceBuffer();
bufferp[0] = VerilatedTraceCommand::SHUTDOWN; bufferp[0] = VerilatedTraceCommand::SHUTDOWN;
m_buffersToWorker.put(bufferp); m_buffersToWorker.put(bufferp);
// Wait for it to return // Wait for it to return
@ -254,7 +254,7 @@ template <> void VerilatedTrace<VL_DERIVED_T>::closeBase() {
template <> void VerilatedTrace<VL_DERIVED_T>::flushBase() { template <> void VerilatedTrace<VL_DERIVED_T>::flushBase() {
#ifdef VL_TRACE_THREADED #ifdef VL_TRACE_THREADED
// Hand an empty buffer to the worker thread // Hand an empty buffer to the worker thread
vluint32_t* const bufferp = getTraceBuffer(); uint32_t* const bufferp = getTraceBuffer();
*bufferp = VerilatedTraceCommand::END; *bufferp = VerilatedTraceCommand::END;
m_buffersToWorker.put(bufferp); m_buffersToWorker.put(bufferp);
// Wait for it to be returned. As the processing is in-order, // Wait for it to be returned. As the processing is in-order,
@ -318,7 +318,7 @@ template <> void VerilatedTrace<VL_DERIVED_T>::traceInit() VL_MT_UNSAFE {
// Note: It is possible to re-open a trace file (VCD in particular), // Note: It is possible to re-open a trace file (VCD in particular),
// so we must reset the next code here, but it must have the same number // so we must reset the next code here, but it must have the same number
// of codes on re-open // of codes on re-open
const vluint32_t expectedCodes = nextCode(); const uint32_t expectedCodes = nextCode();
m_nextCode = 1; m_nextCode = 1;
m_numSignals = 0; m_numSignals = 0;
m_maxBits = 0; m_maxBits = 0;
@ -327,7 +327,7 @@ template <> void VerilatedTrace<VL_DERIVED_T>::traceInit() VL_MT_UNSAFE {
// Call all initialize callbacks, which will: // Call all initialize callbacks, which will:
// - Call decl* for each signal (these eventually call ::declCode) // - Call decl* for each signal (these eventually call ::declCode)
// - Store the base code // - Store the base code
for (vluint32_t i = 0; i < m_initCbs.size(); ++i) { for (uint32_t i = 0; i < m_initCbs.size(); ++i) {
const CallbackRecord& cbr = m_initCbs[i]; const CallbackRecord& cbr = m_initCbs[i];
cbr.m_initCb(cbr.m_userp, self(), nextCode()); cbr.m_initCb(cbr.m_userp, self(), nextCode());
} }
@ -339,7 +339,7 @@ template <> void VerilatedTrace<VL_DERIVED_T>::traceInit() VL_MT_UNSAFE {
// Now that we know the number of codes, allocate space for the buffer // Now that we know the number of codes, allocate space for the buffer
// holding previous signal values. // holding previous signal values.
if (!m_sigs_oldvalp) m_sigs_oldvalp = new vluint32_t[nextCode()]; if (!m_sigs_oldvalp) m_sigs_oldvalp = new uint32_t[nextCode()];
// Apply enables // Apply enables
if (m_sigs_enabledp) VL_DO_CLEAR(delete[] m_sigs_enabledp, m_sigs_enabledp = nullptr); if (m_sigs_enabledp) VL_DO_CLEAR(delete[] m_sigs_enabledp, m_sigs_enabledp = nullptr);
@ -348,7 +348,7 @@ template <> void VerilatedTrace<VL_DERIVED_T>::traceInit() VL_MT_UNSAFE {
// But it isn't, so alloc one bit for each code to indicate enablement // But it isn't, so alloc one bit for each code to indicate enablement
// We don't want to still use m_signs_enabledVec as std::vector<bool> is not // We don't want to still use m_signs_enabledVec as std::vector<bool> is not
// guarenteed to be fast // guarenteed to be fast
m_sigs_enabledp = new vluint32_t[1 + VL_WORDS_I(nextCode())]{0}; m_sigs_enabledp = new uint32_t[1 + VL_WORDS_I(nextCode())]{0};
m_sigs_enabledVec.reserve(nextCode()); m_sigs_enabledVec.reserve(nextCode());
for (size_t code = 0; code < nextCode(); ++code) { for (size_t code = 0; code < nextCode(); ++code) {
if (m_sigs_enabledVec[code]) { if (m_sigs_enabledVec[code]) {
@ -376,7 +376,7 @@ template <> void VerilatedTrace<VL_DERIVED_T>::traceInit() VL_MT_UNSAFE {
} }
template <> template <>
bool VerilatedTrace<VL_DERIVED_T>::declCode(vluint32_t code, const char* namep, vluint32_t bits, bool VerilatedTrace<VL_DERIVED_T>::declCode(uint32_t code, const char* namep, uint32_t bits,
bool tri) { bool tri) {
if (VL_UNCOVERABLE(!code)) { if (VL_UNCOVERABLE(!code)) {
VL_FATAL_MT(__FILE__, __LINE__, "", "Internal: internal trace problem, code 0 is illegal"); VL_FATAL_MT(__FILE__, __LINE__, "", "Internal: internal trace problem, code 0 is illegal");
@ -455,8 +455,7 @@ void VerilatedTrace<VL_DERIVED_T>::dumpvars(int level, const std::string& hier)
} }
} }
template <> template <> void VerilatedTrace<VL_DERIVED_T>::dump(uint64_t timeui) VL_MT_SAFE_EXCLUDES(m_mutex) {
void VerilatedTrace<VL_DERIVED_T>::dump(vluint64_t timeui) VL_MT_SAFE_EXCLUDES(m_mutex) {
// Not really VL_MT_SAFE but more VL_MT_UNSAFE_ONE. // Not really VL_MT_SAFE but more VL_MT_UNSAFE_ONE.
// This does get the mutex, but if multiple threads are trying to dump // This does get the mutex, but if multiple threads are trying to dump
// chances are the data being dumped will have other problems // chances are the data being dumped will have other problems
@ -480,7 +479,7 @@ void VerilatedTrace<VL_DERIVED_T>::dump(vluint64_t timeui) VL_MT_SAFE_EXCLUDES(m
#ifdef VL_TRACE_THREADED #ifdef VL_TRACE_THREADED
// Currently only incremental dumps run on the worker thread // Currently only incremental dumps run on the worker thread
vluint32_t* bufferp = nullptr; uint32_t* bufferp = nullptr;
if (VL_LIKELY(!m_fullDump)) { if (VL_LIKELY(!m_fullDump)) {
// Get the trace buffer we are about to fill // Get the trace buffer we are about to fill
bufferp = getTraceBuffer(); bufferp = getTraceBuffer();
@ -489,7 +488,7 @@ void VerilatedTrace<VL_DERIVED_T>::dump(vluint64_t timeui) VL_MT_SAFE_EXCLUDES(m
// Tell worker to update time point // Tell worker to update time point
m_traceBufferWritep[0] = VerilatedTraceCommand::TIME_CHANGE; m_traceBufferWritep[0] = VerilatedTraceCommand::TIME_CHANGE;
*reinterpret_cast<vluint64_t*>(m_traceBufferWritep + 1) = timeui; *reinterpret_cast<uint64_t*>(m_traceBufferWritep + 1) = timeui;
m_traceBufferWritep += 3; m_traceBufferWritep += 3;
} else { } else {
// Update time point // Update time point
@ -504,18 +503,18 @@ void VerilatedTrace<VL_DERIVED_T>::dump(vluint64_t timeui) VL_MT_SAFE_EXCLUDES(m
// Run the callbacks // Run the callbacks
if (VL_UNLIKELY(m_fullDump)) { if (VL_UNLIKELY(m_fullDump)) {
m_fullDump = false; // No more need for next dump to be full m_fullDump = false; // No more need for next dump to be full
for (vluint32_t i = 0; i < m_fullCbs.size(); ++i) { for (uint32_t i = 0; i < m_fullCbs.size(); ++i) {
const CallbackRecord& cbr = m_fullCbs[i]; const CallbackRecord& cbr = m_fullCbs[i];
cbr.m_dumpCb(cbr.m_userp, self()); cbr.m_dumpCb(cbr.m_userp, self());
} }
} else { } else {
for (vluint32_t i = 0; i < m_chgCbs.size(); ++i) { for (uint32_t i = 0; i < m_chgCbs.size(); ++i) {
const CallbackRecord& cbr = m_chgCbs[i]; const CallbackRecord& cbr = m_chgCbs[i];
cbr.m_dumpCb(cbr.m_userp, self()); cbr.m_dumpCb(cbr.m_userp, self());
} }
} }
for (vluint32_t i = 0; i < m_cleanupCbs.size(); ++i) { for (uint32_t i = 0; i < m_cleanupCbs.size(); ++i) {
const CallbackRecord& cbr = m_cleanupCbs[i]; const CallbackRecord& cbr = m_cleanupCbs[i];
cbr.m_dumpCb(cbr.m_userp, self()); cbr.m_dumpCb(cbr.m_userp, self());
} }
@ -584,39 +583,35 @@ template <> void VerilatedTrace<VL_DERIVED_T>::popNamePrefix(unsigned count) {
// that this file must be included in the format specific implementation, so // that this file must be included in the format specific implementation, so
// the emit* functions can be inlined for performance. // the emit* functions can be inlined for performance.
template <> void VerilatedTrace<VL_DERIVED_T>::fullBit(vluint32_t* oldp, CData newval) { template <> void VerilatedTrace<VL_DERIVED_T>::fullBit(uint32_t* oldp, CData newval) {
const uint32_t code = oldp - m_sigs_oldvalp; const uint32_t code = oldp - m_sigs_oldvalp;
*oldp = newval; // Still copy even if not tracing so chg doesn't call full *oldp = newval; // Still copy even if not tracing so chg doesn't call full
if (VL_UNLIKELY(m_sigs_enabledp && !(VL_BITISSET_W(m_sigs_enabledp, code)))) return; if (VL_UNLIKELY(m_sigs_enabledp && !(VL_BITISSET_W(m_sigs_enabledp, code)))) return;
self()->emitBit(code, newval); self()->emitBit(code, newval);
} }
template <> template <> void VerilatedTrace<VL_DERIVED_T>::fullCData(uint32_t* oldp, CData newval, int bits) {
void VerilatedTrace<VL_DERIVED_T>::fullCData(vluint32_t* oldp, CData newval, int bits) {
const uint32_t code = oldp - m_sigs_oldvalp; const uint32_t code = oldp - m_sigs_oldvalp;
*oldp = newval; // Still copy even if not tracing so chg doesn't call full *oldp = newval; // Still copy even if not tracing so chg doesn't call full
if (VL_UNLIKELY(m_sigs_enabledp && !(VL_BITISSET_W(m_sigs_enabledp, code)))) return; if (VL_UNLIKELY(m_sigs_enabledp && !(VL_BITISSET_W(m_sigs_enabledp, code)))) return;
self()->emitCData(code, newval, bits); self()->emitCData(code, newval, bits);
} }
template <> template <> void VerilatedTrace<VL_DERIVED_T>::fullSData(uint32_t* oldp, SData newval, int bits) {
void VerilatedTrace<VL_DERIVED_T>::fullSData(vluint32_t* oldp, SData newval, int bits) {
const uint32_t code = oldp - m_sigs_oldvalp; const uint32_t code = oldp - m_sigs_oldvalp;
*oldp = newval; // Still copy even if not tracing so chg doesn't call full *oldp = newval; // Still copy even if not tracing so chg doesn't call full
if (VL_UNLIKELY(m_sigs_enabledp && !(VL_BITISSET_W(m_sigs_enabledp, code)))) return; if (VL_UNLIKELY(m_sigs_enabledp && !(VL_BITISSET_W(m_sigs_enabledp, code)))) return;
self()->emitSData(code, newval, bits); self()->emitSData(code, newval, bits);
} }
template <> template <> void VerilatedTrace<VL_DERIVED_T>::fullIData(uint32_t* oldp, IData newval, int bits) {
void VerilatedTrace<VL_DERIVED_T>::fullIData(vluint32_t* oldp, IData newval, int bits) {
const uint32_t code = oldp - m_sigs_oldvalp; const uint32_t code = oldp - m_sigs_oldvalp;
*oldp = newval; // Still copy even if not tracing so chg doesn't call full *oldp = newval; // Still copy even if not tracing so chg doesn't call full
if (VL_UNLIKELY(m_sigs_enabledp && !(VL_BITISSET_W(m_sigs_enabledp, code)))) return; if (VL_UNLIKELY(m_sigs_enabledp && !(VL_BITISSET_W(m_sigs_enabledp, code)))) return;
self()->emitIData(code, newval, bits); self()->emitIData(code, newval, bits);
} }
template <> template <> void VerilatedTrace<VL_DERIVED_T>::fullQData(uint32_t* oldp, QData newval, int bits) {
void VerilatedTrace<VL_DERIVED_T>::fullQData(vluint32_t* oldp, QData newval, int bits) {
const uint32_t code = oldp - m_sigs_oldvalp; const uint32_t code = oldp - m_sigs_oldvalp;
*reinterpret_cast<QData*>(oldp) = newval; *reinterpret_cast<QData*>(oldp) = newval;
if (VL_UNLIKELY(m_sigs_enabledp && !(VL_BITISSET_W(m_sigs_enabledp, code)))) return; if (VL_UNLIKELY(m_sigs_enabledp && !(VL_BITISSET_W(m_sigs_enabledp, code)))) return;
@ -624,14 +619,14 @@ void VerilatedTrace<VL_DERIVED_T>::fullQData(vluint32_t* oldp, QData newval, int
} }
template <> template <>
void VerilatedTrace<VL_DERIVED_T>::fullWData(vluint32_t* oldp, const WData* newvalp, int bits) { void VerilatedTrace<VL_DERIVED_T>::fullWData(uint32_t* oldp, const WData* newvalp, int bits) {
const uint32_t code = oldp - m_sigs_oldvalp; const uint32_t code = oldp - m_sigs_oldvalp;
for (int i = 0; i < VL_WORDS_I(bits); ++i) oldp[i] = newvalp[i]; for (int i = 0; i < VL_WORDS_I(bits); ++i) oldp[i] = newvalp[i];
if (VL_UNLIKELY(m_sigs_enabledp && !(VL_BITISSET_W(m_sigs_enabledp, code)))) return; if (VL_UNLIKELY(m_sigs_enabledp && !(VL_BITISSET_W(m_sigs_enabledp, code)))) return;
self()->emitWData(code, newvalp, bits); self()->emitWData(code, newvalp, bits);
} }
template <> void VerilatedTrace<VL_DERIVED_T>::fullDouble(vluint32_t* oldp, double newval) { template <> void VerilatedTrace<VL_DERIVED_T>::fullDouble(uint32_t* oldp, double newval) {
const uint32_t code = oldp - m_sigs_oldvalp; const uint32_t code = oldp - m_sigs_oldvalp;
*reinterpret_cast<double*>(oldp) = newval; *reinterpret_cast<double*>(oldp) = newval;
if (VL_UNLIKELY(m_sigs_enabledp && !(VL_BITISSET_W(m_sigs_enabledp, code)))) return; if (VL_UNLIKELY(m_sigs_enabledp && !(VL_BITISSET_W(m_sigs_enabledp, code)))) return;

View File

@ -73,7 +73,7 @@ extern std::string VL_TO_STRING_W(int words, const WDataInP obj);
//=================================================================== //===================================================================
// Shuffle RNG // Shuffle RNG
extern vluint64_t vl_rand64() VL_MT_SAFE; extern uint64_t vl_rand64() VL_MT_SAFE;
class VlURNG final { class VlURNG final {
public: public:
@ -241,7 +241,7 @@ public:
int size() const { return m_deque.size(); } int size() const { return m_deque.size(); }
// Clear array. Verilog: function void delete([input index]) // Clear array. Verilog: function void delete([input index])
void clear() { m_deque.clear(); } void clear() { m_deque.clear(); }
void erase(vlsint32_t index) { void erase(int32_t index) {
if (VL_LIKELY(index >= 0 && index < m_deque.size())) if (VL_LIKELY(index >= 0 && index < m_deque.size()))
m_deque.erase(m_deque.begin() + index); m_deque.erase(m_deque.begin() + index);
} }
@ -288,7 +288,7 @@ public:
// Setting. Verilog: assoc[index] = v // Setting. Verilog: assoc[index] = v
// Can't just overload operator[] or provide a "at" reference to set, // Can't just overload operator[] or provide a "at" reference to set,
// because we need to be able to insert only when the value is set // because we need to be able to insert only when the value is set
T_Value& at(vlsint32_t index) { T_Value& at(int32_t index) {
static T_Value s_throwAway; static T_Value s_throwAway;
// Needs to work for dynamic arrays, so does not use T_MaxSize // Needs to work for dynamic arrays, so does not use T_MaxSize
if (VL_UNLIKELY(index < 0 || index >= m_deque.size())) { if (VL_UNLIKELY(index < 0 || index >= m_deque.size())) {
@ -299,7 +299,7 @@ public:
} }
} }
// Accessing. Verilog: v = assoc[index] // Accessing. Verilog: v = assoc[index]
const T_Value& at(vlsint32_t index) const { const T_Value& at(int32_t index) const {
static T_Value s_throwAway; static T_Value s_throwAway;
// Needs to work for dynamic arrays, so does not use T_MaxSize // Needs to work for dynamic arrays, so does not use T_MaxSize
if (VL_UNLIKELY(index < 0 || index >= m_deque.size())) { if (VL_UNLIKELY(index < 0 || index >= m_deque.size())) {
@ -309,18 +309,18 @@ public:
} }
} }
// function void q.insert(index, value); // function void q.insert(index, value);
void insert(vlsint32_t index, const T_Value& value) { void insert(int32_t index, const T_Value& value) {
if (VL_UNLIKELY(index < 0 || index >= m_deque.size())) return; if (VL_UNLIKELY(index < 0 || index >= m_deque.size())) return;
m_deque.insert(m_deque.begin() + index, value); m_deque.insert(m_deque.begin() + index, value);
} }
// Return slice q[lsb:msb] // Return slice q[lsb:msb]
VlQueue slice(vlsint32_t lsb, vlsint32_t msb) const { VlQueue slice(int32_t lsb, int32_t msb) const {
VlQueue out; VlQueue out;
if (VL_UNLIKELY(lsb < 0)) lsb = 0; if (VL_UNLIKELY(lsb < 0)) lsb = 0;
if (VL_UNLIKELY(lsb >= m_deque.size())) lsb = m_deque.size() - 1; if (VL_UNLIKELY(lsb >= m_deque.size())) lsb = m_deque.size() - 1;
if (VL_UNLIKELY(msb >= m_deque.size())) msb = m_deque.size() - 1; if (VL_UNLIKELY(msb >= m_deque.size())) msb = m_deque.size() - 1;
for (vlsint32_t i = lsb; i <= msb; ++i) out.push_back(m_deque[i]); for (int32_t i = lsb; i <= msb; ++i) out.push_back(m_deque[i]);
return out; return out;
} }

View File

@ -172,7 +172,7 @@ bool VerilatedVcd::preChangeDump() {
return isOpen(); return isOpen();
} }
void VerilatedVcd::emitTimeChange(vluint64_t timeui) { void VerilatedVcd::emitTimeChange(uint64_t timeui) {
printStr("#"); printStr("#");
printQuad(timeui); printQuad(timeui);
printStr("\n"); printStr("\n");
@ -270,14 +270,14 @@ void VerilatedVcd::printStr(const char* str) {
} }
} }
void VerilatedVcd::printQuad(vluint64_t n) { void VerilatedVcd::printQuad(uint64_t n) {
constexpr size_t LEN_STR_QUAD = 40; constexpr size_t LEN_STR_QUAD = 40;
char buf[LEN_STR_QUAD]; char buf[LEN_STR_QUAD];
VL_SNPRINTF(buf, LEN_STR_QUAD, "%" PRIu64, n); VL_SNPRINTF(buf, LEN_STR_QUAD, "%" PRIu64, n);
printStr(buf); printStr(buf);
} }
void VerilatedVcd::bufferResize(vluint64_t minsize) { void VerilatedVcd::bufferResize(uint64_t minsize) {
// minsize is size of largest write. We buffer at least 8 times as much data, // minsize is size of largest write. We buffer at least 8 times as much data,
// writing when we are 3/4 full (with thus 2*minsize remaining free) // writing when we are 3/4 full (with thus 2*minsize remaining free)
if (VL_UNLIKELY(minsize > m_wrChunkSize)) { if (VL_UNLIKELY(minsize > m_wrChunkSize)) {
@ -328,7 +328,7 @@ void VerilatedVcd::bufferFlush() VL_MT_UNSAFE_ONE {
//============================================================================= //=============================================================================
// VCD string code // VCD string code
char* VerilatedVcd::writeCode(char* writep, vluint32_t code) { char* VerilatedVcd::writeCode(char* writep, uint32_t code) {
*writep++ = static_cast<char>('!' + code % 94); *writep++ = static_cast<char>('!' + code % 94);
code /= 94; code /= 94;
while (code) { while (code) {
@ -459,7 +459,7 @@ void VerilatedVcd::dumpHeader() {
deleteNameMap(); deleteNameMap();
} }
void VerilatedVcd::declare(vluint32_t code, const char* name, const char* wirep, bool array, void VerilatedVcd::declare(uint32_t code, const char* name, const char* wirep, bool array,
int arraynum, bool tri, bool bussed, int msb, int lsb) { int arraynum, bool tri, bool bussed, int msb, int lsb) {
const int bits = ((msb > lsb) ? (msb - lsb) : (lsb - msb)) + 1; const int bits = ((msb > lsb) ? (msb - lsb) : (lsb - msb)) + 1;
@ -544,38 +544,38 @@ void VerilatedVcd::declare(vluint32_t code, const char* name, const char* wirep,
m_namemapp->emplace(hiername, decl); m_namemapp->emplace(hiername, decl);
} }
void VerilatedVcd::declBit(vluint32_t code, const char* name, bool array, int arraynum) { void VerilatedVcd::declBit(uint32_t code, const char* name, bool array, int arraynum) {
declare(code, name, "wire", array, arraynum, false, false, 0, 0); declare(code, name, "wire", array, arraynum, false, false, 0, 0);
} }
void VerilatedVcd::declBus(vluint32_t code, const char* name, bool array, int arraynum, int msb, void VerilatedVcd::declBus(uint32_t code, const char* name, bool array, int arraynum, int msb,
int lsb) { int lsb) {
declare(code, name, "wire", array, arraynum, false, true, msb, lsb); declare(code, name, "wire", array, arraynum, false, true, msb, lsb);
} }
void VerilatedVcd::declQuad(vluint32_t code, const char* name, bool array, int arraynum, int msb, void VerilatedVcd::declQuad(uint32_t code, const char* name, bool array, int arraynum, int msb,
int lsb) { int lsb) {
declare(code, name, "wire", array, arraynum, false, true, msb, lsb); declare(code, name, "wire", array, arraynum, false, true, msb, lsb);
} }
void VerilatedVcd::declArray(vluint32_t code, const char* name, bool array, int arraynum, int msb, void VerilatedVcd::declArray(uint32_t code, const char* name, bool array, int arraynum, int msb,
int lsb) { int lsb) {
declare(code, name, "wire", array, arraynum, false, true, msb, lsb); declare(code, name, "wire", array, arraynum, false, true, msb, lsb);
} }
void VerilatedVcd::declDouble(vluint32_t code, const char* name, bool array, int arraynum) { void VerilatedVcd::declDouble(uint32_t code, const char* name, bool array, int arraynum) {
declare(code, name, "real", array, arraynum, false, false, 63, 0); declare(code, name, "real", array, arraynum, false, false, 63, 0);
} }
#ifdef VL_TRACE_VCD_OLD_API #ifdef VL_TRACE_VCD_OLD_API
void VerilatedVcd::declTriBit(vluint32_t code, const char* name, bool array, int arraynum) { void VerilatedVcd::declTriBit(uint32_t code, const char* name, bool array, int arraynum) {
declare(code, name, "wire", array, arraynum, true, false, 0, 0); declare(code, name, "wire", array, arraynum, true, false, 0, 0);
} }
void VerilatedVcd::declTriBus(vluint32_t code, const char* name, bool array, int arraynum, int msb, void VerilatedVcd::declTriBus(uint32_t code, const char* name, bool array, int arraynum, int msb,
int lsb) { int lsb) {
declare(code, name, "wire", array, arraynum, true, true, msb, lsb); declare(code, name, "wire", array, arraynum, true, true, msb, lsb);
} }
void VerilatedVcd::declTriQuad(vluint32_t code, const char* name, bool array, int arraynum, void VerilatedVcd::declTriQuad(uint32_t code, const char* name, bool array, int arraynum, int msb,
int msb, int lsb) { int lsb) {
declare(code, name, "wire", array, arraynum, true, true, msb, lsb); declare(code, name, "wire", array, arraynum, true, true, msb, lsb);
} }
void VerilatedVcd::declTriArray(vluint32_t code, const char* name, bool array, int arraynum, void VerilatedVcd::declTriArray(uint32_t code, const char* name, bool array, int arraynum, int msb,
int msb, int lsb) { int lsb) {
declare(code, name, "wire", array, arraynum, true, true, msb, lsb); declare(code, name, "wire", array, arraynum, true, true, msb, lsb);
} }
#endif // VL_TRACE_VCD_OLD_API #endif // VL_TRACE_VCD_OLD_API
@ -593,7 +593,7 @@ static inline void VerilatedVcdCCopyAndAppendNewLine(char* writep, const char* s
#ifdef VL_X86_64 #ifdef VL_X86_64
// Copy the whole 8 bytes in one go, this works on little-endian machines // Copy the whole 8 bytes in one go, this works on little-endian machines
// supporting unaligned stores. // supporting unaligned stores.
*reinterpret_cast<vluint64_t*>(writep) = *reinterpret_cast<const vluint64_t*>(suffixp); *reinterpret_cast<uint64_t*>(writep) = *reinterpret_cast<const uint64_t*>(suffixp);
#else #else
// Portable variant // Portable variant
writep[0] = suffixp[0]; writep[0] = suffixp[0];
@ -606,7 +606,7 @@ static inline void VerilatedVcdCCopyAndAppendNewLine(char* writep, const char* s
#endif #endif
} }
void VerilatedVcd::finishLine(vluint32_t code, char* writep) { void VerilatedVcd::finishLine(uint32_t code, char* writep) {
const char* const suffixp = m_suffixes.data() + code * VL_TRACE_SUFFIX_ENTRY_SIZE; const char* const suffixp = m_suffixes.data() + code * VL_TRACE_SUFFIX_ENTRY_SIZE;
VL_DEBUG_IFDEF(assert(suffixp[0]);); VL_DEBUG_IFDEF(assert(suffixp[0]););
VerilatedVcdCCopyAndAppendNewLine(writep, suffixp); VerilatedVcdCCopyAndAppendNewLine(writep, suffixp);
@ -625,7 +625,7 @@ void VerilatedVcd::finishLine(vluint32_t code, char* writep) {
// so always inline them. // so always inline them.
VL_ATTR_ALWINLINE VL_ATTR_ALWINLINE
void VerilatedVcd::emitBit(vluint32_t code, CData newval) { void VerilatedVcd::emitBit(uint32_t code, CData newval) {
// Don't prefetch suffix as it's a bit too late; // Don't prefetch suffix as it's a bit too late;
char* wp = m_writep; char* wp = m_writep;
*wp++ = '0' | static_cast<char>(newval); *wp++ = '0' | static_cast<char>(newval);
@ -633,7 +633,7 @@ void VerilatedVcd::emitBit(vluint32_t code, CData newval) {
} }
VL_ATTR_ALWINLINE VL_ATTR_ALWINLINE
void VerilatedVcd::emitCData(vluint32_t code, CData newval, int bits) { void VerilatedVcd::emitCData(uint32_t code, CData newval, int bits) {
char* wp = m_writep; char* wp = m_writep;
*wp++ = 'b'; *wp++ = 'b';
cvtCDataToStr(wp, newval << (VL_BYTESIZE - bits)); cvtCDataToStr(wp, newval << (VL_BYTESIZE - bits));
@ -641,7 +641,7 @@ void VerilatedVcd::emitCData(vluint32_t code, CData newval, int bits) {
} }
VL_ATTR_ALWINLINE VL_ATTR_ALWINLINE
void VerilatedVcd::emitSData(vluint32_t code, SData newval, int bits) { void VerilatedVcd::emitSData(uint32_t code, SData newval, int bits) {
char* wp = m_writep; char* wp = m_writep;
*wp++ = 'b'; *wp++ = 'b';
cvtSDataToStr(wp, newval << (VL_SHORTSIZE - bits)); cvtSDataToStr(wp, newval << (VL_SHORTSIZE - bits));
@ -649,7 +649,7 @@ void VerilatedVcd::emitSData(vluint32_t code, SData newval, int bits) {
} }
VL_ATTR_ALWINLINE VL_ATTR_ALWINLINE
void VerilatedVcd::emitIData(vluint32_t code, IData newval, int bits) { void VerilatedVcd::emitIData(uint32_t code, IData newval, int bits) {
char* wp = m_writep; char* wp = m_writep;
*wp++ = 'b'; *wp++ = 'b';
cvtIDataToStr(wp, newval << (VL_IDATASIZE - bits)); cvtIDataToStr(wp, newval << (VL_IDATASIZE - bits));
@ -657,7 +657,7 @@ void VerilatedVcd::emitIData(vluint32_t code, IData newval, int bits) {
} }
VL_ATTR_ALWINLINE VL_ATTR_ALWINLINE
void VerilatedVcd::emitQData(vluint32_t code, QData newval, int bits) { void VerilatedVcd::emitQData(uint32_t code, QData newval, int bits) {
char* wp = m_writep; char* wp = m_writep;
*wp++ = 'b'; *wp++ = 'b';
cvtQDataToStr(wp, newval << (VL_QUADSIZE - bits)); cvtQDataToStr(wp, newval << (VL_QUADSIZE - bits));
@ -665,7 +665,7 @@ void VerilatedVcd::emitQData(vluint32_t code, QData newval, int bits) {
} }
VL_ATTR_ALWINLINE VL_ATTR_ALWINLINE
void VerilatedVcd::emitWData(vluint32_t code, const WData* newvalp, int bits) { void VerilatedVcd::emitWData(uint32_t code, const WData* newvalp, int bits) {
int words = VL_WORDS_I(bits); int words = VL_WORDS_I(bits);
char* wp = m_writep; char* wp = m_writep;
*wp++ = 'b'; *wp++ = 'b';
@ -682,7 +682,7 @@ void VerilatedVcd::emitWData(vluint32_t code, const WData* newvalp, int bits) {
} }
VL_ATTR_ALWINLINE VL_ATTR_ALWINLINE
void VerilatedVcd::emitDouble(vluint32_t code, double newval) { void VerilatedVcd::emitDouble(uint32_t code, double newval) {
char* wp = m_writep; char* wp = m_writep;
// Buffer can't overflow before VL_SNPRINTF; we sized during declaration // Buffer can't overflow before VL_SNPRINTF; we sized during declaration
VL_SNPRINTF(wp, m_wrChunkSize, "r%.16g", newval); VL_SNPRINTF(wp, m_wrChunkSize, "r%.16g", newval);
@ -692,7 +692,7 @@ void VerilatedVcd::emitDouble(vluint32_t code, double newval) {
#ifdef VL_TRACE_VCD_OLD_API #ifdef VL_TRACE_VCD_OLD_API
void VerilatedVcd::fullBit(vluint32_t code, const vluint32_t newval) { void VerilatedVcd::fullBit(uint32_t code, const uint32_t newval) {
// Note the &1, so we don't require clean input -- makes more common no change case faster // Note the &1, so we don't require clean input -- makes more common no change case faster
*oldp(code) = newval; *oldp(code) = newval;
*m_writep++ = ('0' + static_cast<char>(newval & 1)); *m_writep++ = ('0' + static_cast<char>(newval & 1));
@ -700,7 +700,7 @@ void VerilatedVcd::fullBit(vluint32_t code, const vluint32_t newval) {
*m_writep++ = '\n'; *m_writep++ = '\n';
bufferCheck(); bufferCheck();
} }
void VerilatedVcd::fullBus(vluint32_t code, const vluint32_t newval, int bits) { void VerilatedVcd::fullBus(uint32_t code, const uint32_t newval, int bits) {
*oldp(code) = newval; *oldp(code) = newval;
*m_writep++ = 'b'; *m_writep++ = 'b';
for (int bit = bits - 1; bit >= 0; --bit) { for (int bit = bits - 1; bit >= 0; --bit) {
@ -711,8 +711,8 @@ void VerilatedVcd::fullBus(vluint32_t code, const vluint32_t newval, int bits) {
*m_writep++ = '\n'; *m_writep++ = '\n';
bufferCheck(); bufferCheck();
} }
void VerilatedVcd::fullQuad(vluint32_t code, const vluint64_t newval, int bits) { void VerilatedVcd::fullQuad(uint32_t code, const uint64_t newval, int bits) {
(*(reinterpret_cast<vluint64_t*>(oldp(code)))) = newval; (*(reinterpret_cast<uint64_t*>(oldp(code)))) = newval;
*m_writep++ = 'b'; *m_writep++ = 'b';
for (int bit = bits - 1; bit >= 0; --bit) { for (int bit = bits - 1; bit >= 0; --bit) {
*m_writep++ = ((newval & (1ULL << bit)) ? '1' : '0'); *m_writep++ = ((newval & (1ULL << bit)) ? '1' : '0');
@ -722,7 +722,7 @@ void VerilatedVcd::fullQuad(vluint32_t code, const vluint64_t newval, int bits)
*m_writep++ = '\n'; *m_writep++ = '\n';
bufferCheck(); bufferCheck();
} }
void VerilatedVcd::fullArray(vluint32_t code, const vluint32_t* newval, int bits) { void VerilatedVcd::fullArray(uint32_t code, const uint32_t* newval, int bits) {
for (int word = 0; word < (((bits - 1) / 32) + 1); ++word) { oldp(code)[word] = newval[word]; } for (int word = 0; word < (((bits - 1) / 32) + 1); ++word) { oldp(code)[word] = newval[word]; }
*m_writep++ = 'b'; *m_writep++ = 'b';
for (int bit = bits - 1; bit >= 0; --bit) { for (int bit = bits - 1; bit >= 0; --bit) {
@ -733,7 +733,7 @@ void VerilatedVcd::fullArray(vluint32_t code, const vluint32_t* newval, int bits
*m_writep++ = '\n'; *m_writep++ = '\n';
bufferCheck(); bufferCheck();
} }
void VerilatedVcd::fullArray(vluint32_t code, const vluint64_t* newval, int bits) { void VerilatedVcd::fullArray(uint32_t code, const uint64_t* newval, int bits) {
for (int word = 0; word < (((bits - 1) / 64) + 1); ++word) { oldp(code)[word] = newval[word]; } for (int word = 0; word < (((bits - 1) / 64) + 1); ++word) { oldp(code)[word] = newval[word]; }
*m_writep++ = 'b'; *m_writep++ = 'b';
for (int bit = bits - 1; bit >= 0; --bit) { for (int bit = bits - 1; bit >= 0; --bit) {
@ -744,7 +744,7 @@ void VerilatedVcd::fullArray(vluint32_t code, const vluint64_t* newval, int bits
*m_writep++ = '\n'; *m_writep++ = '\n';
bufferCheck(); bufferCheck();
} }
void VerilatedVcd::fullTriBit(vluint32_t code, const vluint32_t newval, const vluint32_t newtri) { void VerilatedVcd::fullTriBit(uint32_t code, const uint32_t newval, const uint32_t newtri) {
oldp(code)[0] = newval; oldp(code)[0] = newval;
oldp(code)[1] = newtri; oldp(code)[1] = newtri;
*m_writep++ = "01zz"[newval | (newtri << 1)]; *m_writep++ = "01zz"[newval | (newtri << 1)];
@ -752,7 +752,7 @@ void VerilatedVcd::fullTriBit(vluint32_t code, const vluint32_t newval, const vl
*m_writep++ = '\n'; *m_writep++ = '\n';
bufferCheck(); bufferCheck();
} }
void VerilatedVcd::fullTriBus(vluint32_t code, const vluint32_t newval, const vluint32_t newtri, void VerilatedVcd::fullTriBus(uint32_t code, const uint32_t newval, const uint32_t newtri,
int bits) { int bits) {
oldp(code)[0] = newval; oldp(code)[0] = newval;
oldp(code)[1] = newtri; oldp(code)[1] = newtri;
@ -765,10 +765,10 @@ void VerilatedVcd::fullTriBus(vluint32_t code, const vluint32_t newval, const vl
*m_writep++ = '\n'; *m_writep++ = '\n';
bufferCheck(); bufferCheck();
} }
void VerilatedVcd::fullTriQuad(vluint32_t code, const vluint64_t newval, const vluint64_t newtri, void VerilatedVcd::fullTriQuad(uint32_t code, const uint64_t newval, const uint64_t newtri,
int bits) { int bits) {
(*(reinterpret_cast<vluint64_t*>(oldp(code)))) = newval; (*(reinterpret_cast<uint64_t*>(oldp(code)))) = newval;
(*(reinterpret_cast<vluint64_t*>(oldp(code + 1)))) = newtri; (*(reinterpret_cast<uint64_t*>(oldp(code + 1)))) = newtri;
*m_writep++ = 'b'; *m_writep++ = 'b';
for (int bit = bits - 1; bit >= 0; --bit) { for (int bit = bits - 1; bit >= 0; --bit) {
*m_writep++ = "01zz"[((newval >> bit) & 1ULL) | (((newtri >> bit) & 1ULL) << 1ULL)]; *m_writep++ = "01zz"[((newval >> bit) & 1ULL) | (((newtri >> bit) & 1ULL) << 1ULL)];
@ -778,16 +778,16 @@ void VerilatedVcd::fullTriQuad(vluint32_t code, const vluint64_t newval, const v
*m_writep++ = '\n'; *m_writep++ = '\n';
bufferCheck(); bufferCheck();
} }
void VerilatedVcd::fullTriArray(vluint32_t code, const vluint32_t* newvalp, void VerilatedVcd::fullTriArray(uint32_t code, const uint32_t* newvalp, const uint32_t* newtrip,
const vluint32_t* newtrip, int bits) { int bits) {
for (int word = 0; word < (((bits - 1) / 32) + 1); ++word) { for (int word = 0; word < (((bits - 1) / 32) + 1); ++word) {
oldp(code)[word * 2] = newvalp[word]; oldp(code)[word * 2] = newvalp[word];
oldp(code)[word * 2 + 1] = newtrip[word]; oldp(code)[word * 2 + 1] = newtrip[word];
} }
*m_writep++ = 'b'; *m_writep++ = 'b';
for (int bit = bits - 1; bit >= 0; --bit) { for (int bit = bits - 1; bit >= 0; --bit) {
vluint32_t valbit = (newvalp[(bit / 32)] >> (bit & 0x1f)) & 1; uint32_t valbit = (newvalp[(bit / 32)] >> (bit & 0x1f)) & 1;
vluint32_t tribit = (newtrip[(bit / 32)] >> (bit & 0x1f)) & 1; uint32_t tribit = (newtrip[(bit / 32)] >> (bit & 0x1f)) & 1;
*m_writep++ = "01zz"[valbit | (tribit << 1)]; *m_writep++ = "01zz"[valbit | (tribit << 1)];
} }
*m_writep++ = ' '; *m_writep++ = ' ';
@ -795,7 +795,7 @@ void VerilatedVcd::fullTriArray(vluint32_t code, const vluint32_t* newvalp,
*m_writep++ = '\n'; *m_writep++ = '\n';
bufferCheck(); bufferCheck();
} }
void VerilatedVcd::fullDouble(vluint32_t code, const double newval) { void VerilatedVcd::fullDouble(uint32_t code, const double newval) {
// cppcheck-suppress invalidPointerCast // cppcheck-suppress invalidPointerCast
(*(reinterpret_cast<double*>(oldp(code)))) = newval; (*(reinterpret_cast<double*>(oldp(code)))) = newval;
// Buffer can't overflow before VL_SNPRINTF; we sized during declaration // Buffer can't overflow before VL_SNPRINTF; we sized during declaration
@ -818,18 +818,18 @@ void VerilatedVcd::fullDouble(vluint32_t code, const double newval) {
extern void verilated_trace_imp_selftest(); extern void verilated_trace_imp_selftest();
vluint32_t v1, v2, s1, s2[3]; uint32_t v1, v2, s1, s2[3];
vluint32_t tri96[3]; uint32_t tri96[3];
vluint32_t tri96__tri[3]; uint32_t tri96__tri[3];
vluint64_t quad96[2]; uint64_t quad96[2];
vluint64_t tquad; uint64_t tquad;
vluint64_t tquad__tri; uint64_t tquad__tri;
vluint8_t ch; uint8_t ch;
vluint64_t timestamp = 1; uint64_t timestamp = 1;
double doub = 0.0; double doub = 0.0;
float flo = 0.0f; float flo = 0.0f;
void vcdInit(void*, VerilatedVcd* vcdp, vluint32_t) { void vcdInit(void*, VerilatedVcd* vcdp, uint32_t) {
vcdp->scopeEscape('.'); vcdp->scopeEscape('.');
vcdp->pushNamePrefix("top."); vcdp->pushNamePrefix("top.");
/**/ vcdp->declBus(0x2, "v1", -1, 0, 5, 1); /**/ vcdp->declBus(0x2, "v1", -1, 0, 5, 1);
@ -933,8 +933,8 @@ void vcdTestMain(const char* filenamep) {
vcdp->dump(++timestamp); vcdp->dump(++timestamp);
vcdp->dump(++timestamp); vcdp->dump(++timestamp);
# ifdef VERILATED_VCD_TEST_64BIT # ifdef VERILATED_VCD_TEST_64BIT
const vluint64_t bytesPerDump = 15ULL; const uint64_t bytesPerDump = 15ULL;
for (vluint64_t i = 0; i < ((1ULL << 32) / bytesPerDump); i++) { for (uint64_t i = 0; i < ((1ULL << 32) / bytesPerDump); i++) {
v1 = i; v1 = i;
vcdp->dump(++timestamp); vcdp->dump(++timestamp);
} }

View File

@ -70,21 +70,21 @@ private:
bool m_isOpen = false; // True indicates open file bool m_isOpen = false; // True indicates open file
bool m_evcd = false; // True for evcd format bool m_evcd = false; // True for evcd format
std::string m_filename; // Filename we're writing to (if open) std::string m_filename; // Filename we're writing to (if open)
vluint64_t m_rolloverMB = 0; // MB of file size to rollover at uint64_t m_rolloverMB = 0; // MB of file size to rollover at
int m_modDepth = 0; // Depth of module hierarchy int m_modDepth = 0; // Depth of module hierarchy
char* m_wrBufp; // Output buffer char* m_wrBufp; // Output buffer
const char* m_wrFlushp; // Output buffer flush trigger location const char* m_wrFlushp; // Output buffer flush trigger location
char* m_writep; // Write pointer into output buffer char* m_writep; // Write pointer into output buffer
vluint64_t m_wrChunkSize; // Output buffer size uint64_t m_wrChunkSize; // Output buffer size
vluint64_t m_wroteBytes = 0; // Number of bytes written to this file uint64_t m_wroteBytes = 0; // Number of bytes written to this file
std::vector<char> m_suffixes; // VCD line end string codes + metadata std::vector<char> m_suffixes; // VCD line end string codes + metadata
using NameMap = std::map<const std::string, const std::string>; using NameMap = std::map<const std::string, const std::string>;
NameMap* m_namemapp = nullptr; // List of names for the header NameMap* m_namemapp = nullptr; // List of names for the header
void bufferResize(vluint64_t minsize); void bufferResize(uint64_t minsize);
void bufferFlush() VL_MT_UNSAFE_ONE; void bufferFlush() VL_MT_UNSAFE_ONE;
inline void bufferCheck() { inline void bufferCheck() {
// Flush the write buffer if there's not enough space left for new information // Flush the write buffer if there's not enough space left for new information
@ -98,16 +98,16 @@ private:
void deleteNameMap(); void deleteNameMap();
void printIndent(int level_change); void printIndent(int level_change);
void printStr(const char* str); void printStr(const char* str);
void printQuad(vluint64_t n); void printQuad(uint64_t n);
void printTime(vluint64_t timeui); void printTime(uint64_t timeui);
void declare(vluint32_t code, const char* name, const char* wirep, bool array, int arraynum, void declare(uint32_t code, const char* name, const char* wirep, bool array, int arraynum,
bool tri, bool bussed, int msb, int lsb); bool tri, bool bussed, int msb, int lsb);
void dumpHeader(); void dumpHeader();
static char* writeCode(char* writep, vluint32_t code); static char* writeCode(char* writep, uint32_t code);
void finishLine(vluint32_t code, char* writep); void finishLine(uint32_t code, char* writep);
// CONSTRUCTORS // CONSTRUCTORS
VL_UNCOPYABLE(VerilatedVcd); VL_UNCOPYABLE(VerilatedVcd);
@ -117,7 +117,7 @@ protected:
// Implementation of VerilatedTrace interface // Implementation of VerilatedTrace interface
// Implementations of protected virtual methods for VerilatedTrace // Implementations of protected virtual methods for VerilatedTrace
virtual void emitTimeChange(vluint64_t timeui) override; virtual void emitTimeChange(uint64_t timeui) override;
// Hooks called from VerilatedTrace // Hooks called from VerilatedTrace
virtual bool preFullDump() override { return isOpen(); } virtual bool preFullDump() override { return isOpen(); }
@ -125,13 +125,13 @@ protected:
// Implementations of duck-typed methods for VerilatedTrace. These are // Implementations of duck-typed methods for VerilatedTrace. These are
// called from only one place (namely full*) so always inline them. // called from only one place (namely full*) so always inline them.
inline void emitBit(vluint32_t code, CData newval); inline void emitBit(uint32_t code, CData newval);
inline void emitCData(vluint32_t code, CData newval, int bits); inline void emitCData(uint32_t code, CData newval, int bits);
inline void emitSData(vluint32_t code, SData newval, int bits); inline void emitSData(uint32_t code, SData newval, int bits);
inline void emitIData(vluint32_t code, IData newval, int bits); inline void emitIData(uint32_t code, IData newval, int bits);
inline void emitQData(vluint32_t code, QData newval, int bits); inline void emitQData(uint32_t code, QData newval, int bits);
inline void emitWData(vluint32_t code, const WData* newvalp, int bits); inline void emitWData(uint32_t code, const WData* newvalp, int bits);
inline void emitDouble(vluint32_t code, double newval); inline void emitDouble(uint32_t code, double newval);
public: public:
//========================================================================= //=========================================================================
@ -142,7 +142,7 @@ public:
// ACCESSORS // ACCESSORS
// Set size in megabytes after which new file should be created // Set size in megabytes after which new file should be created
void rolloverMB(vluint64_t rolloverMB) { m_rolloverMB = rolloverMB; } void rolloverMB(uint64_t rolloverMB) { m_rolloverMB = rolloverMB; }
// METHODS // METHODS
// Open the file; call isOpen() to see if errors // Open the file; call isOpen() to see if errors
@ -159,11 +159,11 @@ public:
//========================================================================= //=========================================================================
// Internal interface to Verilator generated code // Internal interface to Verilator generated code
void declBit(vluint32_t code, const char* name, bool array, int arraynum); void declBit(uint32_t code, const char* name, bool array, int arraynum);
void declBus(vluint32_t code, const char* name, bool array, int arraynum, int msb, int lsb); void declBus(uint32_t code, const char* name, bool array, int arraynum, int msb, int lsb);
void declQuad(vluint32_t code, const char* name, bool array, int arraynum, int msb, int lsb); void declQuad(uint32_t code, const char* name, bool array, int arraynum, int msb, int lsb);
void declArray(vluint32_t code, const char* name, bool array, int arraynum, int msb, int lsb); void declArray(uint32_t code, const char* name, bool array, int arraynum, int msb, int lsb);
void declDouble(vluint32_t code, const char* name, bool array, int arraynum); void declDouble(uint32_t code, const char* name, bool array, int arraynum);
#ifdef VL_TRACE_VCD_OLD_API #ifdef VL_TRACE_VCD_OLD_API
//========================================================================= //=========================================================================
@ -171,88 +171,85 @@ public:
// code and is not used by Verilator. Do not use these as there is no // code and is not used by Verilator. Do not use these as there is no
// guarantee of functionality. // guarantee of functionality.
void declTriBit(vluint32_t code, const char* name, bool array, int arraynum); void declTriBit(uint32_t code, const char* name, bool array, int arraynum);
void declTriBus(vluint32_t code, const char* name, bool array, int arraynum, int msb, int lsb); void declTriBus(uint32_t code, const char* name, bool array, int arraynum, int msb, int lsb);
void declTriQuad(vluint32_t code, const char* name, bool array, int arraynum, int msb, void declTriQuad(uint32_t code, const char* name, bool array, int arraynum, int msb, int lsb);
int lsb); void declTriArray(uint32_t code, const char* name, bool array, int arraynum, int msb, int lsb);
void declTriArray(vluint32_t code, const char* name, bool array, int arraynum, int msb,
int lsb);
void fullBit(vluint32_t* oldp, CData newval) { fullBit(oldp - this->oldp(0), newval); } void fullBit(uint32_t* oldp, CData newval) { fullBit(oldp - this->oldp(0), newval); }
void fullCData(vluint32_t* oldp, CData newval, int bits) { void fullCData(uint32_t* oldp, CData newval, int bits) {
fullBus(oldp - this->oldp(0), newval, bits); fullBus(oldp - this->oldp(0), newval, bits);
} }
void fullSData(vluint32_t* oldp, SData newval, int bits) { void fullSData(uint32_t* oldp, SData newval, int bits) {
fullBus(oldp - this->oldp(0), newval, bits); fullBus(oldp - this->oldp(0), newval, bits);
} }
void fullIData(vluint32_t* oldp, IData newval, int bits) { void fullIData(uint32_t* oldp, IData newval, int bits) {
fullBus(oldp - this->oldp(0), newval, bits); fullBus(oldp - this->oldp(0), newval, bits);
} }
void fullQData(vluint32_t* oldp, QData newval, int bits) { void fullQData(uint32_t* oldp, QData newval, int bits) {
fullQuad(oldp - this->oldp(0), newval, bits); fullQuad(oldp - this->oldp(0), newval, bits);
} }
void fullWData(vluint32_t* oldp, const WData* newvalp, int bits) { void fullWData(uint32_t* oldp, const WData* newvalp, int bits) {
fullArray(oldp - this->oldp(0), newvalp, bits); fullArray(oldp - this->oldp(0), newvalp, bits);
} }
void fullDouble(vluint32_t* oldp, double newval) { fullDouble(oldp - this->oldp(0), newval); } void fullDouble(uint32_t* oldp, double newval) { fullDouble(oldp - this->oldp(0), newval); }
inline void chgBit(vluint32_t* oldp, CData newval) { chgBit(oldp - this->oldp(0), newval); } inline void chgBit(uint32_t* oldp, CData newval) { chgBit(oldp - this->oldp(0), newval); }
inline void chgCData(vluint32_t* oldp, CData newval, int bits) { inline void chgCData(uint32_t* oldp, CData newval, int bits) {
chgBus(oldp - this->oldp(0), newval, bits); chgBus(oldp - this->oldp(0), newval, bits);
} }
inline void chgSData(vluint32_t* oldp, SData newval, int bits) { inline void chgSData(uint32_t* oldp, SData newval, int bits) {
chgBus(oldp - this->oldp(0), newval, bits); chgBus(oldp - this->oldp(0), newval, bits);
} }
inline void chgIData(vluint32_t* oldp, IData newval, int bits) { inline void chgIData(uint32_t* oldp, IData newval, int bits) {
chgBus(oldp - this->oldp(0), newval, bits); chgBus(oldp - this->oldp(0), newval, bits);
} }
inline void chgQData(vluint32_t* oldp, QData newval, int bits) { inline void chgQData(uint32_t* oldp, QData newval, int bits) {
chgQuad(oldp - this->oldp(0), newval, bits); chgQuad(oldp - this->oldp(0), newval, bits);
} }
inline void chgWData(vluint32_t* oldp, const WData* newvalp, int bits) { inline void chgWData(uint32_t* oldp, const WData* newvalp, int bits) {
chgArray(oldp - this->oldp(0), newvalp, bits); chgArray(oldp - this->oldp(0), newvalp, bits);
} }
inline void chgDouble(vluint32_t* oldp, double newval) { inline void chgDouble(uint32_t* oldp, double newval) {
chgDouble(oldp - this->oldp(0), newval); chgDouble(oldp - this->oldp(0), newval);
} }
// Inside dumping routines, dump one signal, faster when not inlined // Inside dumping routines, dump one signal, faster when not inlined
// due to code size reduction. // due to code size reduction.
void fullBit(vluint32_t code, const vluint32_t newval); void fullBit(uint32_t code, const uint32_t newval);
void fullBus(vluint32_t code, const vluint32_t newval, int bits); void fullBus(uint32_t code, const uint32_t newval, int bits);
void fullQuad(vluint32_t code, const vluint64_t newval, int bits); void fullQuad(uint32_t code, const uint64_t newval, int bits);
void fullArray(vluint32_t code, const vluint32_t* newvalp, int bits); void fullArray(uint32_t code, const uint32_t* newvalp, int bits);
void fullArray(vluint32_t code, const vluint64_t* newvalp, int bits); void fullArray(uint32_t code, const uint64_t* newvalp, int bits);
void fullTriBit(vluint32_t code, const vluint32_t newval, const vluint32_t newtri); void fullTriBit(uint32_t code, const uint32_t newval, const uint32_t newtri);
void fullTriBus(vluint32_t code, const vluint32_t newval, const vluint32_t newtri, int bits); void fullTriBus(uint32_t code, const uint32_t newval, const uint32_t newtri, int bits);
void fullTriQuad(vluint32_t code, const vluint64_t newval, const vluint64_t newtri, int bits); void fullTriQuad(uint32_t code, const uint64_t newval, const uint64_t newtri, int bits);
void fullTriArray(vluint32_t code, const vluint32_t* newvalp, const vluint32_t* newtrip, void fullTriArray(uint32_t code, const uint32_t* newvalp, const uint32_t* newtrip, int bits);
int bits); void fullDouble(uint32_t code, const double newval);
void fullDouble(vluint32_t code, const double newval);
// Inside dumping routines, dump one signal if it has changed. // Inside dumping routines, dump one signal if it has changed.
// We do want to inline these to avoid calls when the value did not change. // We do want to inline these to avoid calls when the value did not change.
inline void chgBit(vluint32_t code, const vluint32_t newval) { inline void chgBit(uint32_t code, const uint32_t newval) {
const vluint32_t diff = oldp(code)[0] ^ newval; const uint32_t diff = oldp(code)[0] ^ newval;
if (VL_UNLIKELY(diff)) fullBit(code, newval); if (VL_UNLIKELY(diff)) fullBit(code, newval);
} }
inline void chgBus(vluint32_t code, const vluint32_t newval, int bits) { inline void chgBus(uint32_t code, const uint32_t newval, int bits) {
const vluint32_t diff = oldp(code)[0] ^ newval; const uint32_t diff = oldp(code)[0] ^ newval;
if (VL_UNLIKELY(diff)) { if (VL_UNLIKELY(diff)) {
if (VL_UNLIKELY(bits == 32 || (diff & ((1U << bits) - 1)))) { if (VL_UNLIKELY(bits == 32 || (diff & ((1U << bits) - 1)))) {
fullBus(code, newval, bits); fullBus(code, newval, bits);
} }
} }
} }
inline void chgQuad(vluint32_t code, const vluint64_t newval, int bits) { inline void chgQuad(uint32_t code, const uint64_t newval, int bits) {
const vluint64_t diff = (*(reinterpret_cast<vluint64_t*>(oldp(code)))) ^ newval; const uint64_t diff = (*(reinterpret_cast<uint64_t*>(oldp(code)))) ^ newval;
if (VL_UNLIKELY(diff)) { if (VL_UNLIKELY(diff)) {
if (VL_UNLIKELY(bits == 64 || (diff & ((1ULL << bits) - 1)))) { if (VL_UNLIKELY(bits == 64 || (diff & ((1ULL << bits) - 1)))) {
fullQuad(code, newval, bits); fullQuad(code, newval, bits);
} }
} }
} }
inline void chgArray(vluint32_t code, const vluint32_t* newvalp, int bits) { inline void chgArray(uint32_t code, const uint32_t* newvalp, int bits) {
for (int word = 0; word < (((bits - 1) / 32) + 1); ++word) { for (int word = 0; word < (((bits - 1) / 32) + 1); ++word) {
if (VL_UNLIKELY(oldp(code)[word] ^ newvalp[word])) { if (VL_UNLIKELY(oldp(code)[word] ^ newvalp[word])) {
fullArray(code, newvalp, bits); fullArray(code, newvalp, bits);
@ -260,17 +257,17 @@ public:
} }
} }
} }
inline void chgArray(vluint32_t code, const vluint64_t* newvalp, int bits) { inline void chgArray(uint32_t code, const uint64_t* newvalp, int bits) {
for (int word = 0; word < (((bits - 1) / 64) + 1); ++word) { for (int word = 0; word < (((bits - 1) / 64) + 1); ++word) {
if (VL_UNLIKELY(*(reinterpret_cast<vluint64_t*>(oldp(code + 2 * word))) if (VL_UNLIKELY(*(reinterpret_cast<uint64_t*>(oldp(code + 2 * word)))
^ newvalp[word])) { ^ newvalp[word])) {
fullArray(code, newvalp, bits); fullArray(code, newvalp, bits);
return; return;
} }
} }
} }
inline void chgTriBit(vluint32_t code, const vluint32_t newval, const vluint32_t newtri) { inline void chgTriBit(uint32_t code, const uint32_t newval, const uint32_t newtri) {
const vluint32_t diff = ((oldp(code)[0] ^ newval) | (oldp(code)[1] ^ newtri)); const uint32_t diff = ((oldp(code)[0] ^ newval) | (oldp(code)[1] ^ newtri));
if (VL_UNLIKELY(diff)) { if (VL_UNLIKELY(diff)) {
// Verilator 3.510 and newer provide clean input, so the below // Verilator 3.510 and newer provide clean input, so the below
// is only for back compatibility // is only for back compatibility
@ -279,26 +276,24 @@ public:
} }
} }
} }
inline void chgTriBus(vluint32_t code, const vluint32_t newval, const vluint32_t newtri, inline void chgTriBus(uint32_t code, const uint32_t newval, const uint32_t newtri, int bits) {
int bits) { const uint32_t diff = ((oldp(code)[0] ^ newval) | (oldp(code)[1] ^ newtri));
const vluint32_t diff = ((oldp(code)[0] ^ newval) | (oldp(code)[1] ^ newtri));
if (VL_UNLIKELY(diff)) { if (VL_UNLIKELY(diff)) {
if (VL_UNLIKELY(bits == 32 || (diff & ((1U << bits) - 1)))) { if (VL_UNLIKELY(bits == 32 || (diff & ((1U << bits) - 1)))) {
fullTriBus(code, newval, newtri, bits); fullTriBus(code, newval, newtri, bits);
} }
} }
} }
inline void chgTriQuad(vluint32_t code, const vluint64_t newval, const vluint64_t newtri, inline void chgTriQuad(uint32_t code, const uint64_t newval, const uint64_t newtri, int bits) {
int bits) { const uint64_t diff = (((*(reinterpret_cast<uint64_t*>(oldp(code)))) ^ newval)
const vluint64_t diff = (((*(reinterpret_cast<vluint64_t*>(oldp(code)))) ^ newval) | ((*(reinterpret_cast<uint64_t*>(oldp(code + 1)))) ^ newtri));
| ((*(reinterpret_cast<vluint64_t*>(oldp(code + 1)))) ^ newtri));
if (VL_UNLIKELY(diff)) { if (VL_UNLIKELY(diff)) {
if (VL_UNLIKELY(bits == 64 || (diff & ((1ULL << bits) - 1)))) { if (VL_UNLIKELY(bits == 64 || (diff & ((1ULL << bits) - 1)))) {
fullTriQuad(code, newval, newtri, bits); fullTriQuad(code, newval, newtri, bits);
} }
} }
} }
inline void chgTriArray(vluint32_t code, const vluint32_t* newvalp, const vluint32_t* newtrip, inline void chgTriArray(uint32_t code, const uint32_t* newvalp, const uint32_t* newtrip,
int bits) { int bits) {
for (int word = 0; word < (((bits - 1) / 32) + 1); ++word) { for (int word = 0; word < (((bits - 1) / 32) + 1); ++word) {
if (VL_UNLIKELY((oldp(code)[word * 2] ^ newvalp[word]) if (VL_UNLIKELY((oldp(code)[word * 2] ^ newvalp[word])
@ -308,7 +303,7 @@ public:
} }
} }
} }
inline void chgDouble(vluint32_t code, const double newval) { inline void chgDouble(uint32_t code, const double newval) {
// cppcheck-suppress invalidPointerCast // cppcheck-suppress invalidPointerCast
if (VL_UNLIKELY((*(reinterpret_cast<double*>(oldp(code)))) != newval)) { if (VL_UNLIKELY((*(reinterpret_cast<double*>(oldp(code)))) != newval)) {
fullDouble(code, newval); fullDouble(code, newval);
@ -323,7 +318,7 @@ public:
#ifndef DOXYGEN #ifndef DOXYGEN
// Declare specializations here they are used in VerilatedVcdC just below // Declare specializations here they are used in VerilatedVcdC just below
template <> void VerilatedTrace<VerilatedVcd>::dump(vluint64_t timeui); template <> void VerilatedTrace<VerilatedVcd>::dump(uint64_t timeui);
template <> void VerilatedTrace<VerilatedVcd>::set_time_unit(const char* unitp); template <> void VerilatedTrace<VerilatedVcd>::set_time_unit(const char* unitp);
template <> void VerilatedTrace<VerilatedVcd>::set_time_unit(const std::string& unit); template <> void VerilatedTrace<VerilatedVcd>::set_time_unit(const std::string& unit);
template <> void VerilatedTrace<VerilatedVcd>::set_time_resolution(const char* unitp); template <> void VerilatedTrace<VerilatedVcd>::set_time_resolution(const char* unitp);
@ -371,12 +366,12 @@ public:
/// Write one cycle of dump data /// Write one cycle of dump data
/// Call with the current context's time just after eval'ed, /// Call with the current context's time just after eval'ed,
/// e.g. ->dump(contextp->time()) /// e.g. ->dump(contextp->time())
void dump(vluint64_t timeui) VL_MT_SAFE { m_sptrace.dump(timeui); } void dump(uint64_t timeui) VL_MT_SAFE { m_sptrace.dump(timeui); }
/// Write one cycle of dump data - backward compatible and to reduce /// Write one cycle of dump data - backward compatible and to reduce
/// conversion warnings. It's better to use a vluint64_t time instead. /// conversion warnings. It's better to use a uint64_t time instead.
void dump(double timestamp) { dump(static_cast<vluint64_t>(timestamp)); } void dump(double timestamp) { dump(static_cast<uint64_t>(timestamp)); }
void dump(vluint32_t timestamp) { dump(static_cast<vluint64_t>(timestamp)); } void dump(uint32_t timestamp) { dump(static_cast<uint64_t>(timestamp)); }
void dump(int timestamp) { dump(static_cast<vluint64_t>(timestamp)); } void dump(int timestamp) { dump(static_cast<uint64_t>(timestamp)); }
// METHODS - Internal/backward compatible // METHODS - Internal/backward compatible
// \protectedsection // \protectedsection

View File

@ -66,11 +66,11 @@ class VerilatedVpio VL_NOT_FINAL {
// CONSTANTS // CONSTANTS
// Magic value stored in front of object to detect double free etc // Magic value stored in front of object to detect double free etc
// Must be odd, as aligned pointer can never be odd // Must be odd, as aligned pointer can never be odd
static constexpr vluint32_t activeMagic() { return 0xfeed100f; } static constexpr uint32_t activeMagic() { return 0xfeed100f; }
// MEM MANGLEMENT // MEM MANGLEMENT
// Internal note: Globals may multi-construct, see verilated.cpp top. // Internal note: Globals may multi-construct, see verilated.cpp top.
static VL_THREAD_LOCAL vluint8_t* t_freeHead; static VL_THREAD_LOCAL uint8_t* t_freeHead;
public: public:
// CONSTRUCTORS // CONSTRUCTORS
@ -84,19 +84,19 @@ public:
static const size_t chunk = 96; static const size_t chunk = 96;
if (VL_UNCOVERABLE(size > chunk)) VL_FATAL_MT(__FILE__, __LINE__, "", "increase chunk"); if (VL_UNCOVERABLE(size > chunk)) VL_FATAL_MT(__FILE__, __LINE__, "", "increase chunk");
if (VL_LIKELY(t_freeHead)) { if (VL_LIKELY(t_freeHead)) {
vluint8_t* const newp = t_freeHead; uint8_t* const newp = t_freeHead;
t_freeHead = *(reinterpret_cast<vluint8_t**>(newp)); t_freeHead = *(reinterpret_cast<uint8_t**>(newp));
*(reinterpret_cast<vluint32_t*>(newp)) = activeMagic(); *(reinterpret_cast<uint32_t*>(newp)) = activeMagic();
return newp + 8; return newp + 8;
} }
// +8: 8 bytes for next // +8: 8 bytes for next
vluint8_t* newp = reinterpret_cast<vluint8_t*>(::operator new(chunk + 8)); uint8_t* newp = reinterpret_cast<uint8_t*>(::operator new(chunk + 8));
*(reinterpret_cast<vluint32_t*>(newp)) = activeMagic(); *(reinterpret_cast<uint32_t*>(newp)) = activeMagic();
return newp + 8; return newp + 8;
} }
static void operator delete(void* obj, size_t /*size*/)VL_MT_SAFE { static void operator delete(void* obj, size_t /*size*/)VL_MT_SAFE {
vluint8_t* const oldp = (static_cast<vluint8_t*>(obj)) - 8; uint8_t* const oldp = (static_cast<uint8_t*>(obj)) - 8;
if (VL_UNLIKELY(*(reinterpret_cast<vluint32_t*>(oldp)) != activeMagic())) { if (VL_UNLIKELY(*(reinterpret_cast<uint32_t*>(oldp)) != activeMagic())) {
VL_FATAL_MT(__FILE__, __LINE__, "", VL_FATAL_MT(__FILE__, __LINE__, "",
"vpi_release_handle() called on same object twice, or on non-Verilator " "vpi_release_handle() called on same object twice, or on non-Verilator "
"VPI object"); "VPI object");
@ -117,8 +117,8 @@ public:
virtual const char* name() const { return "<null>"; } virtual const char* name() const { return "<null>"; }
virtual const char* fullname() const { return "<null>"; } virtual const char* fullname() const { return "<null>"; }
virtual const char* defname() const { return "<null>"; } virtual const char* defname() const { return "<null>"; }
virtual vluint32_t type() const { return 0; } virtual uint32_t type() const { return 0; }
virtual vluint32_t size() const { return 0; } virtual uint32_t size() const { return 0; }
virtual const VerilatedRange* rangep() const { return nullptr; } virtual const VerilatedRange* rangep() const { return nullptr; }
virtual vpiHandle dovpi_scan() { return nullptr; } virtual vpiHandle dovpi_scan() { return nullptr; }
virtual PLI_INT32 dovpi_remove_cb() { return 0; } virtual PLI_INT32 dovpi_remove_cb() { return 0; }
@ -127,52 +127,52 @@ public:
class VerilatedVpioTimedCb final : public VerilatedVpio { class VerilatedVpioTimedCb final : public VerilatedVpio {
// A handle to a timed callback created with vpi_register_cb // A handle to a timed callback created with vpi_register_cb
// User can call vpi_remove_cb or vpi_release_handle on it // User can call vpi_remove_cb or vpi_release_handle on it
const vluint64_t m_id; // Unique id/sequence number to find schedule's event const uint64_t m_id; // Unique id/sequence number to find schedule's event
const QData m_time; const QData m_time;
public: public:
VerilatedVpioTimedCb(vluint64_t id, QData time) VerilatedVpioTimedCb(uint64_t id, QData time)
: m_id{id} : m_id{id}
, m_time{time} {} , m_time{time} {}
virtual ~VerilatedVpioTimedCb() override = default; virtual ~VerilatedVpioTimedCb() override = default;
static VerilatedVpioTimedCb* castp(vpiHandle h) { static VerilatedVpioTimedCb* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioTimedCb*>(reinterpret_cast<VerilatedVpioTimedCb*>(h)); return dynamic_cast<VerilatedVpioTimedCb*>(reinterpret_cast<VerilatedVpioTimedCb*>(h));
} }
virtual vluint32_t type() const override { return vpiCallback; } virtual uint32_t type() const override { return vpiCallback; }
virtual PLI_INT32 dovpi_remove_cb() override; virtual PLI_INT32 dovpi_remove_cb() override;
}; };
class VerilatedVpioReasonCb final : public VerilatedVpio { class VerilatedVpioReasonCb final : public VerilatedVpio {
// A handle to a non-timed callback created with vpi_register_cb // A handle to a non-timed callback created with vpi_register_cb
// User can call vpi_remove_cb or vpi_release_handle on it // User can call vpi_remove_cb or vpi_release_handle on it
const vluint64_t m_id; // Unique id/sequence number to find schedule's event const uint64_t m_id; // Unique id/sequence number to find schedule's event
const PLI_INT32 m_reason; // VPI callback reason code const PLI_INT32 m_reason; // VPI callback reason code
public: public:
// cppcheck-suppress uninitVar // m_value // cppcheck-suppress uninitVar // m_value
VerilatedVpioReasonCb(vluint64_t id, PLI_INT32 reason) VerilatedVpioReasonCb(uint64_t id, PLI_INT32 reason)
: m_id{id} : m_id{id}
, m_reason{reason} {} , m_reason{reason} {}
virtual ~VerilatedVpioReasonCb() override = default; virtual ~VerilatedVpioReasonCb() override = default;
static VerilatedVpioReasonCb* castp(vpiHandle h) { static VerilatedVpioReasonCb* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioReasonCb*>(reinterpret_cast<VerilatedVpioReasonCb*>(h)); return dynamic_cast<VerilatedVpioReasonCb*>(reinterpret_cast<VerilatedVpioReasonCb*>(h));
} }
virtual vluint32_t type() const override { return vpiCallback; } virtual uint32_t type() const override { return vpiCallback; }
virtual PLI_INT32 dovpi_remove_cb() override; virtual PLI_INT32 dovpi_remove_cb() override;
}; };
class VerilatedVpioConst final : public VerilatedVpio { class VerilatedVpioConst final : public VerilatedVpio {
const vlsint32_t m_num; const int32_t m_num;
public: public:
explicit VerilatedVpioConst(vlsint32_t num) explicit VerilatedVpioConst(int32_t num)
: m_num{num} {} : m_num{num} {}
virtual ~VerilatedVpioConst() override = default; virtual ~VerilatedVpioConst() override = default;
static VerilatedVpioConst* castp(vpiHandle h) { static VerilatedVpioConst* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioConst*>(reinterpret_cast<VerilatedVpio*>(h)); return dynamic_cast<VerilatedVpioConst*>(reinterpret_cast<VerilatedVpio*>(h));
} }
virtual vluint32_t type() const override { return vpiConstant; } virtual uint32_t type() const override { return vpiConstant; }
vlsint32_t num() const { return m_num; } int32_t num() const { return m_num; }
}; };
class VerilatedVpioVarBase VL_NOT_FINAL : public VerilatedVpio { class VerilatedVpioVarBase VL_NOT_FINAL : public VerilatedVpio {
@ -199,7 +199,7 @@ public:
} }
const VerilatedVar* varp() const { return m_varp; } const VerilatedVar* varp() const { return m_varp; }
const VerilatedScope* scopep() const { return m_scopep; } const VerilatedScope* scopep() const { return m_scopep; }
virtual vluint32_t size() const override { return get_range().elements(); } virtual uint32_t size() const override { return get_range().elements(); }
virtual const VerilatedRange* rangep() const override { return &get_range(); } virtual const VerilatedRange* rangep() const override { return &get_range(); }
virtual const char* name() const override { return m_varp->name(); } virtual const char* name() const override { return m_varp->name(); }
virtual const char* fullname() const override { virtual const char* fullname() const override {
@ -218,7 +218,7 @@ public:
static VerilatedVpioParam* castp(vpiHandle h) { static VerilatedVpioParam* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioParam*>(reinterpret_cast<VerilatedVpio*>(h)); return dynamic_cast<VerilatedVpioParam*>(reinterpret_cast<VerilatedVpio*>(h));
} }
virtual vluint32_t type() const override { return vpiParameter; } virtual uint32_t type() const override { return vpiParameter; }
void* varDatap() const { return m_varp->datap(); } void* varDatap() const { return m_varp->datap(); }
}; };
@ -232,8 +232,8 @@ public:
static VerilatedVpioRange* castp(vpiHandle h) { static VerilatedVpioRange* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioRange*>(reinterpret_cast<VerilatedVpio*>(h)); return dynamic_cast<VerilatedVpioRange*>(reinterpret_cast<VerilatedVpio*>(h));
} }
virtual vluint32_t type() const override { return vpiRange; } virtual uint32_t type() const override { return vpiRange; }
virtual vluint32_t size() const override { return m_range->elements(); } virtual uint32_t size() const override { return m_range->elements(); }
virtual const VerilatedRange* rangep() const override { return m_range; } virtual const VerilatedRange* rangep() const override { return m_range; }
}; };
@ -249,7 +249,7 @@ public:
static VerilatedVpioRangeIter* castp(vpiHandle h) { static VerilatedVpioRangeIter* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioRangeIter*>(reinterpret_cast<VerilatedVpio*>(h)); return dynamic_cast<VerilatedVpioRangeIter*>(reinterpret_cast<VerilatedVpio*>(h));
} }
virtual vluint32_t type() const override { return vpiIterator; } virtual uint32_t type() const override { return vpiIterator; }
virtual vpiHandle dovpi_scan() override { virtual vpiHandle dovpi_scan() override {
if (VL_UNLIKELY(m_done)) { if (VL_UNLIKELY(m_done)) {
delete this; // IEEE 37.2.2 vpi_scan at end does a vpi_release_handle delete this; // IEEE 37.2.2 vpi_scan at end does a vpi_release_handle
@ -271,22 +271,22 @@ public:
static VerilatedVpioScope* castp(vpiHandle h) { static VerilatedVpioScope* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioScope*>(reinterpret_cast<VerilatedVpio*>(h)); return dynamic_cast<VerilatedVpioScope*>(reinterpret_cast<VerilatedVpio*>(h));
} }
virtual vluint32_t type() const override { return vpiScope; } virtual uint32_t type() const override { return vpiScope; }
const VerilatedScope* scopep() const { return m_scopep; } const VerilatedScope* scopep() const { return m_scopep; }
virtual const char* name() const override { return m_scopep->name(); } virtual const char* name() const override { return m_scopep->name(); }
virtual const char* fullname() const override { return m_scopep->name(); } virtual const char* fullname() const override { return m_scopep->name(); }
}; };
class VerilatedVpioVar VL_NOT_FINAL : public VerilatedVpioVarBase { class VerilatedVpioVar VL_NOT_FINAL : public VerilatedVpioVarBase {
vluint8_t* m_prevDatap = nullptr; // Previous value of data, for cbValueChange uint8_t* m_prevDatap = nullptr; // Previous value of data, for cbValueChange
union { union {
vluint8_t u8[4]; uint8_t u8[4];
vluint32_t u32; uint32_t u32;
} m_mask; // memoized variable mask } m_mask; // memoized variable mask
vluint32_t m_entSize = 0; // memoized variable size uint32_t m_entSize = 0; // memoized variable size
protected: protected:
void* m_varDatap = nullptr; // varp()->datap() adjusted for array entries void* m_varDatap = nullptr; // varp()->datap() adjusted for array entries
vlsint32_t m_index = 0; int32_t m_index = 0;
public: public:
VerilatedVpioVar(const VerilatedVar* varp, const VerilatedScope* scopep) VerilatedVpioVar(const VerilatedVar* varp, const VerilatedScope* scopep)
@ -313,18 +313,18 @@ public:
static VerilatedVpioVar* castp(vpiHandle h) { static VerilatedVpioVar* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioVar*>(reinterpret_cast<VerilatedVpio*>(h)); return dynamic_cast<VerilatedVpioVar*>(reinterpret_cast<VerilatedVpio*>(h));
} }
vluint32_t mask() const { return m_mask.u32; } uint32_t mask() const { return m_mask.u32; }
vluint8_t mask_byte(int idx) const { return m_mask.u8[idx & 3]; } uint8_t mask_byte(int idx) const { return m_mask.u8[idx & 3]; }
vluint32_t entSize() const { return m_entSize; } uint32_t entSize() const { return m_entSize; }
vluint32_t index() const { return m_index; } uint32_t index() const { return m_index; }
virtual vluint32_t type() const override { virtual uint32_t type() const override {
return (varp()->dims() > 1) ? vpiMemory : vpiReg; // but might be wire, logic return (varp()->dims() > 1) ? vpiMemory : vpiReg; // but might be wire, logic
} }
void* prevDatap() const { return m_prevDatap; } void* prevDatap() const { return m_prevDatap; }
void* varDatap() const { return m_varDatap; } void* varDatap() const { return m_varDatap; }
void createPrevDatap() { void createPrevDatap() {
if (VL_UNLIKELY(!m_prevDatap)) { if (VL_UNLIKELY(!m_prevDatap)) {
m_prevDatap = new vluint8_t[entSize()]; m_prevDatap = new uint8_t[entSize()];
std::memcpy(prevDatap(), varp()->datap(), entSize()); std::memcpy(prevDatap(), varp()->datap(), entSize());
} }
} }
@ -332,18 +332,18 @@ public:
class VerilatedVpioMemoryWord final : public VerilatedVpioVar { class VerilatedVpioMemoryWord final : public VerilatedVpioVar {
public: public:
VerilatedVpioMemoryWord(const VerilatedVar* varp, const VerilatedScope* scopep, VerilatedVpioMemoryWord(const VerilatedVar* varp, const VerilatedScope* scopep, int32_t index,
vlsint32_t index, int offset) int offset)
: VerilatedVpioVar{varp, scopep} { : VerilatedVpioVar{varp, scopep} {
m_index = index; m_index = index;
m_varDatap = (static_cast<vluint8_t*>(varp->datap())) + entSize() * offset; m_varDatap = (static_cast<uint8_t*>(varp->datap())) + entSize() * offset;
} }
virtual ~VerilatedVpioMemoryWord() override = default; virtual ~VerilatedVpioMemoryWord() override = default;
static VerilatedVpioMemoryWord* castp(vpiHandle h) { static VerilatedVpioMemoryWord* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioMemoryWord*>(reinterpret_cast<VerilatedVpio*>(h)); return dynamic_cast<VerilatedVpioMemoryWord*>(reinterpret_cast<VerilatedVpio*>(h));
} }
virtual vluint32_t type() const override { return vpiMemoryWord; } virtual uint32_t type() const override { return vpiMemoryWord; }
virtual vluint32_t size() const override { return varp()->packed().elements(); } virtual uint32_t size() const override { return varp()->packed().elements(); }
virtual const VerilatedRange* rangep() const override { return &(varp()->packed()); } virtual const VerilatedRange* rangep() const override { return &(varp()->packed()); }
virtual const char* fullname() const override { virtual const char* fullname() const override {
static VL_THREAD_LOCAL std::string t_out; static VL_THREAD_LOCAL std::string t_out;
@ -367,7 +367,7 @@ public:
static VerilatedVpioVarIter* castp(vpiHandle h) { static VerilatedVpioVarIter* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioVarIter*>(reinterpret_cast<VerilatedVpio*>(h)); return dynamic_cast<VerilatedVpioVarIter*>(reinterpret_cast<VerilatedVpio*>(h));
} }
virtual vluint32_t type() const override { return vpiIterator; } virtual uint32_t type() const override { return vpiIterator; }
virtual vpiHandle dovpi_scan() override { virtual vpiHandle dovpi_scan() override {
if (VL_LIKELY(m_scopep->varsp())) { if (VL_LIKELY(m_scopep->varsp())) {
const VerilatedVarNameMap* const varsp = m_scopep->varsp(); const VerilatedVarNameMap* const varsp = m_scopep->varsp();
@ -394,8 +394,8 @@ public:
class VerilatedVpioMemoryWordIter final : public VerilatedVpio { class VerilatedVpioMemoryWordIter final : public VerilatedVpio {
const vpiHandle m_handle; const vpiHandle m_handle;
const VerilatedVar* const m_varp; const VerilatedVar* const m_varp;
vlsint32_t m_iteration; int32_t m_iteration;
const vlsint32_t m_direction; const int32_t m_direction;
bool m_done = false; bool m_done = false;
public: public:
@ -408,7 +408,7 @@ public:
static VerilatedVpioMemoryWordIter* castp(vpiHandle h) { static VerilatedVpioMemoryWordIter* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioMemoryWordIter*>(reinterpret_cast<VerilatedVpio*>(h)); return dynamic_cast<VerilatedVpioMemoryWordIter*>(reinterpret_cast<VerilatedVpio*>(h));
} }
virtual vluint32_t type() const override { return vpiIterator; } virtual uint32_t type() const override { return vpiIterator; }
void iterationInc() { void iterationInc() {
if (!(m_done = (m_iteration == m_varp->unpacked().left()))) m_iteration += m_direction; if (!(m_done = (m_iteration == m_varp->unpacked().left()))) m_iteration += m_direction;
} }
@ -437,7 +437,7 @@ public:
static VerilatedVpioModule* castp(vpiHandle h) { static VerilatedVpioModule* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioModule*>(reinterpret_cast<VerilatedVpio*>(h)); return dynamic_cast<VerilatedVpioModule*>(reinterpret_cast<VerilatedVpio*>(h));
} }
virtual vluint32_t type() const override { return vpiModule; } virtual uint32_t type() const override { return vpiModule; }
virtual const char* name() const override { return m_name; } virtual const char* name() const override { return m_name; }
virtual const char* fullname() const override { return m_fullname; } virtual const char* fullname() const override { return m_fullname; }
}; };
@ -455,7 +455,7 @@ public:
static VerilatedVpioModuleIter* castp(vpiHandle h) { static VerilatedVpioModuleIter* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioModuleIter*>(reinterpret_cast<VerilatedVpio*>(h)); return dynamic_cast<VerilatedVpioModuleIter*>(reinterpret_cast<VerilatedVpio*>(h));
} }
virtual vluint32_t type() const override { return vpiIterator; } virtual uint32_t type() const override { return vpiIterator; }
virtual vpiHandle dovpi_scan() override { virtual vpiHandle dovpi_scan() override {
if (m_it == m_vec->end()) { if (m_it == m_vec->end()) {
delete this; // IEEE 37.2.2 vpi_scan at end does a vpi_release_handle delete this; // IEEE 37.2.2 vpi_scan at end does a vpi_release_handle
@ -472,14 +472,14 @@ using VerilatedPliCb = PLI_INT32 (*)(struct t_cb_data*);
class VerilatedVpiCbHolder final { class VerilatedVpiCbHolder final {
// Holds information needed to call a callback // Holds information needed to call a callback
vluint64_t m_id; uint64_t m_id;
s_cb_data m_cbData; s_cb_data m_cbData;
s_vpi_value m_value; s_vpi_value m_value;
VerilatedVpioVar m_varo; // If a cbValueChange callback, the object we will return VerilatedVpioVar m_varo; // If a cbValueChange callback, the object we will return
public: public:
// cppcheck-suppress uninitVar // m_value // cppcheck-suppress uninitVar // m_value
VerilatedVpiCbHolder(vluint64_t id, const s_cb_data* cbDatap, const VerilatedVpioVar* varop) VerilatedVpiCbHolder(uint64_t id, const s_cb_data* cbDatap, const VerilatedVpioVar* varop)
: m_id{id} : m_id{id}
, m_cbData{*cbDatap} , m_cbData{*cbDatap}
, m_varo{varop} { , m_varo{varop} {
@ -495,15 +495,15 @@ public:
~VerilatedVpiCbHolder() = default; ~VerilatedVpiCbHolder() = default;
VerilatedPliCb cb_rtnp() const { return m_cbData.cb_rtn; } VerilatedPliCb cb_rtnp() const { return m_cbData.cb_rtn; }
s_cb_data* cb_datap() { return &m_cbData; } s_cb_data* cb_datap() { return &m_cbData; }
vluint64_t id() const { return m_id; } uint64_t id() const { return m_id; }
bool invalid() const { return !m_id; } bool invalid() const { return !m_id; }
void invalidate() { m_id = 0; } void invalidate() { m_id = 0; }
}; };
struct VerilatedVpiTimedCbsCmp { struct VerilatedVpiTimedCbsCmp {
// Ordering sets keyed by time, then callback unique id // Ordering sets keyed by time, then callback unique id
bool operator()(const std::pair<QData, vluint64_t>& a, bool operator()(const std::pair<QData, uint64_t>& a,
const std::pair<QData, vluint64_t>& b) const { const std::pair<QData, uint64_t>& b) const {
if (a.first < b.first) return true; if (a.first < b.first) return true;
if (a.first > b.first) return false; if (a.first > b.first) return false;
return a.second < b.second; return a.second < b.second;
@ -515,14 +515,14 @@ class VerilatedVpiError;
class VerilatedVpiImp final { class VerilatedVpiImp final {
enum { CB_ENUM_MAX_VALUE = cbAtEndOfSimTime + 1 }; // Maxium callback reason enum { CB_ENUM_MAX_VALUE = cbAtEndOfSimTime + 1 }; // Maxium callback reason
using VpioCbList = std::list<VerilatedVpiCbHolder>; using VpioCbList = std::list<VerilatedVpiCbHolder>;
using VpioTimedCbs = std::map<std::pair<QData, vluint64_t>, VerilatedVpiCbHolder>; using VpioTimedCbs = std::map<std::pair<QData, uint64_t>, VerilatedVpiCbHolder>;
// All only medium-speed, so use singleton function // All only medium-speed, so use singleton function
VpioCbList m_cbObjLists[CB_ENUM_MAX_VALUE]; // Callbacks for each supported reason VpioCbList m_cbObjLists[CB_ENUM_MAX_VALUE]; // Callbacks for each supported reason
VpioTimedCbs m_timedCbs; // Time based callbacks VpioTimedCbs m_timedCbs; // Time based callbacks
VerilatedVpiError* m_errorInfop = nullptr; // Container for vpi error info VerilatedVpiError* m_errorInfop = nullptr; // Container for vpi error info
VerilatedAssertOneThread m_assertOne; // Assert only called from single thread VerilatedAssertOneThread m_assertOne; // Assert only called from single thread
vluint64_t m_nextCallbackId = 1; // Id to identify callback uint64_t m_nextCallbackId = 1; // Id to identify callback
static VerilatedVpiImp& s() { // Singleton static VerilatedVpiImp& s() { // Singleton
static VerilatedVpiImp s_s; static VerilatedVpiImp s_s;
@ -531,9 +531,9 @@ class VerilatedVpiImp final {
public: public:
static void assertOneCheck() { s().m_assertOne.check(); } static void assertOneCheck() { s().m_assertOne.check(); }
static vluint64_t nextCallbackId() { return ++s().m_nextCallbackId; } static uint64_t nextCallbackId() { return ++s().m_nextCallbackId; }
static void cbReasonAdd(vluint64_t id, const s_cb_data* cb_data_p) { static void cbReasonAdd(uint64_t id, const s_cb_data* cb_data_p) {
// The passed cb_data_p was property of the user, so need to recreate // The passed cb_data_p was property of the user, so need to recreate
if (VL_UNCOVERABLE(cb_data_p->reason >= CB_ENUM_MAX_VALUE)) { if (VL_UNCOVERABLE(cb_data_p->reason >= CB_ENUM_MAX_VALUE)) {
VL_FATAL_MT(__FILE__, __LINE__, "", "vpi bb reason too large"); VL_FATAL_MT(__FILE__, __LINE__, "", "vpi bb reason too large");
@ -544,7 +544,7 @@ public:
if (cb_data_p->reason == cbValueChange) varop = VerilatedVpioVar::castp(cb_data_p->obj); if (cb_data_p->reason == cbValueChange) varop = VerilatedVpioVar::castp(cb_data_p->obj);
s().m_cbObjLists[cb_data_p->reason].emplace_back(id, cb_data_p, varop); s().m_cbObjLists[cb_data_p->reason].emplace_back(id, cb_data_p, varop);
} }
static void cbTimedAdd(vluint64_t id, const s_cb_data* cb_data_p, QData time) { static void cbTimedAdd(uint64_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 // 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=%" PRId64 VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: vpi_register_cb reason=%d id=%" PRId64
" delay=%" PRIu64 "\n", " delay=%" PRIu64 "\n",
@ -553,7 +553,7 @@ public:
std::forward_as_tuple(std::make_pair(time, id)), std::forward_as_tuple(std::make_pair(time, id)),
std::forward_as_tuple(id, cb_data_p, nullptr)); std::forward_as_tuple(id, cb_data_p, nullptr));
} }
static void cbReasonRemove(vluint64_t id, vluint32_t reason) { static void cbReasonRemove(uint64_t id, uint32_t reason) {
// Id might no longer exist, if already removed due to call after event, or teardown // Id might no longer exist, if already removed due to call after event, or teardown
VpioCbList& cbObjList = s().m_cbObjLists[reason]; VpioCbList& cbObjList = s().m_cbObjLists[reason];
// We do not remove it now as we may be iterating the list, // We do not remove it now as we may be iterating the list,
@ -562,7 +562,7 @@ public:
if (ir.id() == id) ir.invalidate(); if (ir.id() == id) ir.invalidate();
} }
} }
static void cbTimedRemove(vluint64_t id, QData time) { static void cbTimedRemove(uint64_t id, QData time) {
// Id might no longer exist, if already removed due to call after event, or teardown // Id might no longer exist, if already removed due to call after event, or teardown
const auto it = s().m_timedCbs.find(std::make_pair(time, id)); const auto it = s().m_timedCbs.find(std::make_pair(time, id));
if (VL_LIKELY(it != s().m_timedCbs.end())) it->second.invalidate(); if (VL_LIKELY(it != s().m_timedCbs.end())) it->second.invalidate();
@ -592,7 +592,7 @@ public:
if (VL_LIKELY(it != s().m_timedCbs.cend())) return it->first.first; if (VL_LIKELY(it != s().m_timedCbs.cend())) return it->first.first;
return ~0ULL; // maxquad return ~0ULL; // maxquad
} }
static bool callCbs(const vluint32_t reason) VL_MT_UNSAFE_ONE { static bool callCbs(const uint32_t reason) VL_MT_UNSAFE_ONE {
VpioCbList& cbObjList = s().m_cbObjLists[reason]; VpioCbList& cbObjList = s().m_cbObjLists[reason];
bool called = false; bool called = false;
if (cbObjList.empty()) return called; if (cbObjList.empty()) return called;
@ -664,7 +664,7 @@ public:
// Statics // Statics
// Internal note: Globals may multi-construct, see verilated.cpp top. // Internal note: Globals may multi-construct, see verilated.cpp top.
VL_THREAD_LOCAL vluint8_t* VerilatedVpio::t_freeHead = nullptr; VL_THREAD_LOCAL uint8_t* VerilatedVpio::t_freeHead = nullptr;
//====================================================================== //======================================================================
// VerilatedVpiError // VerilatedVpiError
@ -744,7 +744,7 @@ void VerilatedVpi::callTimedCbs() VL_MT_UNSAFE_ONE { VerilatedVpiImp::callTimedC
bool VerilatedVpi::callValueCbs() VL_MT_UNSAFE_ONE { return VerilatedVpiImp::callValueCbs(); } bool VerilatedVpi::callValueCbs() VL_MT_UNSAFE_ONE { return VerilatedVpiImp::callValueCbs(); }
bool VerilatedVpi::callCbs(vluint32_t reason) VL_MT_UNSAFE_ONE { bool VerilatedVpi::callCbs(uint32_t reason) VL_MT_UNSAFE_ONE {
return VerilatedVpiImp::callCbs(reason); return VerilatedVpiImp::callCbs(reason);
} }
@ -1309,7 +1309,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);
const QData abstime = VL_TIME_Q() + time; const QData abstime = VL_TIME_Q() + time;
const vluint64_t id = VerilatedVpiImp::nextCallbackId(); const uint64_t id = VerilatedVpiImp::nextCallbackId();
VerilatedVpioTimedCb* const vop = new VerilatedVpioTimedCb{id, abstime}; VerilatedVpioTimedCb* const vop = new VerilatedVpioTimedCb{id, abstime};
VerilatedVpiImp::cbTimedAdd(id, cb_data_p, abstime); VerilatedVpiImp::cbTimedAdd(id, cb_data_p, abstime);
return vop->castVpiHandle(); return vop->castVpiHandle();
@ -1324,7 +1324,7 @@ vpiHandle vpi_register_cb(p_cb_data cb_data_p) {
case cbEnterInteractive: // FALLTHRU // NOP, but need to return handle, so make object case cbEnterInteractive: // FALLTHRU // NOP, but need to return handle, so make object
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
const vluint64_t id = VerilatedVpiImp::nextCallbackId(); const uint64_t id = VerilatedVpiImp::nextCallbackId();
VerilatedVpioReasonCb* const vop = new VerilatedVpioReasonCb{id, cb_data_p->reason}; VerilatedVpioReasonCb* const vop = new VerilatedVpioReasonCb{id, cb_data_p->reason};
VerilatedVpiImp::cbReasonAdd(id, cb_data_p); VerilatedVpiImp::cbReasonAdd(id, cb_data_p);
return vop->castVpiHandle(); return vop->castVpiHandle();
@ -1474,7 +1474,7 @@ vpiHandle vpi_handle(PLI_INT32 type, vpiHandle object) {
case vpiIndex: { case vpiIndex: {
const VerilatedVpioVar* const vop = VerilatedVpioVar::castp(object); const VerilatedVpioVar* const vop = VerilatedVpioVar::castp(object);
if (VL_UNLIKELY(!vop)) return nullptr; if (VL_UNLIKELY(!vop)) return nullptr;
const vlsint32_t val = vop->index(); const int32_t val = vop->index();
return (new VerilatedVpioConst{val})->castVpiHandle(); return (new VerilatedVpioConst{val})->castVpiHandle();
} }
case vpiScope: { case vpiScope: {
@ -1996,7 +1996,7 @@ vpiHandle vpi_put_value(vpiHandle object, p_vpi_value valuep, p_vpi_time /*time_
for (int i = 0; i < chars; ++i) { for (int i = 0; i < chars; ++i) {
union { union {
char byte[2]; char byte[2];
vluint16_t half; uint16_t half;
} val; } val;
idx = div(i * 3, 8); idx = div(i * 3, 8);
if (i < len) { if (i < len) {

View File

@ -47,7 +47,7 @@ public:
static bool callValueCbs() VL_MT_UNSAFE_ONE; static bool callValueCbs() VL_MT_UNSAFE_ONE;
/// Call callbacks of arbitrary types. /// Call callbacks of arbitrary types.
/// User wrapper code should call this from their main loops. /// User wrapper code should call this from their main loops.
static bool callCbs(const vluint32_t reason) VL_MT_UNSAFE_ONE; static bool callCbs(const uint32_t reason) VL_MT_UNSAFE_ONE;
/// Returns time of the next registered VPI callback, or /// Returns time of the next registered VPI callback, or
/// ~(0ULL) if none are registered /// ~(0ULL) if none are registered
static QData cbNextDeadline() VL_MT_UNSAFE_ONE; static QData cbNextDeadline() VL_MT_UNSAFE_ONE;

View File

@ -282,6 +282,7 @@ void __gcov_flush(); // gcc sources gcc/gcov-io.h has the prototype
#include <cstdint> #include <cstdint>
#include <cinttypes> #include <cinttypes>
#ifndef VL_NO_LEGACY
using vluint8_t = uint8_t; ///< 8-bit unsigned type (backward compatibility) using vluint8_t = uint8_t; ///< 8-bit unsigned type (backward compatibility)
using vluint16_t = uint16_t; ///< 16-bit unsigned type (backward compatibility) using vluint16_t = uint16_t; ///< 16-bit unsigned type (backward compatibility)
using vluint32_t = uint32_t; ///< 32-bit unsigned type (backward compatibility) using vluint32_t = uint32_t; ///< 32-bit unsigned type (backward compatibility)
@ -290,6 +291,7 @@ using vlsint8_t = int8_t; ///< 8-bit signed type (backward compatibility)
using vlsint16_t = int16_t; ///< 16-bit signed type (backward compatibility) using vlsint16_t = int16_t; ///< 16-bit signed type (backward compatibility)
using vlsint32_t = int32_t; ///< 32-bit signed type (backward compatibility) using vlsint32_t = int32_t; ///< 32-bit signed type (backward compatibility)
using vlsint64_t = int64_t; ///< 64-bit signed type (backward compatibility) using vlsint64_t = int64_t; ///< 64-bit signed type (backward compatibility)
#endif
#if defined(__CYGWIN__) #if defined(__CYGWIN__)
@ -320,12 +322,12 @@ using ssize_t = uint32_t; ///< signed size_t; returned from read()
// Deprecated, favor C++11's PRIx64, etc, instead // Deprecated, favor C++11's PRIx64, etc, instead
#ifndef VL_NO_LEGACY #ifndef VL_NO_LEGACY
# ifdef _MSC_VER # ifdef _MSC_VER
# define VL_PRI64 "I64" ///< print a vluint64_t (backward compatibility) # define VL_PRI64 "I64" ///< print a uint64_t (backward compatibility)
# else // use standard C99 format specifiers # else // use standard C99 format specifiers
# if defined(__WORDSIZE) && (__WORDSIZE == 64) # if defined(__WORDSIZE) && (__WORDSIZE == 64)
# define VL_PRI64 "l" ///< print a vluint64_t (backward compatibility) # define VL_PRI64 "l" ///< print a uint64_t (backward compatibility)
# else # else
# define VL_PRI64 "ll" ///< print a vluint64_t (backward compatibility) # define VL_PRI64 "ll" ///< print a uint64_t (backward compatibility)
# endif # endif
# endif # endif
#endif #endif
@ -436,13 +438,13 @@ using ssize_t = uint32_t; ///< signed size_t; returned from read()
// Performance counters // Performance counters
#if defined(__i386__) || defined(__x86_64__) #if defined(__i386__) || defined(__x86_64__)
// The vluint64_t argument is loaded with a high-performance counter for profiling // The uint64_t argument is loaded with a high-performance counter for profiling
// or 0x0 if not implemented on this platform // or 0x0 if not implemented on this platform
#define VL_GET_CPU_TICK(val) \ #define VL_GET_CPU_TICK(val) \
{ \ { \
vluint32_t hi, lo; \ uint32_t hi, lo; \
asm volatile("rdtsc" : "=a"(lo), "=d"(hi)); \ asm volatile("rdtsc" : "=a"(lo), "=d"(hi)); \
(val) = ((vluint64_t)lo) | (((vluint64_t)hi) << 32); \ (val) = ((uint64_t)lo) | (((uint64_t)hi) << 32); \
} }
#elif defined(__aarch64__) #elif defined(__aarch64__)
// 1 GHz virtual system timer on SBSA level 5 compliant systems, else often 100 MHz // 1 GHz virtual system timer on SBSA level 5 compliant systems, else often 100 MHz

View File

@ -30,8 +30,8 @@
//====================================================================== //======================================================================
// Statics // Statics
vluint64_t AstNode::s_editCntLast = 0; uint64_t AstNode::s_editCntLast = 0;
vluint64_t AstNode::s_editCntGbl = 0; // Hot cache line uint64_t AstNode::s_editCntGbl = 0; // Hot cache line
// 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
@ -114,7 +114,7 @@ string AstNode::encodeName(const string& namein) {
return vname.hashedName(); return vname.hashedName();
} }
string AstNode::encodeNumber(vlsint64_t num) { string AstNode::encodeNumber(int64_t num) {
if (num < 0) { if (num < 0) {
return "__02D" + cvtToStr(-num); // 2D=- return "__02D" + cvtToStr(-num); // 2D=-
} else { } else {

View File

@ -83,7 +83,7 @@ using MTaskIdSet = std::set<int>; // Set of mtaskIds for Var sorting
#define VN_AS(nodep, nodetypename) (AstNode::privateAs<Ast##nodetypename, decltype(nodep)>(nodep)) #define VN_AS(nodep, nodetypename) (AstNode::privateAs<Ast##nodetypename, decltype(nodep)>(nodep))
// (V)erilator (N)ode deleted: Pointer to deleted AstNode (for assertions only) // (V)erilator (N)ode deleted: Pointer to deleted AstNode (for assertions only)
#define VN_DELETED(nodep) VL_UNLIKELY((vluint64_t)(nodep) == 0x1) #define VN_DELETED(nodep) VL_UNLIKELY((uint64_t)(nodep) == 0x1)
//###################################################################### //######################################################################
@ -1398,10 +1398,10 @@ class AstNode VL_NOT_FINAL {
AstNodeDType* m_dtypep = nullptr; // Data type of output or assignment (etc) AstNodeDType* m_dtypep = nullptr; // Data type of output or assignment (etc)
AstNode* m_headtailp; // When at begin/end of list, the opposite end of the list AstNode* m_headtailp; // When at begin/end of list, the opposite end of the list
FileLine* m_fileline; // Where it was declared FileLine* m_fileline; // Where it was declared
vluint64_t m_editCount; // When it was last edited uint64_t m_editCount; // When it was last edited
static vluint64_t s_editCntGbl; // Global edit counter static uint64_t s_editCntGbl; // Global edit counter
// Global edit counter, last value for printing * near node #s // Global edit counter, last value for printing * near node #s
static vluint64_t s_editCntLast; static uint64_t s_editCntLast;
AstNode* m_clonep AstNode* m_clonep
= nullptr; // Pointer to clone of/ source of this module (for *LAST* cloneTree() ONLY) = nullptr; // Pointer to clone of/ source of this module (for *LAST* cloneTree() ONLY)
@ -1559,7 +1559,7 @@ public:
} }
static string static string
encodeName(const string& namein); // Encode user name into internal C representation encodeName(const string& namein); // Encode user name into internal C representation
static string encodeNumber(vlsint64_t num); // Encode number into internal C representation static string encodeNumber(int64_t num); // Encode number into internal C representation
static string vcdName(const string& namein); // Name for printing out to vcd files static string vcdName(const string& namein); // Name for printing out to vcd files
string prettyName() const { return prettyName(name()); } string prettyName() const { return prettyName(name()); }
string prettyNameQ() const { return prettyNameQ(name()); } string prettyNameQ() const { return prettyNameQ(name()); }
@ -1666,12 +1666,12 @@ public:
static void user5ClearTree() { VNUser5InUse::clear(); } // Clear userp()'s across the entire tree static void user5ClearTree() { VNUser5InUse::clear(); } // Clear userp()'s across the entire tree
// clang-format on // clang-format on
vluint64_t editCount() const { return m_editCount; } uint64_t editCount() const { return m_editCount; }
void editCountInc() { void editCountInc() {
m_editCount = ++s_editCntGbl; // Preincrement, so can "watch AstNode::s_editCntGbl=##" m_editCount = ++s_editCntGbl; // Preincrement, so can "watch AstNode::s_editCntGbl=##"
} }
static vluint64_t editCountLast() { return s_editCntLast; } static uint64_t editCountLast() { return s_editCntLast; }
static vluint64_t editCountGbl() { return s_editCntGbl; } static uint64_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

@ -463,7 +463,7 @@ string AstVar::cPubArgType(bool named, bool forReturn) const {
} else if (widthMin() <= VL_IDATASIZE) { } else if (widthMin() <= VL_IDATASIZE) {
arg += "uint32_t"; arg += "uint32_t";
} else if (widthMin() <= VL_QUADSIZE) { } else if (widthMin() <= VL_QUADSIZE) {
arg += "vluint64_t"; arg += "uint64_t";
} else { } else {
arg += "uint32_t"; // []'s added later arg += "uint32_t"; // []'s added later
} }
@ -600,7 +600,7 @@ string AstVar::scType() const {
return "uint32_t"; return "uint32_t";
} }
} else { } else {
return "vluint64_t"; return "uint64_t";
} }
} }
@ -1071,8 +1071,8 @@ static bool sameInit(const AstInitArray* ap, const AstInitArray* bp) {
if (!aDTypep->rangep()->sameTree(bDTypep->rangep())) return false; if (!aDTypep->rangep()->sameTree(bDTypep->rangep())) return false;
// Compare initializer arrays by value. Note this is only called when they hash the same, // Compare initializer arrays by value. Note this is only called when they hash the same,
// so they likely run at most once per call to 'AstConstPool::findTable'. // so they likely run at most once per call to 'AstConstPool::findTable'.
const vluint64_t size = aDTypep->elementsConst(); const uint64_t size = aDTypep->elementsConst();
for (vluint64_t n = 0; n < size; ++n) { for (uint64_t n = 0; n < size; ++n) {
const AstNode* const valAp = ap->getIndexDefaultedValuep(n); const AstNode* const valAp = ap->getIndexDefaultedValuep(n);
const AstNode* const valBp = bp->getIndexDefaultedValuep(n); const AstNode* const valBp = bp->getIndexDefaultedValuep(n);
if (!valAp->sameTree(valBp)) return false; if (!valAp->sameTree(valBp)) return false;

View File

@ -115,14 +115,14 @@ public:
dtypeSetLogicUnsized(32, m_num.widthMin(), VSigning::SIGNED); dtypeSetLogicUnsized(32, m_num.widthMin(), VSigning::SIGNED);
} }
class Unsized64 {}; // for creator type-overload selection class Unsized64 {}; // for creator type-overload selection
AstConst(FileLine* fl, Unsized64, vluint64_t num) AstConst(FileLine* fl, Unsized64, uint64_t num)
: ASTGEN_SUPER_Const(fl) : ASTGEN_SUPER_Const(fl)
, m_num(this, 64, 0) { , m_num(this, 64, 0) {
m_num.setQuad(num); m_num.setQuad(num);
dtypeSetLogicSized(64, VSigning::UNSIGNED); dtypeSetLogicSized(64, VSigning::UNSIGNED);
} }
class SizedEData {}; // for creator type-overload selection class SizedEData {}; // for creator type-overload selection
AstConst(FileLine* fl, SizedEData, vluint64_t num) AstConst(FileLine* fl, SizedEData, uint64_t num)
: ASTGEN_SUPER_Const(fl) : ASTGEN_SUPER_Const(fl)
, m_num(this, VL_EDATASIZE, 0) { , m_num(this, VL_EDATASIZE, 0) {
m_num.setQuad(num); m_num.setQuad(num);
@ -166,8 +166,8 @@ public:
const V3Number& num() const { return m_num; } // * = Value const V3Number& num() const { return m_num; } // * = Value
V3Number& num() { return m_num; } // * = Value V3Number& num() { return m_num; } // * = Value
uint32_t toUInt() const { return num().toUInt(); } uint32_t toUInt() const { return num().toUInt(); }
vlsint32_t toSInt() const { return num().toSInt(); } int32_t toSInt() const { return num().toSInt(); }
vluint64_t toUQuad() const { return num().toUQuad(); } uint64_t toUQuad() const { return num().toUQuad(); }
virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); }
virtual string emitC() override { V3ERROR_NA_RETURN(""); } virtual string emitC() override { V3ERROR_NA_RETURN(""); }
virtual bool cleanOut() const override { return true; } virtual bool cleanOut() const override { return true; }
@ -5019,7 +5019,7 @@ class AstInitArray final : public AstNode {
// Parents: ASTVAR::init() // Parents: ASTVAR::init()
// Children: AstInitItem // Children: AstInitItem
public: public:
using KeyItemMap = std::map<vluint64_t, AstInitItem*>; using KeyItemMap = std::map<uint64_t, AstInitItem*>;
private: private:
KeyItemMap m_map; // Node value for each array index KeyItemMap m_map; // Node value for each array index
@ -5054,7 +5054,7 @@ public:
AstNode* initsp() const { return op2p(); } // op2 = Initial value expressions AstNode* initsp() const { return op2p(); } // op2 = Initial value expressions
void addValuep(AstNode* newp) { addIndexValuep(m_map.size(), newp); } void addValuep(AstNode* newp) { addIndexValuep(m_map.size(), newp); }
const KeyItemMap& map() const { return m_map; } const KeyItemMap& map() const { return m_map; }
AstNode* addIndexValuep(vluint64_t index, AstNode* newp) { AstNode* addIndexValuep(uint64_t index, AstNode* newp) {
// Returns old value, caller must garbage collect // Returns old value, caller must garbage collect
AstNode* oldp = nullptr; AstNode* oldp = nullptr;
const auto it = m_map.find(index); const auto it = m_map.find(index);
@ -5068,7 +5068,7 @@ public:
} }
return oldp; return oldp;
} }
AstNode* getIndexValuep(vluint64_t index) const { AstNode* getIndexValuep(uint64_t index) const {
const auto it = m_map.find(index); const auto it = m_map.find(index);
if (it == m_map.end()) { if (it == m_map.end()) {
return nullptr; return nullptr;
@ -5076,7 +5076,7 @@ public:
return it->second->valuep(); return it->second->valuep();
} }
} }
AstNode* getIndexDefaultedValuep(vluint64_t index) const { AstNode* getIndexDefaultedValuep(uint64_t index) const {
AstNode* valuep = getIndexValuep(index); AstNode* valuep = getIndexValuep(index);
if (!valuep) valuep = defaultp(); if (!valuep) valuep = defaultp();
return valuep; return valuep;

View File

@ -350,7 +350,7 @@ using V3ConfigFileResolver = V3ConfigWildcardResolver<V3ConfigFile>;
class V3ConfigResolver final { class V3ConfigResolver final {
V3ConfigModuleResolver m_modules; // Access to module names (with wildcards) V3ConfigModuleResolver m_modules; // Access to module names (with wildcards)
V3ConfigFileResolver m_files; // Access to file names (with wildcards) V3ConfigFileResolver m_files; // Access to file names (with wildcards)
std::unordered_map<string, std::unordered_map<string, vluint64_t>> std::unordered_map<string, std::unordered_map<string, uint64_t>>
m_profileData; // Access to profile_data records m_profileData; // Access to profile_data records
FileLine* m_profileFileLine = nullptr; FileLine* m_profileFileLine = nullptr;
@ -364,12 +364,12 @@ public:
V3ConfigModuleResolver& modules() { return m_modules; } V3ConfigModuleResolver& modules() { return m_modules; }
V3ConfigFileResolver& files() { return m_files; } V3ConfigFileResolver& files() { return m_files; }
void addProfileData(FileLine* fl, const string& model, const string& key, vluint64_t cost) { void addProfileData(FileLine* fl, const string& model, const string& key, uint64_t cost) {
if (!m_profileFileLine) m_profileFileLine = fl; if (!m_profileFileLine) m_profileFileLine = fl;
if (cost == 0) cost = 1; // Cost 0 means delete (or no data) if (cost == 0) cost = 1; // Cost 0 means delete (or no data)
m_profileData[model][key] += cost; m_profileData[model][key] += cost;
} }
vluint64_t getProfileData(const string& model, const string& key) const { uint64_t getProfileData(const string& model, const string& key) const {
const auto mit = m_profileData.find(model); const auto mit = m_profileData.find(model);
if (mit == m_profileData.cend()) return 0; if (mit == m_profileData.cend()) return 0;
const auto it = mit->second.find(key); const auto it = mit->second.find(key);
@ -430,7 +430,7 @@ void V3Config::addModulePragma(const string& module, VPragmaType pragma) {
} }
void V3Config::addProfileData(FileLine* fl, const string& model, const string& key, void V3Config::addProfileData(FileLine* fl, const string& model, const string& key,
vluint64_t cost) { uint64_t cost) {
V3ConfigResolver::s().addProfileData(fl, model, key, cost); V3ConfigResolver::s().addProfileData(fl, model, key, cost);
} }
@ -534,7 +534,7 @@ void V3Config::applyVarAttr(AstNodeModule* modulep, AstNodeFTask* ftaskp, AstVar
if (vp) vp->apply(varp); if (vp) vp->apply(varp);
} }
vluint64_t V3Config::getProfileData(const string& model, const string& key) { uint64_t V3Config::getProfileData(const string& model, const string& key) {
return V3ConfigResolver::s().getProfileData(model, key); return V3ConfigResolver::s().getProfileData(model, key);
} }
FileLine* V3Config::getProfileDataFileLine() { FileLine* V3Config::getProfileDataFileLine() {

View File

@ -36,7 +36,7 @@ public:
static void addInline(FileLine* fl, const string& module, const string& ftask, bool on); static void addInline(FileLine* fl, const string& module, const string& ftask, bool on);
static void addModulePragma(const string& module, VPragmaType pragma); static void addModulePragma(const string& module, VPragmaType pragma);
static void addProfileData(FileLine* fl, const string& model, const string& key, static void addProfileData(FileLine* fl, const string& model, const string& key,
vluint64_t cost); uint64_t cost);
static void addWaiver(V3ErrorCode code, const string& filename, const string& message); static void addWaiver(V3ErrorCode code, const string& filename, const string& message);
static void addVarAttr(FileLine* fl, const string& module, const string& ftask, static void addVarAttr(FileLine* fl, const string& module, const string& ftask,
const string& signal, VAttrType type, AstSenTree* nodep); const string& signal, VAttrType type, AstSenTree* nodep);
@ -48,7 +48,7 @@ public:
static void applyFTask(AstNodeModule* modulep, AstNodeFTask* ftaskp); static void applyFTask(AstNodeModule* modulep, AstNodeFTask* ftaskp);
static void applyVarAttr(AstNodeModule* modulep, AstNodeFTask* ftaskp, AstVar* varp); static void applyVarAttr(AstNodeModule* modulep, AstNodeFTask* ftaskp, AstVar* varp);
static vluint64_t getProfileData(const string& model, const string& key); static uint64_t getProfileData(const string& model, const string& key);
static FileLine* getProfileDataFileLine(); static FileLine* getProfileDataFileLine();
static bool waive(FileLine* filelinep, V3ErrorCode code, const string& message); static bool waive(FileLine* filelinep, V3ErrorCode code, const string& message);
}; };

View File

@ -73,7 +73,7 @@ protected:
ofp()->putsNoTracking("}"); ofp()->putsNoTracking("}");
} else if (const AstUnpackArrayDType* const dtypep } else if (const AstUnpackArrayDType* const dtypep
= VN_CAST(nodep->dtypep()->skipRefp(), UnpackArrayDType)) { = VN_CAST(nodep->dtypep()->skipRefp(), UnpackArrayDType)) {
const vluint64_t size = dtypep->elementsConst(); const uint64_t size = dtypep->elementsConst();
const uint32_t tabMod = tabModulus(dtypep->subDTypep()); const uint32_t tabMod = tabModulus(dtypep->subDTypep());
// Note the double {{ initializer. The first { starts the initializer of the // Note the double {{ initializer. The first { starts the initializer of the
// VlUnpacked, and the second starts the initializer of m_storage within the // VlUnpacked, and the second starts the initializer of m_storage within the
@ -81,7 +81,7 @@ protected:
puts("{"); puts("{");
ofp()->putsNoTracking("{"); ofp()->putsNoTracking("{");
puts("\n"); puts("\n");
for (vluint64_t n = 0; n < size; ++n) { for (uint64_t n = 0; n < size; ++n) {
m_unpackedWord = n; m_unpackedWord = n;
if (n) puts((n % tabMod) ? ", " : ",\n"); if (n) puts((n % tabMod) ? ", " : ",\n");
iterate(nodep->getIndexDefaultedValuep(n)); iterate(nodep->getIndexDefaultedValuep(n));

View File

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

View File

@ -350,8 +350,8 @@ class EmitCImp final : EmitCFunc {
hash.insert(varp->dtypep()->width()); hash.insert(varp->dtypep()->width());
} }
} }
ofp()->printf("vluint64_t __Vcheckval = 0x%" PRIx64 "ULL;\n", ofp()->printf("uint64_t __Vcheckval = 0x%" PRIx64 "ULL;\n",
static_cast<vluint64_t>(hash.digestUInt64())); static_cast<uint64_t>(hash.digestUInt64()));
if (de) { if (de) {
puts("os.readAssert(__Vcheckval);\n"); puts("os.readAssert(__Vcheckval);\n");
} else { } else {
@ -783,7 +783,7 @@ class EmitCTrace final : EmitCFunc {
AstVar* const varp = varrefp->varp(); AstVar* const varp = varrefp->varp();
puts("("); puts("(");
if (emitTraceIsScBigUint(nodep)) { if (emitTraceIsScBigUint(nodep)) {
puts("(vluint32_t*)"); puts("(uint32_t*)");
} else if (emitTraceIsScBv(nodep)) { } else if (emitTraceIsScBv(nodep)) {
puts("VL_SC_BV_DATAP("); puts("VL_SC_BV_DATAP(");
} }

View File

@ -476,7 +476,7 @@ void EmitCSyms::emitSymHdr() {
if (v3Global.opt.profPgo()) { if (v3Global.opt.profPgo()) {
puts("\n// PGO PROFILING\n"); puts("\n// PGO PROFILING\n");
vluint64_t maxProfilerId = 0; uint64_t maxProfilerId = 0;
if (v3Global.opt.mtasks()) { if (v3Global.opt.mtasks()) {
for (const V3GraphVertex* vxp for (const V3GraphVertex* vxp
= v3Global.rootp()->execGraphp()->depGraphp()->verticesBeginp(); = v3Global.rootp()->execGraphp()->depGraphp()->verticesBeginp();

View File

@ -32,13 +32,13 @@ struct GraphPCNode {
// //
// Unlike the LogicMTasks's, we have no cost info for the generic graph // Unlike the LogicMTasks's, we have no cost info for the generic graph
// accepted by GraphPathChecker, so assume each node has unit cost. // accepted by GraphPathChecker, so assume each node has unit cost.
std::array<vluint32_t, GraphWay::NUM_WAYS> m_cp; std::array<uint32_t, GraphWay::NUM_WAYS> m_cp;
// Detect if we've seen this node before in a given recursive // Detect if we've seen this node before in a given recursive
// operation. We'll use this in pathExistsInternal() to avoid checking // operation. We'll use this in pathExistsInternal() to avoid checking
// the same node twice, and again in updateHalfCriticalPath() to assert // the same node twice, and again in updateHalfCriticalPath() to assert
// there are no cycles. // there are no cycles.
vluint64_t m_seenAtGeneration = 0; uint64_t m_seenAtGeneration = 0;
// CONSTRUCTORS // CONSTRUCTORS
GraphPCNode() { GraphPCNode() {

View File

@ -34,7 +34,7 @@ class GraphPathChecker final : GraphAlg<const V3Graph> {
// the graph. Each node is marked with the last generation that scanned // the graph. Each node is marked with the last generation that scanned
// it, to enable asserting there are no cycles, and to avoid recursing // it, to enable asserting there are no cycles, and to avoid recursing
// through the same node twice while searching for a path. // through the same node twice while searching for a path.
vluint64_t m_generation = 0; uint64_t m_generation = 0;
public: public:
// CONSTRUCTORS // CONSTRUCTORS

View File

@ -302,7 +302,7 @@ private:
virtual void visit(AstNodeAssign* nodep) override { virtual void visit(AstNodeAssign* nodep) override {
// Collect any used variables first, as lhs may also be on rhs // Collect any used variables first, as lhs may also be on rhs
// Similar code in V3Dead // Similar code in V3Dead
const vluint64_t lastEdit = AstNode::editCountGbl(); // When it was last edited const uint64_t lastEdit = AstNode::editCountGbl(); // When it was last edited
m_sideEffect = false; m_sideEffect = false;
iterateAndNextNull(nodep->rhsp()); iterateAndNextNull(nodep->rhsp());
if (lastEdit != AstNode::editCountGbl()) { if (lastEdit != AstNode::editCountGbl()) {

View File

@ -61,7 +61,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*)(((vluint8_t*)newbasep) + offset); return (V3ListEnt*)(((uint8_t*)newbasep) + offset);
} }
public: public:
@ -78,7 +78,7 @@ public:
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
// cppcheck-suppress thisSubtraction // cppcheck-suppress thisSubtraction
const size_t offset = (size_t)(vluint8_t*)(this) - (size_t)(vluint8_t*)(newp); const size_t offset = (size_t)(uint8_t*)(this) - (size_t)(uint8_t*)(newp);
m_nextp = nullptr; m_nextp = nullptr;
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;
@ -88,7 +88,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
// cppcheck-suppress thisSubtraction // cppcheck-suppress thisSubtraction
const size_t offset = (size_t)(vluint8_t*)(this) - (size_t)(vluint8_t*)(newp); const size_t offset = (size_t)(uint8_t*)(this) - (size_t)(uint8_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;
@ -99,7 +99,7 @@ public:
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
// cppcheck-suppress thisSubtraction // cppcheck-suppress thisSubtraction
const size_t offset = (size_t)(vluint8_t*)(this) - (size_t)(vluint8_t*)(oldp); const size_t offset = (size_t)(uint8_t*)(this) - (size_t)(uint8_t*)(oldp);
if (m_nextp) { if (m_nextp) {
baseToListEnt(m_nextp, offset)->m_prevp = m_prevp; baseToListEnt(m_nextp, offset)->m_prevp = m_prevp;
} else { } else {

View File

@ -375,7 +375,7 @@ V3Number& V3Number::setZero() {
for (int i = 0; i < words(); i++) m_value[i] = {0, 0}; for (int i = 0; i < words(); i++) m_value[i] = {0, 0};
return *this; return *this;
} }
V3Number& V3Number::setQuad(vluint64_t value) { V3Number& V3Number::setQuad(uint64_t value) {
for (int i = 0; i < words(); i++) m_value[i] = {0, 0}; for (int i = 0; i < words(); i++) m_value[i] = {0, 0};
m_value[0].m_value = value & 0xffffffffULL; m_value[0].m_value = value & 0xffffffffULL;
if (width() > 32) m_value[1].m_value = (value >> 32ULL) & 0xffffffffULL; if (width() > 32) m_value[1].m_value = (value >> 32ULL) & 0xffffffffULL;
@ -388,11 +388,11 @@ V3Number& V3Number::setLong(uint32_t value) {
opCleanThis(); opCleanThis();
return *this; return *this;
} }
V3Number& V3Number::setLongS(vlsint32_t value) { V3Number& V3Number::setLongS(int32_t value) {
for (int i = 0; i < words(); i++) m_value[i] = {0, 0}; for (int i = 0; i < words(); i++) m_value[i] = {0, 0};
union { union {
uint32_t u; uint32_t u;
vlsint32_t s; int32_t s;
} u; } u;
u.s = value; u.s = value;
if (u.s) {} if (u.s) {}
@ -878,40 +878,40 @@ double V3Number::toDouble() const {
return u.d; return u.d;
} }
vlsint32_t V3Number::toSInt() const { int32_t V3Number::toSInt() const {
if (isSigned()) { if (isSigned()) {
const uint32_t v = toUInt(); const uint32_t v = toUInt();
const uint32_t signExtend = (-(v & (1UL << (width() - 1)))); const uint32_t signExtend = (-(v & (1UL << (width() - 1))));
const uint32_t extended = v | signExtend; const uint32_t extended = v | signExtend;
return static_cast<vlsint32_t>(extended); return static_cast<int32_t>(extended);
} else { } else {
// Where we use this (widths, etc) and care about signedness, // Where we use this (widths, etc) and care about signedness,
// we can reasonably assume the MSB isn't set on unsigned numbers. // we can reasonably assume the MSB isn't set on unsigned numbers.
return static_cast<vlsint32_t>(toUInt()); return static_cast<int32_t>(toUInt());
} }
} }
vluint64_t V3Number::toUQuad() const { uint64_t V3Number::toUQuad() const {
UASSERT(!isFourState(), "toUQuad with 4-state " << *this); UASSERT(!isFourState(), "toUQuad with 4-state " << *this);
// We allow wide numbers that represent values <= 64 bits // We allow wide numbers that represent values <= 64 bits
if (isDouble()) return static_cast<vluint64_t>(toDouble()); if (isDouble()) return static_cast<uint64_t>(toDouble());
for (int i = 2; i < words(); ++i) { for (int i = 2; i < words(); ++i) {
if (m_value[i].m_value) { if (m_value[i].m_value) {
v3error("Value too wide for 64-bits expected in this context " << *this); v3error("Value too wide for 64-bits expected in this context " << *this);
break; break;
} }
} }
if (width() <= 32) return (static_cast<vluint64_t>(toUInt())); if (width() <= 32) return (static_cast<uint64_t>(toUInt()));
return ((static_cast<vluint64_t>(m_value[1].m_value) << 32ULL) return ((static_cast<uint64_t>(m_value[1].m_value) << 32ULL)
| (static_cast<vluint64_t>(m_value[0].m_value))); | (static_cast<uint64_t>(m_value[0].m_value)));
} }
vlsint64_t V3Number::toSQuad() const { int64_t V3Number::toSQuad() const {
if (isDouble()) return static_cast<vlsint64_t>(toDouble()); if (isDouble()) return static_cast<int64_t>(toDouble());
const vluint64_t v = toUQuad(); const uint64_t v = toUQuad();
const vluint64_t signExtend = (-(v & (1ULL << (width() - 1)))); const uint64_t signExtend = (-(v & (1ULL << (width() - 1))));
const vluint64_t extended = v | signExtend; const uint64_t extended = v | signExtend;
return static_cast<vlsint64_t>(extended); return static_cast<int64_t>(extended);
} }
string V3Number::toString() const { string V3Number::toString() const {
@ -1499,15 +1499,15 @@ V3Number& V3Number::opAtoN(const V3Number& lhs, int base) {
errno = 0; errno = 0;
auto v = std::strtol(str.c_str(), nullptr, base); auto v = std::strtol(str.c_str(), nullptr, base);
if (errno != 0) v = 0; if (errno != 0) v = 0;
return setLongS(static_cast<vlsint32_t>(v)); return setLongS(static_cast<int32_t>(v));
} }
V3Number& V3Number::opPutcN(const V3Number& lhs, const V3Number& rhs, const V3Number& ths) { V3Number& V3Number::opPutcN(const V3Number& lhs, const V3Number& rhs, const V3Number& ths) {
NUM_ASSERT_OP_ARGS3(lhs, rhs, ths); NUM_ASSERT_OP_ARGS3(lhs, rhs, ths);
NUM_ASSERT_STRING_ARGS1(lhs); NUM_ASSERT_STRING_ARGS1(lhs);
string lstring = lhs.toString(); string lstring = lhs.toString();
const vlsint32_t i = rhs.toSInt(); const int32_t i = rhs.toSInt();
const vlsint32_t c = ths.toSInt() & 0xFF; const int32_t c = ths.toSInt() & 0xFF;
// 6.16.2:str.putc(i, c) does not change the value when i < 0 || i >= str.len() || c == 0 // 6.16.2:str.putc(i, c) does not change the value when i < 0 || i >= str.len() || c == 0
// when evaluating the second condition, i must be positive. // when evaluating the second condition, i must be positive.
if (0 <= i && static_cast<uint32_t>(i) < lstring.length() && c != 0) lstring[i] = c; if (0 <= i && static_cast<uint32_t>(i) < lstring.length() && c != 0) lstring[i] = c;
@ -1518,8 +1518,8 @@ V3Number& V3Number::opGetcN(const V3Number& lhs, const V3Number& rhs) {
NUM_ASSERT_OP_ARGS2(lhs, rhs); NUM_ASSERT_OP_ARGS2(lhs, rhs);
NUM_ASSERT_STRING_ARGS1(lhs); NUM_ASSERT_STRING_ARGS1(lhs);
const string lstring = lhs.toString(); const string lstring = lhs.toString();
const vlsint32_t i = rhs.toSInt(); const int32_t i = rhs.toSInt();
vlsint32_t v = 0; int32_t v = 0;
// 6.16.3:str.getc(i) returns 0 if i < 0 || i >= str.len() // 6.16.3:str.getc(i) returns 0 if i < 0 || i >= str.len()
// when evaluating the second condition, i must be positive. // when evaluating the second condition, i must be positive.
if (0 <= i && static_cast<uint32_t>(i) < lstring.length()) v = lstring[i]; if (0 <= i && static_cast<uint32_t>(i) < lstring.length()) v = lstring[i];
@ -1530,8 +1530,8 @@ V3Number& V3Number::opSubstrN(const V3Number& lhs, const V3Number& rhs, const V3
NUM_ASSERT_OP_ARGS3(lhs, rhs, ths); NUM_ASSERT_OP_ARGS3(lhs, rhs, ths);
NUM_ASSERT_STRING_ARGS1(lhs); NUM_ASSERT_STRING_ARGS1(lhs);
const string lstring = lhs.toString(); const string lstring = lhs.toString();
const vlsint32_t i = rhs.toSInt(); const int32_t i = rhs.toSInt();
const vlsint32_t j = ths.toSInt(); const int32_t j = ths.toSInt();
// 6.16.8:str.substr(i, j) returns an empty string when i < 0 || j < i || j >= str.len() // 6.16.8:str.substr(i, j) returns an empty string when i < 0 || j < i || j >= str.len()
// when evaluating the third condition, j must be positive because 0 <= i <= j is guaranteed by // when evaluating the third condition, j must be positive because 0 <= i <= j is guaranteed by
// the former two conditions. // the former two conditions.
@ -1837,14 +1837,14 @@ V3Number& V3Number::opMul(const V3Number& lhs, const V3Number& rhs) {
opCleanThis(); // Mult produces extra bits in result opCleanThis(); // Mult produces extra bits in result
} else { } else {
for (int lword = 0; lword < lhs.words(); lword++) { for (int lword = 0; lword < lhs.words(); lword++) {
const vluint64_t lwordval = static_cast<vluint64_t>(lhs.m_value[lword].m_value); const uint64_t lwordval = static_cast<uint64_t>(lhs.m_value[lword].m_value);
if (lwordval == 0) continue; if (lwordval == 0) continue;
for (int rword = 0; rword < rhs.words(); rword++) { for (int rword = 0; rword < rhs.words(); rword++) {
const vluint64_t rwordval = static_cast<vluint64_t>(rhs.m_value[rword].m_value); const uint64_t rwordval = static_cast<uint64_t>(rhs.m_value[rword].m_value);
if (rwordval == 0) continue; if (rwordval == 0) continue;
vluint64_t mul = lwordval * rwordval; uint64_t mul = lwordval * rwordval;
for (int qword = lword + rword; qword < this->words(); qword++) { for (int qword = lword + rword; qword < this->words(); qword++) {
mul += static_cast<vluint64_t>(m_value[qword].m_value); mul += static_cast<uint64_t>(m_value[qword].m_value);
m_value[qword].m_value = (mul & 0xffffffffULL); m_value[qword].m_value = (mul & 0xffffffffULL);
mul = (mul >> 32ULL) & 0xffffffffULL; mul = (mul >> 32ULL) & 0xffffffffULL;
if (mul == 0) break; if (mul == 0) break;
@ -1960,14 +1960,13 @@ V3Number& V3Number::opModDivGuts(const V3Number& lhs, const V3Number& rhs, bool
const int vw = (vmsbp1 + 31) / 32; // aka "n" in the algorithm const int vw = (vmsbp1 + 31) / 32; // aka "n" in the algorithm
if (vw == 1) { // Single divisor word breaks rest of algorithm if (vw == 1) { // Single divisor word breaks rest of algorithm
vluint64_t k = 0; uint64_t k = 0;
for (int j = uw - 1; j >= 0; j--) { for (int j = uw - 1; j >= 0; j--) {
const vluint64_t unw64 const uint64_t unw64 = ((k << 32ULL) + static_cast<uint64_t>(lhs.m_value[j].m_value));
= ((k << 32ULL) + static_cast<vluint64_t>(lhs.m_value[j].m_value)); m_value[j].m_value = unw64 / static_cast<uint64_t>(rhs.m_value[0].m_value);
m_value[j].m_value = unw64 / static_cast<vluint64_t>(rhs.m_value[0].m_value);
k = unw64 k = unw64
- (static_cast<vluint64_t>(m_value[j].m_value) - (static_cast<uint64_t>(m_value[j].m_value)
* static_cast<vluint64_t>(rhs.m_value[0].m_value)); * static_cast<uint64_t>(rhs.m_value[0].m_value));
} }
UINFO(9, " opmoddiv-1w " << lhs << " " << rhs << " q=" << *this << " rem=0x" << std::hex UINFO(9, " opmoddiv-1w " << lhs << " " << rhs << " q=" << *this << " rem=0x" << std::hex
<< k << std::dec << endl); << k << std::dec << endl);
@ -2016,10 +2015,10 @@ V3Number& V3Number::opModDivGuts(const V3Number& lhs, const V3Number& rhs, bool
// Main loop // Main loop
for (int j = uw - vw; j >= 0; j--) { for (int j = uw - vw; j >= 0; j--) {
// Estimate // Estimate
const vluint64_t unw64 = (static_cast<vluint64_t>(un[j + vw]) << 32ULL const uint64_t unw64
| static_cast<vluint64_t>(un[j + vw - 1])); = (static_cast<uint64_t>(un[j + vw]) << 32ULL | static_cast<uint64_t>(un[j + vw - 1]));
vluint64_t qhat = unw64 / static_cast<vluint64_t>(vn[vw - 1]); uint64_t qhat = unw64 / static_cast<uint64_t>(vn[vw - 1]);
vluint64_t rhat = unw64 - qhat * static_cast<vluint64_t>(vn[vw - 1]); uint64_t rhat = unw64 - qhat * static_cast<uint64_t>(vn[vw - 1]);
again: again:
if (qhat >= 0x100000000ULL || ((qhat * vn[vw - 2]) > ((rhat << 32ULL) + un[j + vw - 2]))) { if (qhat >= 0x100000000ULL || ((qhat * vn[vw - 2]) > ((rhat << 32ULL) + un[j + vw - 2]))) {
@ -2028,10 +2027,10 @@ V3Number& V3Number::opModDivGuts(const V3Number& lhs, const V3Number& rhs, bool
if (rhat < 0x100000000ULL) goto again; if (rhat < 0x100000000ULL) goto again;
} }
vlsint64_t t = 0; // Must be signed int64_t t = 0; // Must be signed
vluint64_t k = 0; uint64_t k = 0;
for (int i = 0; i < vw; i++) { for (int i = 0; i < vw; i++) {
const vluint64_t p = qhat * vn[i]; // Multiply by estimate const uint64_t p = qhat * vn[i]; // Multiply by estimate
t = un[i + j] - k - (p & 0xFFFFFFFFULL); // Subtract t = un[i + j] - k - (p & 0xFFFFFFFFULL); // Subtract
un[i + j] = t; un[i + j] = t;
k = (p >> 32ULL) - (t >> 32ULL); k = (p >> 32ULL) - (t >> 32ULL);
@ -2045,7 +2044,7 @@ V3Number& V3Number::opModDivGuts(const V3Number& lhs, const V3Number& rhs, bool
this->m_value[j].m_value--; this->m_value[j].m_value--;
k = 0; k = 0;
for (int i = 0; i < vw; i++) { for (int i = 0; i < vw; i++) {
t = static_cast<vluint64_t>(un[i + j]) + static_cast<vluint64_t>(vn[i]) + k; t = static_cast<uint64_t>(un[i + j]) + static_cast<uint64_t>(vn[i]) + k;
un[i + j] = t; un[i + j] = t;
k = t >> 32ULL; k = t >> 32ULL;
} }
@ -2265,7 +2264,7 @@ V3Number& V3Number::opRToIS(const V3Number& lhs) {
NUM_ASSERT_OP_ARGS1(lhs); NUM_ASSERT_OP_ARGS1(lhs);
NUM_ASSERT_DOUBLE_ARGS1(lhs); NUM_ASSERT_DOUBLE_ARGS1(lhs);
const double v = VL_TRUNC(lhs.toDouble()); const double v = VL_TRUNC(lhs.toDouble());
const vlsint32_t i = static_cast<vlsint32_t>(v); // C converts from double to vlsint32 const int32_t i = static_cast<int32_t>(v); // C converts from double to int32_t
return setLongS(i); return setLongS(i);
} }
V3Number& V3Number::opRToIRoundS(const V3Number& lhs) { V3Number& V3Number::opRToIRoundS(const V3Number& lhs) {
@ -2275,14 +2274,14 @@ V3Number& V3Number::opRToIRoundS(const V3Number& lhs) {
setZero(); setZero();
union { union {
double d; double d;
vluint64_t q; uint64_t q;
} u; } u;
u.d = v; u.d = v;
if (u.d == 0.0) {} if (u.d == 0.0) {}
const int exp = static_cast<int>((u.q >> 52ULL) & VL_MASK_Q(11)) - 1023; const int exp = static_cast<int>((u.q >> 52ULL) & VL_MASK_Q(11)) - 1023;
const int lsb = exp - 52; const int lsb = exp - 52;
const vluint64_t mantissa = (u.q & VL_MASK_Q(52)) | (1ULL << 52); const uint64_t mantissa = (u.q & VL_MASK_Q(52)) | (1ULL << 52);
if (v != 0) { if (v != 0) {
// IEEE format: [63]=sign [62:52]=exp+1023 [51:0]=mantissa // IEEE format: [63]=sign [62:52]=exp+1023 [51:0]=mantissa
// This does not need to support subnormals as they are sub-integral // This does not need to support subnormals as they are sub-integral

View File

@ -111,9 +111,9 @@ public:
void nodep(AstNode* nodep) { setNames(nodep); } void nodep(AstNode* nodep) { setNames(nodep); }
FileLine* fileline() const { return m_fileline; } FileLine* fileline() const { return m_fileline; }
V3Number& setZero(); V3Number& setZero();
V3Number& setQuad(vluint64_t value); V3Number& setQuad(uint64_t value);
V3Number& setLong(uint32_t value); V3Number& setLong(uint32_t value);
V3Number& setLongS(vlsint32_t value); V3Number& setLongS(int32_t value);
V3Number& setDouble(double value); V3Number& setDouble(double value);
void setBit(int bit, char value) { // Note must be pre-zeroed! void setBit(int bit, char value) { // Note must be pre-zeroed!
if (bit >= m_width) return; if (bit >= m_width) return;
@ -339,9 +339,9 @@ public:
bool isAnyZ() const; bool isAnyZ() const;
bool isMsbXZ() const { return bitIsXZ(m_width); } bool isMsbXZ() const { return bitIsXZ(m_width); }
uint32_t toUInt() const; uint32_t toUInt() const;
vlsint32_t toSInt() const; int32_t toSInt() const;
vluint64_t toUQuad() const; uint64_t toUQuad() const;
vlsint64_t toSQuad() const; int64_t toSQuad() const;
string toString() const; string toString() const;
string toDecimalS() const; // return ASCII signed decimal number string toDecimalS() const; // return ASCII signed decimal number
string toDecimalU() const; // return ASCII unsigned decimal number string toDecimalU() const; // return ASCII unsigned decimal number

View File

@ -1025,8 +1025,8 @@ public:
virtual bool operator()(const V3GraphVertex* lhsp, const V3GraphVertex* rhsp) const { virtual bool operator()(const V3GraphVertex* lhsp, const V3GraphVertex* rhsp) const {
const MTaskMoveVertex* const l_vxp = dynamic_cast<const MTaskMoveVertex*>(lhsp); const MTaskMoveVertex* const l_vxp = dynamic_cast<const MTaskMoveVertex*>(lhsp);
const MTaskMoveVertex* const r_vxp = dynamic_cast<const MTaskMoveVertex*>(rhsp); const MTaskMoveVertex* const r_vxp = dynamic_cast<const MTaskMoveVertex*>(rhsp);
vluint64_t l_id = m_ids.findId(l_vxp->domainp()); uint64_t l_id = m_ids.findId(l_vxp->domainp());
vluint64_t r_id = m_ids.findId(r_vxp->domainp()); uint64_t r_id = m_ids.findId(r_vxp->domainp());
if (l_id < r_id) return true; if (l_id < r_id) return true;
if (l_id > r_id) return false; if (l_id > r_id) return false;
l_id = m_ids.findId(l_vxp->scopep()); l_id = m_ids.findId(l_vxp->scopep());

View File

@ -254,9 +254,9 @@ void V3Os::unlinkRegexp(const string& dir, const string& regexp) {
//###################################################################### //######################################################################
// METHODS (random) // METHODS (random)
vluint64_t V3Os::rand64(std::array<vluint64_t, 2>& stater) { uint64_t V3Os::rand64(std::array<uint64_t, 2>& stater) {
// Xoroshiro128+ algorithm // Xoroshiro128+ algorithm
const vluint64_t result = stater[0] + stater[1]; const uint64_t result = stater[0] + stater[1];
stater[1] ^= stater[0]; stater[1] ^= stater[0];
stater[0] = (((stater[0] << 55) | (stater[0] >> 9)) ^ stater[1] ^ (stater[1] << 14)); stater[0] = (((stater[0] << 55) | (stater[0] >> 9)) ^ stater[1] ^ (stater[1] << 14));
stater[1] = (stater[1] << 36) | (stater[1] >> 28); stater[1] = (stater[1] << 36) | (stater[1] >> 28);
@ -319,7 +319,7 @@ uint64_t V3Os::memUsageBytes() {
const char* const statmFilename = "/proc/self/statm"; const char* const statmFilename = "/proc/self/statm";
FILE* fp = fopen(statmFilename, "r"); FILE* fp = fopen(statmFilename, "r");
if (!fp) return 0; if (!fp) return 0;
vluint64_t size, resident, share, text, lib, data, dt; // All in pages uint64_t size, resident, share, text, lib, data, dt; // All in pages
const int items = fscanf( const int items = fscanf(
fp, "%" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64, fp, "%" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64,
&size, &resident, &share, &text, &lib, &data, &dt); &size, &resident, &share, &text, &lib, &data, &dt);

View File

@ -57,7 +57,7 @@ public:
static void unlinkRegexp(const string& dir, const string& regexp); static void unlinkRegexp(const string& dir, const string& regexp);
// METHODS (random) // METHODS (random)
static vluint64_t rand64(std::array<vluint64_t, 2>& stater); static uint64_t rand64(std::array<uint64_t, 2>& stater);
static string trueRandom(size_t size); static string trueRandom(size_t size);
// METHODS (time & performance) // METHODS (time & performance)

View File

@ -307,7 +307,7 @@ private:
} }
void go() { void go() {
// Generate a pseudo-random graph // Generate a pseudo-random graph
std::array<vluint64_t, 2> rngState std::array<uint64_t, 2> rngState
= {{0x12345678ULL, 0x9abcdef0ULL}}; // GCC 3.8.0 wants {{}} = {{0x12345678ULL, 0x9abcdef0ULL}}; // GCC 3.8.0 wants {{}}
// Create 50 vertices // Create 50 vertices
for (auto& i : m_vx) i = new V3GraphVertex(&m_graph); for (auto& i : m_vx) i = new V3GraphVertex(&m_graph);
@ -435,7 +435,7 @@ private:
// graph. We'll mark each node with the last generation that scanned // graph. We'll mark each node with the last generation that scanned
// it. We can use this to avoid recursing through the same node twice // it. We can use this to avoid recursing through the same node twice
// while searching for a path. // while searching for a path.
vluint64_t m_generation = 0; uint64_t m_generation = 0;
// Redundant with the V3GraphEdge's, store a map of relatives so we can // Redundant with the V3GraphEdge's, store a map of relatives so we can
// quickly check if we have a given parent or child. // quickly check if we have a given parent or child.
@ -471,8 +471,8 @@ public:
m_cost += otherp->m_cost; m_cost += otherp->m_cost;
} }
virtual const VxList* vertexListp() const override { return &m_vertices; } virtual const VxList* vertexListp() const override { return &m_vertices; }
static vluint64_t incGeneration() { static uint64_t incGeneration() {
static vluint64_t s_generation = 0; static uint64_t s_generation = 0;
++s_generation; ++s_generation;
return s_generation; return s_generation;
} }
@ -569,7 +569,7 @@ public:
private: private:
static bool pathExistsFromInternal(LogicMTask* fromp, LogicMTask* top, static bool pathExistsFromInternal(LogicMTask* fromp, LogicMTask* top,
const V3GraphEdge* excludedEdgep, vluint64_t generation) { const V3GraphEdge* excludedEdgep, uint64_t generation) {
// Q) Why does this take LogicMTask instead of generic V3GraphVertex? // Q) Why does this take LogicMTask instead of generic V3GraphVertex?
// A) We'll use the critical paths known to LogicMTask to prune the // A) We'll use the critical paths known to LogicMTask to prune the
// recursion for speed. Also store 'generation' in // recursion for speed. Also store 'generation' in
@ -718,16 +718,16 @@ private:
// using another bit of the id to denote the actual subtype. // using another bit of the id to denote the actual subtype.
// By using the bottom bits for flags, we can still use < to compare IDs without masking. // By using the bottom bits for flags, we can still use < to compare IDs without masking.
vluint64_t m_id; // <63:2> Serial number for ordering, <1> subtype (SiblingMC), <0> removed uint64_t m_id; // <63:2> Serial number for ordering, <1> subtype (SiblingMC), <0> removed
static constexpr vluint64_t REMOVED_MASK = 1ULL << 0; static constexpr uint64_t REMOVED_MASK = 1ULL << 0;
static constexpr vluint64_t IS_SIBLING_MASK = 1ULL << 1; static constexpr uint64_t IS_SIBLING_MASK = 1ULL << 1;
static constexpr vluint64_t ID_INCREMENT = 1ULL << 2; static constexpr uint64_t ID_INCREMENT = 1ULL << 2;
bool isSiblingMC() const { return m_id & IS_SIBLING_MASK; } bool isSiblingMC() const { return m_id & IS_SIBLING_MASK; }
// CONSTRUCTORS // CONSTRUCTORS
explicit MergeCandidate(bool isSiblingMC) { explicit MergeCandidate(bool isSiblingMC) {
static vluint64_t serial = 0; static uint64_t serial = 0;
serial += ID_INCREMENT; // +ID_INCREMENT so doesn't set the special bottom bits serial += ID_INCREMENT; // +ID_INCREMENT so doesn't set the special bottom bits
m_id = serial | (isSiblingMC * IS_SIBLING_MASK); m_id = serial | (isSiblingMC * IS_SIBLING_MASK);
} }
@ -746,7 +746,7 @@ public:
bool operator<(const MergeCandidate& other) const { return m_id < other.m_id; } bool operator<(const MergeCandidate& other) const { return m_id < other.m_id; }
}; };
static_assert(sizeof(MergeCandidate) == sizeof(vluint64_t), "Should not have a vtable"); static_assert(sizeof(MergeCandidate) == sizeof(uint64_t), "Should not have a vtable");
// A pair of associated LogicMTask's that are merge candidates for sibling // A pair of associated LogicMTask's that are merge candidates for sibling
// contraction // contraction
@ -865,8 +865,8 @@ class OrderByPtrId final {
public: public:
virtual bool operator()(const OrderVarStdVertex* lhsp, const OrderVarStdVertex* rhsp) const { virtual bool operator()(const OrderVarStdVertex* lhsp, const OrderVarStdVertex* rhsp) const {
const vluint64_t l_id = m_ids.findId(lhsp); const uint64_t l_id = m_ids.findId(lhsp);
const vluint64_t r_id = m_ids.findId(rhsp); const uint64_t r_id = m_ids.findId(rhsp);
return l_id < r_id; return l_id < r_id;
} }
}; };
@ -1580,8 +1580,8 @@ private:
// runtime should be N*log(N) for a chain-shaped graph. // runtime should be N*log(N) for a chain-shaped graph.
// //
static void selfTestChain() { static void selfTestChain() {
const vluint64_t usecsSmall = partitionChainUsecs(5); const uint64_t usecsSmall = partitionChainUsecs(5);
const vluint64_t usecsLarge = partitionChainUsecs(500); const uint64_t usecsLarge = partitionChainUsecs(500);
// Large input is 50x bigger than small input. // Large input is 50x bigger than small input.
// Its runtime should be about 10x longer -- not about 2500x longer // Its runtime should be about 10x longer -- not about 2500x longer
// or worse which would suggest N^2 scaling or worse. // or worse which would suggest N^2 scaling or worse.
@ -1590,9 +1590,9 @@ private:
<< usecsSmall << ", large input runtime = " << usecsLarge); << usecsSmall << ", large input runtime = " << usecsLarge);
} }
static vluint64_t partitionChainUsecs(unsigned chain_len) { static uint64_t partitionChainUsecs(unsigned chain_len) {
// NOTE: To get a dot file run with --debugi-V3Partition 4 or more. // NOTE: To get a dot file run with --debugi-V3Partition 4 or more.
const vluint64_t startUsecs = V3Os::timeUsecs(); const uint64_t startUsecs = V3Os::timeUsecs();
V3Graph mtasks; V3Graph mtasks;
LogicMTask* lastp = nullptr; LogicMTask* lastp = nullptr;
for (unsigned i = 0; i < chain_len; ++i) { for (unsigned i = 0; i < chain_len; ++i) {
@ -1614,8 +1614,8 @@ private:
PartParallelismEst check(&mtasks); PartParallelismEst check(&mtasks);
check.traverse(); check.traverse();
const vluint64_t endUsecs = V3Os::timeUsecs(); const uint64_t endUsecs = V3Os::timeUsecs();
const vluint64_t elapsedUsecs = endUsecs - startUsecs; const uint64_t elapsedUsecs = endUsecs - startUsecs;
if (debug() >= 6) { if (debug() >= 6) {
UINFO(0, "Chain self test stats:\n"); UINFO(0, "Chain self test stats:\n");
@ -1927,7 +1927,7 @@ private:
public: public:
void go() { void go() {
vluint64_t startUsecs = 0; uint64_t startUsecs = 0;
if (debug() >= 3) startUsecs = V3Os::timeUsecs(); if (debug() >= 3) startUsecs = V3Os::timeUsecs();
// Build an OLV->mtask map and a set of OVVs // Build an OLV->mtask map and a set of OVVs
@ -2682,21 +2682,21 @@ void V3Partition::go(V3Graph* mtasksp) {
} }
} }
void add(std::unordered_map<int, vluint64_t>& cmap, int id, vluint64_t cost) { cmap[id] += cost; } void add(std::unordered_map<int, uint64_t>& cmap, int id, uint64_t cost) { cmap[id] += cost; }
using EstimateAndProfiled = std::pair<uint64_t, vluint64_t>; // cost est, cost profiled using EstimateAndProfiled = std::pair<uint64_t, uint64_t>; // cost est, cost profiled
using Costs = std::unordered_map<uint32_t, EstimateAndProfiled>; using Costs = std::unordered_map<uint32_t, EstimateAndProfiled>;
static void normalizeCosts(Costs& costs) { static void normalizeCosts(Costs& costs) {
const auto scaleCost = [](vluint64_t value, double multiplier) { const auto scaleCost = [](uint64_t value, double multiplier) {
double scaled = static_cast<double>(value) * multiplier; double scaled = static_cast<double>(value) * multiplier;
if (value && scaled < 1) scaled = 1; if (value && scaled < 1) scaled = 1;
return static_cast<uint64_t>(scaled); return static_cast<uint64_t>(scaled);
}; };
// For all costs with a profile, compute sum // For all costs with a profile, compute sum
vluint64_t sumCostProfiled = 0; // For data with estimate and profile uint64_t sumCostProfiled = 0; // For data with estimate and profile
vluint64_t sumCostEstimate = 0; // For data with estimate and profile uint64_t sumCostEstimate = 0; // For data with estimate and profile
for (const auto& est : costs) { for (const auto& est : costs) {
if (est.second.second) { if (est.second.second) {
sumCostEstimate += est.second.first; sumCostEstimate += est.second.first;
@ -2720,7 +2720,7 @@ static void normalizeCosts(Costs& costs) {
} }
// COSTS can overflow a uint32. Using maximum value of costs, scale all down // COSTS can overflow a uint32. Using maximum value of costs, scale all down
vluint64_t maxCost = 0; uint64_t maxCost = 0;
for (auto& est : costs) { for (auto& est : costs) {
const uint64_t& costEstimate = est.second.first; const uint64_t& costEstimate = est.second.first;
const uint64_t& costProfiled = est.second.second; const uint64_t& costProfiled = est.second.second;
@ -2729,7 +2729,7 @@ static void normalizeCosts(Costs& costs) {
UINFO(9, UINFO(9,
"Post uint scale: ce = " << est.second.first << " cp=" << est.second.second << endl); "Post uint scale: ce = " << est.second.first << " cp=" << est.second.second << endl);
} }
const vluint64_t scaleDownTo = 10000000; // Extra room for future algorithms to add costs const uint64_t scaleDownTo = 10000000; // Extra room for future algorithms to add costs
if (maxCost > scaleDownTo) { if (maxCost > scaleDownTo) {
const double scaleup = static_cast<double>(scaleDownTo) / static_cast<double>(maxCost); const double scaleup = static_cast<double>(scaleDownTo) / static_cast<double>(maxCost);
UINFO(5, "Scaling data to within 32-bits by multiply by=" << scaleup << ", maxCost=" UINFO(5, "Scaling data to within 32-bits by multiply by=" << scaleup << ", maxCost="
@ -2783,8 +2783,8 @@ static void fillinCosts(V3Graph* execMTaskGraphp) {
mtp->hashName(m_uniqueNames.get(mtp->bodyp())); mtp->hashName(m_uniqueNames.get(mtp->bodyp()));
// This estimate is 64 bits, but the final mtask graph algorithm needs 32 bits // This estimate is 64 bits, but the final mtask graph algorithm needs 32 bits
const vluint64_t costEstimate = V3InstrCount::count(mtp->bodyp(), false); const uint64_t costEstimate = V3InstrCount::count(mtp->bodyp(), false);
const vluint64_t costProfiled const uint64_t costProfiled
= V3Config::getProfileData(v3Global.opt.prefix(), mtp->hashName()); = V3Config::getProfileData(v3Global.opt.prefix(), mtp->hashName());
if (costProfiled) { if (costProfiled) {
UINFO(5, "Profile data for mtask " << mtp->id() << " " << mtp->hashName() UINFO(5, "Profile data for mtask " << mtp->id() << " " << mtp->hashName()
@ -2868,7 +2868,7 @@ static void finalizeCosts(V3Graph* execMTaskGraphp) {
} }
// Assign profiler IDs // Assign profiler IDs
vluint64_t profilerId = 0; uint64_t profilerId = 0;
for (const V3GraphVertex* vxp = execMTaskGraphp->verticesBeginp(); vxp; for (const V3GraphVertex* vxp = execMTaskGraphp->verticesBeginp(); vxp;
vxp = vxp->verticesNextp()) { vxp = vxp->verticesNextp()) {
ExecMTask* const mtp = dynamic_cast<ExecMTask*>(const_cast<V3GraphVertex*>(vxp)); ExecMTask* const mtp = dynamic_cast<ExecMTask*>(const_cast<V3GraphVertex*>(vxp));

View File

@ -78,14 +78,14 @@ class PartPtrIdMap final {
private: private:
// TYPES // TYPES
// MEMBERS // MEMBERS
mutable vluint64_t m_nextId = 0; mutable uint64_t m_nextId = 0;
mutable std::unordered_map<const void*, vluint64_t> m_id; mutable std::unordered_map<const void*, uint64_t> m_id;
public: public:
// CONSTRUCTORS // CONSTRUCTORS
PartPtrIdMap() = default; PartPtrIdMap() = default;
// METHODS // METHODS
vluint64_t findId(const void* ptrp) const { uint64_t findId(const void* ptrp) const {
const auto it = m_id.find(ptrp); const auto it = m_id.find(ptrp);
if (it != m_id.end()) return it->second; if (it != m_id.end()) return it->second;
m_id[ptrp] = m_nextId; m_id[ptrp] = m_nextId;

View File

@ -77,10 +77,10 @@ public:
void priority(uint32_t pri) { m_priority = pri; } void priority(uint32_t pri) { m_priority = pri; }
virtual uint32_t cost() const override { return m_cost; } virtual uint32_t cost() const override { return m_cost; }
void cost(uint32_t cost) { m_cost = cost; } void cost(uint32_t cost) { m_cost = cost; }
void predictStart(vluint64_t time) { m_predictStart = time; } void predictStart(uint64_t time) { m_predictStart = time; }
vluint64_t predictStart() const { return m_predictStart; } uint64_t predictStart() const { return m_predictStart; }
void profilerId(vluint64_t id) { m_profilerId = id; } void profilerId(uint64_t id) { m_profilerId = id; }
vluint64_t profilerId() const { return m_profilerId; } uint64_t profilerId() const { return m_profilerId; }
string cFuncName() const { string cFuncName() const {
// If this MTask maps to a C function, this should be the name // If this MTask maps to a C function, this should be the name
return string("__Vmtask") + "__" + cvtToStr(m_id); return string("__Vmtask") + "__" + cvtToStr(m_id);

View File

@ -697,7 +697,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
const bool needNext = VN_IS(subTypep, UnpackArrayDType); // Still unpacked array. const bool needNext = VN_IS(subTypep, UnpackArrayDType); // Still unpacked array.
std::vector<AstVar*> vars; std::vector<AstVar*> vars;
// Add the split variables // Add the split variables
for (vlsint32_t i = 0; i < dtypep->elementsConst(); ++i) { for (int32_t i = 0; i < dtypep->elementsConst(); ++i) {
// Unpacked array is traced as var(idx), not var[idx]. // Unpacked array is traced as var(idx), not var[idx].
const std::string name const std::string name
= varp->name() + AstNode::encodeName('(' + cvtToStr(i + dtypep->lo()) + ')'); = varp->name() + AstNode::encodeName('(' + cvtToStr(i + dtypep->lo()) + ')');

View File

@ -35,7 +35,7 @@ public:
~VDouble0() = default; ~VDouble0() = default;
// Implicit conversion operators: // Implicit conversion operators:
explicit VDouble0(const vluint64_t v) explicit VDouble0(const uint64_t v)
: m_d{static_cast<double>(v)} {} : m_d{static_cast<double>(v)} {}
operator double() const { return m_d; } operator double() const { return m_d; }

View File

@ -338,7 +338,7 @@ public:
// Look for an arbitrary edge we've not yet marked // Look for an arbitrary edge we've not yet marked
for (V3GraphEdge* edgep = cur_vertexp->outBeginp(); edgep; edgep = edgep->outNextp()) { for (V3GraphEdge* edgep = cur_vertexp->outBeginp(); edgep; edgep = edgep->outNextp()) {
const vluint32_t edgeId = getEdgeId(edgep); const uint32_t edgeId = getEdgeId(edgep);
if (markedEdgesp->end() == markedEdgesp->find(edgeId)) { if (markedEdgesp->end() == markedEdgesp->find(edgeId)) {
// This edge is not yet marked, so follow it. // This edge is not yet marked, so follow it.
markedEdgesp->insert(edgeId); markedEdgesp->insert(edgeId);
@ -362,7 +362,7 @@ public:
recursed = false; recursed = false;
// Look for an arbitrary edge at vxp we've not yet marked // Look for an arbitrary edge at vxp we've not yet marked
for (V3GraphEdge* edgep = vxp->outBeginp(); edgep; edgep = edgep->outNextp()) { for (V3GraphEdge* edgep = vxp->outBeginp(); edgep; edgep = edgep->outNextp()) {
const vluint32_t edgeId = getEdgeId(edgep); const uint32_t edgeId = getEdgeId(edgep);
if (markedEdgesp->end() == markedEdgesp->find(edgeId)) { if (markedEdgesp->end() == markedEdgesp->find(edgeId)) {
UINFO(6, "Recursing.\n"); UINFO(6, "Recursing.\n");
findEulerTourRecurse(markedEdgesp, vxp, sortedOutp); findEulerTourRecurse(markedEdgesp, vxp, sortedOutp);
@ -414,7 +414,7 @@ public:
std::vector<T_Key> result; std::vector<T_Key> result;
for (V3GraphVertex* vxp = verticesBeginp(); vxp; vxp = vxp->verticesNextp()) { for (V3GraphVertex* vxp = verticesBeginp(); vxp; vxp = vxp->verticesNextp()) {
const Vertex* const tspvp = castVertexp(vxp); const Vertex* const tspvp = castVertexp(vxp);
vluint32_t degree = 0; uint32_t degree = 0;
for (V3GraphEdge* edgep = vxp->outBeginp(); edgep; edgep = edgep->outNextp()) { for (V3GraphEdge* edgep = vxp->outBeginp(); edgep; edgep = edgep->outNextp()) {
degree++; degree++;
} }

View File

@ -54,7 +54,7 @@
class TraceActivityVertex final : public V3GraphVertex { class TraceActivityVertex final : public V3GraphVertex {
AstNode* const m_insertp; AstNode* const m_insertp;
vlsint32_t m_activityCode; int32_t m_activityCode;
bool m_slow; // If always slow, we can use the same code bool m_slow; // If always slow, we can use the same code
public: public:
enum { ACTIVITY_NEVER = ((1UL << 31) - 1) }; enum { ACTIVITY_NEVER = ((1UL << 31) - 1) };
@ -66,7 +66,7 @@ public:
m_activityCode = 0; m_activityCode = 0;
m_slow = slow; m_slow = slow;
} }
TraceActivityVertex(V3Graph* graphp, vlsint32_t code) TraceActivityVertex(V3Graph* graphp, int32_t code)
: V3GraphVertex{graphp} : V3GraphVertex{graphp}
, m_insertp{nullptr} { , m_insertp{nullptr} {
m_activityCode = code; m_activityCode = code;
@ -86,10 +86,10 @@ public:
} }
} }
virtual string dotColor() const override { return slow() ? "yellowGreen" : "green"; } virtual string dotColor() const override { return slow() ? "yellowGreen" : "green"; }
vlsint32_t activityCode() const { return m_activityCode; } int32_t activityCode() const { return m_activityCode; }
bool activityAlways() const { return activityCode() == ACTIVITY_ALWAYS; } bool activityAlways() const { return activityCode() == ACTIVITY_ALWAYS; }
bool activitySlow() const { return activityCode() == ACTIVITY_SLOW; } bool activitySlow() const { return activityCode() == ACTIVITY_SLOW; }
void activityCode(vlsint32_t code) { m_activityCode = code; } void activityCode(int32_t code) { m_activityCode = code; }
bool slow() const { return m_slow; } bool slow() const { return m_slow; }
void slow(bool flag) { void slow(bool flag) {
if (!flag) m_slow = false; if (!flag) m_slow = false;
@ -516,17 +516,17 @@ private:
// sub function, hence the VL_ATTR_UNUSED attributes. // sub function, hence the VL_ATTR_UNUSED attributes.
if (full) { if (full) {
// Full dump sub function // Full dump sub function
addInitStr("vluint32_t* const oldp VL_ATTR_UNUSED = " addInitStr("uint32_t* const oldp VL_ATTR_UNUSED = "
"tracep->oldp(vlSymsp->__Vm_baseCode);\n"); "tracep->oldp(vlSymsp->__Vm_baseCode);\n");
} else { } else {
// Change dump sub function // Change dump sub function
if (v3Global.opt.trueTraceThreads()) { if (v3Global.opt.trueTraceThreads()) {
addInitStr("const vluint32_t base VL_ATTR_UNUSED = " addInitStr("const uint32_t base VL_ATTR_UNUSED = "
"vlSymsp->__Vm_baseCode + " "vlSymsp->__Vm_baseCode + "
+ cvtToStr(baseCode) + ";\n"); + cvtToStr(baseCode) + ";\n");
addInitStr("if (false && tracep) {} // Prevent unused\n"); addInitStr("if (false && tracep) {} // Prevent unused\n");
} else { } else {
addInitStr("vluint32_t* const oldp VL_ATTR_UNUSED = " addInitStr("uint32_t* const oldp VL_ATTR_UNUSED = "
"tracep->oldp(vlSymsp->__Vm_baseCode + " "tracep->oldp(vlSymsp->__Vm_baseCode + "
+ cvtToStr(baseCode) + ");\n"); + cvtToStr(baseCode) + ");\n");
} }

View File

@ -5766,12 +5766,12 @@ private:
VNRelinker linker; VNRelinker linker;
nodep->unlinkFrBack(&linker); nodep->unlinkFrBack(&linker);
if (const AstConst* const constp = VN_CAST(nodep, Const)) { if (const AstConst* const constp = VN_CAST(nodep, Const)) {
// We convert to/from vlsint32 rather than use floor() as want to make sure is // We convert to/from int32_t rather than use floor() as want to make sure is
// representable in integer's number of bits // representable in integer's number of bits
if (constp->isDouble() if (constp->isDouble()
&& v3EpsilonEqual( && v3EpsilonEqual(
constp->num().toDouble(), constp->num().toDouble(),
static_cast<double>(static_cast<vlsint32_t>(constp->num().toDouble())))) { static_cast<double>(static_cast<int32_t>(constp->num().toDouble())))) {
warnOn = false; warnOn = false;
} }
} }
@ -6168,7 +6168,7 @@ private:
// Find valid values and populate // Find valid values and populate
UASSERT_OBJ(nodep->itemsp(), nodep, "enum without items"); UASSERT_OBJ(nodep->itemsp(), nodep, "enum without items");
std::map<vluint64_t, AstNode*> values; std::map<uint64_t, AstNode*> values;
{ {
AstEnumItem* const firstp = nodep->itemsp(); AstEnumItem* const firstp = nodep->itemsp();
const AstEnumItem* prevp = firstp; // Prev must start with last item const AstEnumItem* prevp = firstp; // Prev must start with last item
@ -6177,7 +6177,7 @@ private:
AstEnumItem* const nextp = VN_AS(itemp->nextp(), EnumItem); AstEnumItem* const nextp = VN_AS(itemp->nextp(), EnumItem);
const AstConst* const vconstp = VN_AS(itemp->valuep(), Const); const AstConst* const vconstp = VN_AS(itemp->valuep(), Const);
UASSERT_OBJ(vconstp, nodep, "Enum item without constified value"); UASSERT_OBJ(vconstp, nodep, "Enum item without constified value");
const vluint64_t i = vconstp->toUQuad(); const uint64_t i = vconstp->toUQuad();
if (attrType == VAttrType::ENUM_NAME) { if (attrType == VAttrType::ENUM_NAME) {
values[i] = new AstConst(nodep->fileline(), AstConst::String(), itemp->name()); values[i] = new AstConst(nodep->fileline(), AstConst::String(), itemp->name());
} else if (attrType == VAttrType::ENUM_NEXT) { } else if (attrType == VAttrType::ENUM_NEXT) {
@ -6197,7 +6197,7 @@ private:
if (assoc) { if (assoc) {
for (const auto& itr : values) initp->addIndexValuep(itr.first, itr.second); for (const auto& itr : values) initp->addIndexValuep(itr.first, itr.second);
} else { } else {
for (vluint64_t i = 0; i < (msbdim + 1); ++i) { for (uint64_t i = 0; i < (msbdim + 1); ++i) {
if (values[i]) initp->addIndexValuep(i, values[i]); if (values[i]) initp->addIndexValuep(i, values[i]);
} }
} }

View File

@ -114,7 +114,7 @@ private:
return FromData(errp, ddtypep, fromRange); return FromData(errp, ddtypep, fromRange);
} }
AstNode* newSubNeg(AstNode* lhsp, vlsint32_t rhs) { AstNode* newSubNeg(AstNode* lhsp, int32_t rhs) {
// Return lhs-rhs, but if rhs is negative use an add, so we won't // Return lhs-rhs, but if rhs is negative use an add, so we won't
// have to deal with signed math and related 32bit sign extension problems // have to deal with signed math and related 32bit sign extension problems
if (rhs == 0) { if (rhs == 0) {
@ -142,7 +142,7 @@ private:
return newp; return newp;
} }
} }
AstNode* newSubNeg(vlsint32_t lhs, AstNode* rhsp) { AstNode* newSubNeg(int32_t lhs, AstNode* rhsp) {
// Return lhs-rhs // Return lhs-rhs
// We must make sure sub gets sign of original value // We must make sure sub gets sign of original value
AstNode* const newp = new AstSub( AstNode* const newp = new AstSub(
@ -337,9 +337,9 @@ private:
AstNode* const fromp = nodep->fromp()->unlinkFrBack(); AstNode* const fromp = nodep->fromp()->unlinkFrBack();
AstNode* const msbp = nodep->rhsp()->unlinkFrBack(); AstNode* const msbp = nodep->rhsp()->unlinkFrBack();
AstNode* const lsbp = nodep->thsp()->unlinkFrBack(); AstNode* const lsbp = nodep->thsp()->unlinkFrBack();
vlsint32_t msb = VN_AS(msbp, Const)->toSInt(); int32_t msb = VN_AS(msbp, Const)->toSInt();
vlsint32_t lsb = VN_AS(lsbp, Const)->toSInt(); int32_t lsb = VN_AS(lsbp, Const)->toSInt();
const vlsint32_t elem = (msb > lsb) ? (msb - lsb + 1) : (lsb - msb + 1); const int32_t elem = (msb > lsb) ? (msb - lsb + 1) : (lsb - msb + 1);
const FromData fromdata = fromDataForArray(nodep, fromp); const FromData fromdata = fromDataForArray(nodep, fromp);
AstNodeDType* const ddtypep = fromdata.m_dtypep; AstNodeDType* const ddtypep = fromdata.m_dtypep;
const VNumRange fromRange = fromdata.m_fromRange; const VNumRange fromRange = fromdata.m_fromRange;
@ -507,13 +507,13 @@ private:
nodep->replaceWith(newp); nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep); VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (VN_IS(rhsp, Const)) { // Slice } else if (VN_IS(rhsp, Const)) { // Slice
const vlsint32_t rhs = VN_AS(rhsp, Const)->toSInt(); const int32_t rhs = VN_AS(rhsp, Const)->toSInt();
// down array: lsb/lo +: width // down array: lsb/lo +: width
// down array: msb/hi -: width // down array: msb/hi -: width
// up array: msb/lo +: width // up array: msb/lo +: width
// up array: lsb/hi -: width // up array: lsb/hi -: width
const vlsint32_t msb = VN_IS(nodep, SelPlus) ? rhs + width - 1 : rhs; const int32_t msb = VN_IS(nodep, SelPlus) ? rhs + width - 1 : rhs;
const vlsint32_t lsb = VN_IS(nodep, SelPlus) ? rhs : rhs - width + 1; const int32_t lsb = VN_IS(nodep, SelPlus) ? rhs : rhs - width + 1;
AstSliceSel* const newp = new AstSliceSel( AstSliceSel* const newp = new AstSliceSel(
nodep->fileline(), fromp, VNumRange(msb, lsb, fromRange.littleEndian())); nodep->fileline(), fromp, VNumRange(msb, lsb, fromRange.littleEndian()));
nodep->replaceWith(newp); nodep->replaceWith(newp);

View File

@ -31,25 +31,25 @@
class VlcBuckets final { class VlcBuckets final {
private: private:
// MEMBERS // MEMBERS
vluint64_t* m_datap = nullptr; ///< Pointer to first bucket (dynamically allocated) uint64_t* m_datap = nullptr; ///< Pointer to first bucket (dynamically allocated)
vluint64_t m_dataSize = 0; ///< Current entries in m_datap uint64_t m_dataSize = 0; ///< Current entries in m_datap
vluint64_t m_bucketsCovered = 0; ///< Num buckets with sufficient coverage uint64_t m_bucketsCovered = 0; ///< Num buckets with sufficient coverage
static vluint64_t covBit(vluint64_t point) { return 1ULL << (point & 63); } static uint64_t covBit(uint64_t point) { return 1ULL << (point & 63); }
vluint64_t allocSize() const { return sizeof(vluint64_t) * m_dataSize / 64; } uint64_t allocSize() const { return sizeof(uint64_t) * m_dataSize / 64; }
void allocate(vluint64_t point) { void allocate(uint64_t point) {
const vluint64_t oldsize = m_dataSize; const uint64_t oldsize = m_dataSize;
if (m_dataSize < point) m_dataSize = (point + 64) & ~63ULL; // Keep power of two if (m_dataSize < point) m_dataSize = (point + 64) & ~63ULL; // Keep power of two
m_dataSize *= 2; m_dataSize *= 2;
// UINFO(9, "Realloc "<<allocSize()<<" for "<<point<<" "<<cvtToHex(m_datap)<<endl); // UINFO(9, "Realloc "<<allocSize()<<" for "<<point<<" "<<cvtToHex(m_datap)<<endl);
vluint64_t* const newp = static_cast<vluint64_t*>(std::realloc(m_datap, allocSize())); uint64_t* const newp = static_cast<uint64_t*>(std::realloc(m_datap, allocSize()));
if (VL_UNCOVERABLE(!newp)) { if (VL_UNCOVERABLE(!newp)) {
// cppcheck-suppress doubleFree // cppcheck 1.90 bug - realloc doesn't free on fail // cppcheck-suppress doubleFree // cppcheck 1.90 bug - realloc doesn't free on fail
free(m_datap); // LCOV_EXCL_LINE free(m_datap); // LCOV_EXCL_LINE
v3fatal("Out of memory increasing buckets"); // LCOV_EXCL_LINE v3fatal("Out of memory increasing buckets"); // LCOV_EXCL_LINE
} }
m_datap = newp; m_datap = newp;
for (vluint64_t i = oldsize; i < m_dataSize; i += 64) m_datap[i / 64] = 0; for (uint64_t i = oldsize; i < m_dataSize; i += 64) m_datap[i / 64] = 0;
} }
public: public:
@ -61,11 +61,11 @@ public:
} }
// ACCESSORS // ACCESSORS
static vluint64_t sufficient() { return 1; } static uint64_t sufficient() { return 1; }
vluint64_t bucketsCovered() const { return m_bucketsCovered; } uint64_t bucketsCovered() const { return m_bucketsCovered; }
// METHODS // METHODS
void addData(vluint64_t point, vluint64_t hits) { void addData(uint64_t point, uint64_t hits) {
if (hits >= sufficient()) { if (hits >= sufficient()) {
// UINFO(9," addData "<<point<<" "<<hits<<" size="<<m_dataSize<<endl); // UINFO(9," addData "<<point<<" "<<hits<<" size="<<m_dataSize<<endl);
if (point >= m_dataSize) allocate(point); if (point >= m_dataSize) allocate(point);
@ -73,50 +73,50 @@ public:
m_bucketsCovered++; m_bucketsCovered++;
} }
} }
void clearHits(vluint64_t point) const { void clearHits(uint64_t point) const {
if (point >= m_dataSize) { if (point >= m_dataSize) {
return; return;
} else { } else {
m_datap[point / 64] &= ~covBit(point); m_datap[point / 64] &= ~covBit(point);
} }
} }
bool exists(vluint64_t point) const { bool exists(uint64_t point) const {
if (point >= m_dataSize) { if (point >= m_dataSize) {
return false; return false;
} else { } else {
return (m_datap[point / 64] & covBit(point)) ? 1 : 0; return (m_datap[point / 64] & covBit(point)) ? 1 : 0;
} }
} }
vluint64_t hits(vluint64_t point) const { uint64_t hits(uint64_t point) const {
if (point >= m_dataSize) { if (point >= m_dataSize) {
return 0; return 0;
} else { } else {
return (m_datap[point / 64] & covBit(point)) ? 1 : 0; return (m_datap[point / 64] & covBit(point)) ? 1 : 0;
} }
} }
vluint64_t popCount() const { uint64_t popCount() const {
vluint64_t pop = 0; uint64_t pop = 0;
for (vluint64_t i = 0; i < m_dataSize; i++) { for (uint64_t i = 0; i < m_dataSize; i++) {
if (hits(i)) pop++; if (hits(i)) pop++;
} }
return pop; return pop;
} }
vluint64_t dataPopCount(const VlcBuckets& remaining) { uint64_t dataPopCount(const VlcBuckets& remaining) {
vluint64_t pop = 0; uint64_t pop = 0;
for (vluint64_t i = 0; i < m_dataSize; i++) { for (uint64_t i = 0; i < m_dataSize; i++) {
if (hits(i) && remaining.hits(i)) pop++; if (hits(i) && remaining.hits(i)) pop++;
} }
return pop; return pop;
} }
void orData(const VlcBuckets& ordata) { void orData(const VlcBuckets& ordata) {
for (vluint64_t i = 0; i < m_dataSize; i++) { for (uint64_t i = 0; i < m_dataSize; i++) {
if (hits(i) && ordata.hits(i)) clearHits(i); if (hits(i) && ordata.hits(i)) clearHits(i);
} }
} }
void dump() const { void dump() const {
cout << "# "; cout << "# ";
for (vluint64_t i = 0; i < m_dataSize; i++) { for (uint64_t i = 0; i < m_dataSize; i++) {
if (hits(i)) cout << "," << i; if (hits(i)) cout << "," << i;
} }
cout << endl; cout << endl;

View File

@ -36,22 +36,22 @@ class VlcPoint final {
private: private:
// MEMBERS // MEMBERS
string m_name; //< Name of the point string m_name; //< Name of the point
vluint64_t m_pointNum; //< Point number uint64_t m_pointNum; //< Point number
vluint64_t m_testsCovering = 0; //< Number tests with non-zero coverage of this point uint64_t m_testsCovering = 0; //< Number tests with non-zero coverage of this point
vluint64_t m_count = 0; //< Count of hits across all tests uint64_t m_count = 0; //< Count of hits across all tests
public: public:
// CONSTRUCTORS // CONSTRUCTORS
VlcPoint(const string& name, vluint64_t pointNum) VlcPoint(const string& name, uint64_t pointNum)
: m_name{name} : m_name{name}
, m_pointNum{pointNum} {} , m_pointNum{pointNum} {}
~VlcPoint() = default; ~VlcPoint() = default;
// ACCESSORS // ACCESSORS
const string& name() const { return m_name; } const string& name() const { return m_name; }
vluint64_t pointNum() const { return m_pointNum; } uint64_t pointNum() const { return m_pointNum; }
vluint64_t testsCovering() const { return m_testsCovering; } uint64_t testsCovering() const { return m_testsCovering; }
void countInc(vluint64_t inc) { m_count += inc; } void countInc(uint64_t inc) { m_count += inc; }
vluint64_t count() const { return m_count; } uint64_t count() const { return m_count; }
void testsCoveringInc() { m_testsCovering++; } void testsCoveringInc() { m_testsCovering++; }
// KEY ACCESSORS // KEY ACCESSORS
string filename() const { return keyExtract(VL_CIK_FILENAME); } string filename() const { return keyExtract(VL_CIK_FILENAME); }
@ -96,10 +96,10 @@ public:
class VlcPoints final { class VlcPoints final {
private: private:
// MEMBERS // MEMBERS
using NameMap = std::map<const std::string, vluint64_t>; // Sorted by name (ordered) using NameMap = std::map<const std::string, uint64_t>; // Sorted by name (ordered)
NameMap m_nameMap; //< Name to point-number NameMap m_nameMap; //< Name to point-number
std::vector<VlcPoint> m_points; //< List of all points std::vector<VlcPoint> m_points; //< List of all points
vluint64_t m_numPoints = 0; //< Total unique points uint64_t m_numPoints = 0; //< Total unique points
public: public:
// ITERATORS // ITERATORS
@ -121,9 +121,9 @@ public:
point.dump(); point.dump();
} }
} }
VlcPoint& pointNumber(vluint64_t num) { return m_points[num]; } VlcPoint& pointNumber(uint64_t num) { return m_points[num]; }
vluint64_t findAddPoint(const string& name, vluint64_t count) { uint64_t findAddPoint(const string& name, uint64_t count) {
vluint64_t pointnum; uint64_t pointnum;
const auto iter = m_nameMap.find(name); const auto iter = m_nameMap.find(name);
if (iter != m_nameMap.end()) { if (iter != m_nameMap.end()) {
pointnum = iter->second; pointnum = iter->second;

View File

@ -32,7 +32,7 @@ private:
// MEMBERS // MEMBERS
int m_lineno; ///< Line number int m_lineno; ///< Line number
int m_column; ///< Column number int m_column; ///< Column number
vluint64_t m_count = 0; ///< Count uint64_t m_count = 0; ///< Count
bool m_ok = false; ///< Coverage is above threshold bool m_ok = false; ///< Coverage is above threshold
public: public:
@ -45,11 +45,11 @@ public:
// ACCESSORS // ACCESSORS
int lineno() const { return m_lineno; } int lineno() const { return m_lineno; }
int column() const { return m_column; } int column() const { return m_column; }
vluint64_t count() const { return m_count; } uint64_t count() const { return m_count; }
bool ok() const { return m_ok; } bool ok() const { return m_ok; }
// METHODS // METHODS
void incCount(vluint64_t count, bool ok) { void incCount(uint64_t count, bool ok) {
m_count += count; m_count += count;
if (ok) m_ok = true; if (ok) m_ok = true;
} }
@ -83,7 +83,7 @@ public:
LinenoMap& lines() { return m_lines; } LinenoMap& lines() { return m_lines; }
// METHODS // METHODS
void incCount(int lineno, int column, vluint64_t count, bool ok) { void incCount(int lineno, int column, uint64_t count, bool ok) {
LinenoMap::iterator lit = m_lines.find(lineno); LinenoMap::iterator lit = m_lines.find(lineno);
if (lit == m_lines.end()) lit = m_lines.insert(std::make_pair(lineno, ColumnMap())).first; if (lit == m_lines.end()) lit = m_lines.insert(std::make_pair(lineno, ColumnMap())).first;
ColumnMap& cmap = lit->second; ColumnMap& cmap = lit->second;

View File

@ -34,15 +34,15 @@ private:
// MEMBERS // MEMBERS
string m_name; //< Name of the test string m_name; //< Name of the test
double m_computrons; //< Runtime for the test double m_computrons; //< Runtime for the test
vluint64_t m_testrun; //< Test run number, for database use uint64_t m_testrun; //< Test run number, for database use
vluint64_t m_rank = 0; //< Execution rank suggestion uint64_t m_rank = 0; //< Execution rank suggestion
vluint64_t m_rankPoints = 0; //< Ranked additional points uint64_t m_rankPoints = 0; //< Ranked additional points
vluint64_t m_user = 0; //< User data for algorithms (not persisted in .dat file) uint64_t m_user = 0; //< User data for algorithms (not persisted in .dat file)
VlcBuckets m_buckets; //< Coverage data for each coverage point VlcBuckets m_buckets; //< Coverage data for each coverage point
public: public:
// CONSTRUCTORS // CONSTRUCTORS
VlcTest(const string& name, vluint64_t testrun, double comp) VlcTest(const string& name, uint64_t testrun, double comp)
: m_name{name} : m_name{name}
, m_computrons{comp} , m_computrons{comp}
, m_testrun{testrun} {} , m_testrun{testrun} {}
@ -51,15 +51,15 @@ public:
// ACCESSORS // ACCESSORS
const string& name() const { return m_name; } const string& name() const { return m_name; }
double computrons() const { return m_computrons; } double computrons() const { return m_computrons; }
vluint64_t testrun() const { return m_testrun; } uint64_t testrun() const { return m_testrun; }
VlcBuckets& buckets() { return m_buckets; } VlcBuckets& buckets() { return m_buckets; }
vluint64_t bucketsCovered() const { return m_buckets.bucketsCovered(); } uint64_t bucketsCovered() const { return m_buckets.bucketsCovered(); }
vluint64_t rank() const { return m_rank; } uint64_t rank() const { return m_rank; }
void rank(vluint64_t flag) { m_rank = flag; } void rank(uint64_t flag) { m_rank = flag; }
vluint64_t rankPoints() const { return m_rankPoints; } uint64_t rankPoints() const { return m_rankPoints; }
void rankPoints(vluint64_t flag) { m_rankPoints = flag; } void rankPoints(uint64_t flag) { m_rankPoints = flag; }
vluint64_t user() const { return m_user; } uint64_t user() const { return m_user; }
void user(vluint64_t flag) { m_user = flag; } void user(uint64_t flag) { m_user = flag; }
// METHODS // METHODS
static void dumpHeader() { static void dumpHeader() {
@ -111,7 +111,7 @@ public:
VlcTest::dumpHeader(); VlcTest::dumpHeader();
for (const auto& testp : m_tests) testp->dump(bucketsToo); for (const auto& testp : m_tests) testp->dump(bucketsToo);
} }
VlcTest* newTest(const string& name, vluint64_t testrun, double comp) { VlcTest* newTest(const string& name, uint64_t testrun, double comp) {
VlcTest* const testp = new VlcTest{name, testrun, comp}; VlcTest* const testp = new VlcTest{name, testrun, comp};
m_tests.push_back(testp); m_tests.push_back(testp);
return testp; return testp;

View File

@ -47,10 +47,10 @@ void VlcTop::readCoverage(const string& filename, bool nonfatal) {
if (line[secspace] == '\'' && line[secspace + 1] == ' ') break; if (line[secspace] == '\'' && line[secspace + 1] == ' ') break;
} }
const string point = line.substr(3, secspace - 3); const string point = line.substr(3, secspace - 3);
vluint64_t hits = std::atoll(line.c_str() + secspace + 1); uint64_t hits = std::atoll(line.c_str() + secspace + 1);
// UINFO(9," point '"<<point<<"'"<<" "<<hits<<endl); // UINFO(9," point '"<<point<<"'"<<" "<<hits<<endl);
vluint64_t pointnum = points().findAddPoint(point, hits); uint64_t pointnum = points().findAddPoint(point, hits);
if (pointnum) {} // Prevent unused if (pointnum) {} // Prevent unused
if (opt.rank()) { // Only if ranking - uses a lot of memory if (opt.rank()) { // Only if ranking - uses a lot of memory
if (hits >= VlcBuckets::sufficient()) { if (hits >= VlcBuckets::sufficient()) {
@ -117,7 +117,7 @@ void VlcTop::writeInfo(const string& filename) {
const int lineno = li.first; const int lineno = li.first;
VlcSource::ColumnMap& cmap = li.second; VlcSource::ColumnMap& cmap = li.second;
bool first = true; bool first = true;
vluint64_t min_count = 0; // Minimum across all columns on line uint64_t min_count = 0; // Minimum across all columns on line
for (auto& ci : cmap) { for (auto& ci : cmap) {
VlcSourceCount& col = ci.second; VlcSourceCount& col = ci.second;
if (first) { if (first) {
@ -146,7 +146,7 @@ struct CmpComputrons {
void VlcTop::rank() { void VlcTop::rank() {
UINFO(2, "rank...\n"); UINFO(2, "rank...\n");
vluint64_t nextrank = 1; uint64_t nextrank = 1;
// Sort by computrons, so fast tests get selected first // Sort by computrons, so fast tests get selected first
std::vector<VlcTest*> bytime; std::vector<VlcTest*> bytime;
@ -174,10 +174,10 @@ void VlcTop::rank() {
remaining.dump(); // LCOV_EXCL_LINE remaining.dump(); // LCOV_EXCL_LINE
} }
VlcTest* bestTestp = nullptr; VlcTest* bestTestp = nullptr;
vluint64_t bestRemain = 0; uint64_t bestRemain = 0;
for (const auto& testp : bytime) { for (const auto& testp : bytime) {
if (!testp->rank()) { if (!testp->rank()) {
vluint64_t remain = testp->buckets().dataPopCount(remaining); uint64_t remain = testp->buckets().dataPopCount(remaining);
if (remain > bestRemain) { if (remain > bestRemain) {
bestTestp = testp; bestTestp = testp;
bestRemain = remain; bestRemain = remain;

View File

@ -1808,7 +1808,7 @@ sub _make_main {
print $fh " sc_time sim_time($self->{sim_time}, $Self->{sc_time_resolution});\n"; print $fh " sc_time sim_time($self->{sim_time}, $Self->{sc_time_resolution});\n";
} else { } else {
print $fh "int main(int argc, char** argv, char** env) {\n"; print $fh "int main(int argc, char** argv, char** env) {\n";
print $fh " vluint64_t sim_time = $self->{sim_time};\n"; print $fh " uint64_t sim_time = $self->{sim_time};\n";
} }
print $fh " const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};\n"; print $fh " const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};\n";

View File

@ -22,7 +22,7 @@ if ($Self->{vlt_all}) {
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint32_t> \s+ &i8;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint32_t> \s+ &i8;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint32_t> \s+ &i16;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint32_t> \s+ &i16;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint32_t> \s+ &i32;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint32_t> \s+ &i32;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<vluint64_t> \s+ &i64;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint64_t> \s+ &i64;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<sc_bv<65>\s> \s+ &i65;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<sc_bv<65>\s> \s+ &i65;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<sc_bv<1>\s> \s+ &ibv1;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<sc_bv<1>\s> \s+ &ibv1;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<sc_bv<16>\s> \s+ &ibv16;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<sc_bv<16>\s> \s+ &ibv16;/x);
@ -33,7 +33,7 @@ if ($Self->{vlt_all}) {
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint32_t> \s+ &o8;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint32_t> \s+ &o8;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint32_t> \s+ &o16;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint32_t> \s+ &o16;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint32_t> \s+ &o32;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint32_t> \s+ &o32;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<vluint64_t> \s+ &o64;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint64_t> \s+ &o64;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<sc_bv<65>\s> \s+ &o65;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<sc_bv<65>\s> \s+ &o65;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<sc_bv<1>\s> \s+ &obv1;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<sc_bv<1>\s> \s+ &obv1;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<sc_bv<16>\s> \s+ &obv16;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<sc_bv<16>\s> \s+ &obv16;/x);

View File

@ -22,7 +22,7 @@ if ($Self->{vlt_all}) {
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint32_t> \s+ &i8;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint32_t> \s+ &i8;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint32_t> \s+ &i16;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint32_t> \s+ &i16;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint32_t> \s+ &i32;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint32_t> \s+ &i32;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<vluint64_t> \s+ &i64;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint64_t> \s+ &i64;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<sc_biguint<65>\s> \s+ &i65;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<sc_biguint<65>\s> \s+ &i65;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<sc_biguint<128>\s> \s+ &i128;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<sc_biguint<128>\s> \s+ &i128;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<sc_bv<513>\s> \s+ &i513;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<sc_bv<513>\s> \s+ &i513;/x);
@ -33,7 +33,7 @@ if ($Self->{vlt_all}) {
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint32_t> \s+ &o8;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint32_t> \s+ &o8;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint32_t> \s+ &o16;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint32_t> \s+ &o16;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint32_t> \s+ &o32;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint32_t> \s+ &o32;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<vluint64_t> \s+ &o64;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint64_t> \s+ &o64;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<sc_biguint<65>\s> \s+ &o65;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<sc_biguint<65>\s> \s+ &o65;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<sc_biguint<128>\s> \s+ &o128;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<sc_biguint<128>\s> \s+ &o128;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<sc_bv<513>\s> \s+ &o513;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<sc_bv<513>\s> \s+ &o513;/x);

View File

@ -22,7 +22,7 @@ if ($Self->{vlt_all}) {
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint8_t> \s+ &i8;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint8_t> \s+ &i8;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint16_t> \s+ &i16;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint16_t> \s+ &i16;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint32_t> \s+ &i32;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint32_t> \s+ &i32;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<vluint64_t> \s+ &i64;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<uint64_t> \s+ &i64;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<sc_bv<65>\s> \s+ &i65;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<sc_bv<65>\s> \s+ &i65;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<sc_bv<1>\s> \s+ &ibv1;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<sc_bv<1>\s> \s+ &ibv1;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<sc_bv<16>\s> \s+ &ibv16;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_in<sc_bv<16>\s> \s+ &ibv16;/x);
@ -31,7 +31,7 @@ if ($Self->{vlt_all}) {
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint8_t> \s+ &o8;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint8_t> \s+ &o8;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint16_t> \s+ &o16;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint16_t> \s+ &o16;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint32_t> \s+ &o32;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint32_t> \s+ &o32;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<vluint64_t> \s+ &o64;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<uint64_t> \s+ &o64;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<sc_bv<65>\s> \s+ &o65;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<sc_bv<65>\s> \s+ &o65;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<sc_bv<1>\s> \s+ &obv1;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<sc_bv<1>\s> \s+ &obv1;/x);
file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<sc_bv<16>\s> \s+ &obv16;/x); file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}.h", qr/sc_out<sc_bv<16>\s> \s+ &obv16;/x);