Support very wide $display arguments (#7280)
This commit is contained in:
parent
e5adb60461
commit
5d2d05236e
|
|
@ -99,6 +99,7 @@ Iru Cai
|
|||
Ivan Vnučec
|
||||
Iztok Jeras
|
||||
Jake Merdich
|
||||
Jakub Michalski
|
||||
Jakub Wasilewski
|
||||
jalcim
|
||||
James Bailey
|
||||
|
|
|
|||
|
|
@ -94,9 +94,6 @@
|
|||
#define VL_SOLVER_DEFAULT "z3 --in"
|
||||
#endif
|
||||
|
||||
// Max characters in static char string for VL_VALUE_STRING
|
||||
constexpr unsigned VL_VALUE_STRING_MAX_WIDTH = 8192;
|
||||
|
||||
//===========================================================================
|
||||
// Static sanity checks
|
||||
|
||||
|
|
@ -314,6 +311,22 @@ void VL_PRINTF_MT(const char* formatp, ...) VL_MT_SAFE {
|
|||
}});
|
||||
}
|
||||
|
||||
template <typename... snprintf_args_ts>
|
||||
static size_t _vl_snprintf_string(std::string& str, const char* format,
|
||||
snprintf_args_ts... args) VL_MT_SAFE {
|
||||
constexpr size_t FIRST_TRY_SIZE = 128;
|
||||
str.resize(FIRST_TRY_SIZE);
|
||||
size_t req_size = VL_SNPRINTF(&str[0], FIRST_TRY_SIZE + 1, format, args...);
|
||||
if (VL_LIKELY(req_size <= FIRST_TRY_SIZE)) {
|
||||
str.resize(req_size); // Resize the string down to the real size,
|
||||
// otherwise it will break things later
|
||||
return req_size;
|
||||
}
|
||||
str.resize(req_size);
|
||||
VL_SNPRINTF(&str[0], req_size + 1, format, args...);
|
||||
return req_size;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Process -- parts of std::process implementation
|
||||
|
||||
|
|
@ -806,10 +819,10 @@ double VL_ISTOR_D_W(int lbits, const WDataInP lwp) VL_MT_SAFE {
|
|||
std::string VL_DECIMAL_NW(int width, const WDataInP lwp) VL_MT_SAFE {
|
||||
const int maxdecwidth = (width + 3) * 4 / 3;
|
||||
// Or (maxdecwidth+7)/8], but can't have more than 4 BCD bits per word
|
||||
VlWide<VL_VALUE_STRING_MAX_WIDTH / 4 + 2> bcd;
|
||||
VL_ZERO_W(maxdecwidth, bcd);
|
||||
VlWide<VL_VALUE_STRING_MAX_WIDTH / 4 + 2> tmp;
|
||||
VlWide<VL_VALUE_STRING_MAX_WIDTH / 4 + 2> tmp2;
|
||||
std::vector<EData> bcd(VL_WORDS_I(maxdecwidth));
|
||||
VL_ZERO_W(maxdecwidth, bcd.data());
|
||||
std::vector<EData> tmp(VL_WORDS_I(maxdecwidth));
|
||||
std::vector<EData> tmp2(VL_WORDS_I(maxdecwidth));
|
||||
int from_bit = width - 1;
|
||||
// Skip all leading zeros
|
||||
for (; from_bit >= 0 && !(VL_BITRSHIFT_W(lwp, from_bit) & 1); --from_bit) {}
|
||||
|
|
@ -818,15 +831,15 @@ std::string VL_DECIMAL_NW(int width, const WDataInP lwp) VL_MT_SAFE {
|
|||
// Any digits >= 5 need an add 3 (via tmp)
|
||||
for (int nibble_bit = 0; nibble_bit < maxdecwidth; nibble_bit += 4) {
|
||||
if ((VL_BITRSHIFT_W(bcd, nibble_bit) & 0xf) >= 5) {
|
||||
VL_ZERO_W(maxdecwidth, tmp2);
|
||||
VL_ZERO_W(maxdecwidth, tmp2.data());
|
||||
tmp2[VL_BITWORD_E(nibble_bit)] |= VL_EUL(0x3) << VL_BITBIT_E(nibble_bit);
|
||||
VL_ASSIGN_W(maxdecwidth, tmp, bcd);
|
||||
VL_ADD_W(VL_WORDS_I(maxdecwidth), bcd, tmp, tmp2);
|
||||
VL_ASSIGN_W(maxdecwidth, tmp.data(), bcd.data());
|
||||
VL_ADD_W(VL_WORDS_I(maxdecwidth), bcd.data(), tmp.data(), tmp2.data());
|
||||
}
|
||||
}
|
||||
// Shift; bcd = bcd << 1
|
||||
VL_ASSIGN_W(maxdecwidth, tmp, bcd);
|
||||
VL_SHIFTL_WWI(maxdecwidth, maxdecwidth, 32, bcd, tmp, 1);
|
||||
VL_ASSIGN_W(maxdecwidth, tmp.data(), bcd.data());
|
||||
VL_SHIFTL_WWI(maxdecwidth, maxdecwidth, 32, bcd.data(), tmp.data(), 1);
|
||||
// bcd[0] = lwp[from_bit]
|
||||
if (VL_BITISSET_W(lwp, from_bit)) bcd[0] |= 1;
|
||||
}
|
||||
|
|
@ -842,7 +855,8 @@ std::string VL_DECIMAL_NW(int width, const WDataInP lwp) VL_MT_SAFE {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
std::string _vl_vsformat_time(char* tmp, T ld, int timeunit, bool left, size_t width) VL_MT_SAFE {
|
||||
std::string _vl_vsformat_time(std::string& tmp, T ld, int timeunit, bool left,
|
||||
size_t width) VL_MT_SAFE {
|
||||
const VerilatedContextImp* const ctxImpp = Verilated::threadContextp()->impp();
|
||||
const std::string suffix = ctxImpp->timeFormatSuffix();
|
||||
const int userUnits = ctxImpp->timeFormatUnits(); // 0..-15
|
||||
|
|
@ -889,19 +903,18 @@ std::string _vl_vsformat_time(char* tmp, T ld, int timeunit, bool left, size_t w
|
|||
VL_ASSIGN_W(b, v, divided);
|
||||
}
|
||||
if (!fracDigits) {
|
||||
digits = VL_SNPRINTF(tmp, VL_VALUE_STRING_MAX_WIDTH, "%s%s", ptr, suffix.c_str());
|
||||
digits = _vl_snprintf_string(tmp, "%s%s", ptr, suffix.c_str());
|
||||
} else {
|
||||
digits = VL_SNPRINTF(tmp, VL_VALUE_STRING_MAX_WIDTH, "%s.%0*" PRIu64 "%s", ptr,
|
||||
fracDigits, VL_SET_QW(frac), suffix.c_str());
|
||||
digits = _vl_snprintf_string(tmp, "%s.%0*" PRIu64 "%s", ptr, fracDigits,
|
||||
VL_SET_QW(frac), suffix.c_str());
|
||||
}
|
||||
} else {
|
||||
const uint64_t integer64 = VL_SET_QW(integer);
|
||||
if (!fracDigits) {
|
||||
digits = VL_SNPRINTF(tmp, VL_VALUE_STRING_MAX_WIDTH, "%" PRIu64 "%s", integer64,
|
||||
suffix.c_str());
|
||||
digits = _vl_snprintf_string(tmp, "%" PRIu64 "%s", integer64, suffix.c_str());
|
||||
} else {
|
||||
digits = VL_SNPRINTF(tmp, VL_VALUE_STRING_MAX_WIDTH, "%" PRIu64 ".%0*" PRIu64 "%s",
|
||||
integer64, fracDigits, VL_SET_QW(frac), suffix.c_str());
|
||||
digits = _vl_snprintf_string(tmp, "%" PRIu64 ".%0*" PRIu64 "%s", integer64,
|
||||
fracDigits, VL_SET_QW(frac), suffix.c_str());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -910,10 +923,9 @@ std::string _vl_vsformat_time(char* tmp, T ld, int timeunit, bool left, size_t w
|
|||
const double fracDiv = vl_time_multiplier(fracDigits);
|
||||
const double whole = scaled / fracDiv;
|
||||
if (!fracDigits) {
|
||||
digits = VL_SNPRINTF(tmp, VL_VALUE_STRING_MAX_WIDTH, "%.0f%s", whole, suffix.c_str());
|
||||
digits = _vl_snprintf_string(tmp, "%.0f%s", whole, suffix.c_str());
|
||||
} else {
|
||||
digits = VL_SNPRINTF(tmp, VL_VALUE_STRING_MAX_WIDTH, "%.*f%s", fracDigits, whole,
|
||||
suffix.c_str());
|
||||
digits = _vl_snprintf_string(tmp, "%.*f%s", fracDigits, whole, suffix.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -964,7 +976,7 @@ void _vl_vsformat(std::string& output, const std::string& format, int argc,
|
|||
}
|
||||
|
||||
// Parse format
|
||||
static thread_local char t_tmp[VL_VALUE_STRING_MAX_WIDTH];
|
||||
static thread_local std::string t_tmp;
|
||||
std::string::const_iterator pctit = format.end(); // Most recent %##.##g format
|
||||
bool inPct = false;
|
||||
bool widthSet = false;
|
||||
|
|
@ -1061,7 +1073,7 @@ void _vl_vsformat(std::string& output, const std::string& format, int argc,
|
|||
int lbits = 0;
|
||||
void* thingp = nullptr;
|
||||
QData ld = 0;
|
||||
VlWide<VL_VALUE_STRING_MAX_WIDTH / 4 + 2> strwide;
|
||||
std::vector<EData> strwide;
|
||||
WDataInP lwp = nullptr;
|
||||
int lsb = 0;
|
||||
double real = 0.0;
|
||||
|
|
@ -1071,8 +1083,9 @@ void _vl_vsformat(std::string& output, const std::string& format, int argc,
|
|||
} else if (formatAttr == VL_VFORMATATTR_DOUBLE) {
|
||||
real = va_arg(ap, double);
|
||||
ld = VL_RTOIROUND_Q_D(real);
|
||||
strwide.resize(2);
|
||||
VL_SET_WQ(strwide, ld);
|
||||
lwp = strwide;
|
||||
lwp = strwide.data();
|
||||
lbits = 64;
|
||||
// Not changint fmt == 'p' to fmt = 'g', as need fmts correct
|
||||
} else if (formatAttr == VL_VFORMATATTR_STRING) {
|
||||
|
|
@ -1082,8 +1095,9 @@ void _vl_vsformat(std::string& output, const std::string& format, int argc,
|
|||
lbits = va_arg(ap, int);
|
||||
if (lbits <= VL_QUADSIZE) {
|
||||
ld = VL_VA_ARG_Q_(ap, lbits);
|
||||
strwide.resize(2);
|
||||
VL_SET_WQ(strwide, ld);
|
||||
lwp = strwide;
|
||||
lwp = strwide.data();
|
||||
} else {
|
||||
lwp = va_arg(ap, WDataInP);
|
||||
ld = lwp[0];
|
||||
|
|
@ -1120,7 +1134,7 @@ void _vl_vsformat(std::string& output, const std::string& format, int argc,
|
|||
real = VL_ITOR_D_W(lbits, lwp);
|
||||
}
|
||||
const std::string fmts{pctit, pos + 1};
|
||||
VL_SNPRINTF(t_tmp, VL_VALUE_STRING_MAX_WIDTH, fmts.c_str(), real);
|
||||
_vl_snprintf_string(t_tmp, fmts.c_str(), real);
|
||||
output += t_tmp;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1148,7 +1162,7 @@ void _vl_vsformat(std::string& output, const std::string& format, int argc,
|
|||
// 'p' with NUMBER was earlier converted to 'd'
|
||||
if (formatAttr
|
||||
== VL_VFORMATATTR_DOUBLE) { // Can't just change to 'g' as need fixed format
|
||||
VL_SNPRINTF(t_tmp, VL_VALUE_STRING_MAX_WIDTH, "%g", real);
|
||||
_vl_snprintf_string(t_tmp, "%g", real);
|
||||
output += t_tmp;
|
||||
} else if (formatAttr == VL_VFORMATATTR_STRING) {
|
||||
const std::string* const strp = static_cast<const std::string*>(thingp);
|
||||
|
|
@ -1164,15 +1178,15 @@ void _vl_vsformat(std::string& output, const std::string& format, int argc,
|
|||
std::string append;
|
||||
if (formatAttr == VL_VFORMATATTR_SIGNED) {
|
||||
if (lbits <= VL_QUADSIZE) {
|
||||
digits
|
||||
= VL_SNPRINTF(t_tmp, VL_VALUE_STRING_MAX_WIDTH, "%" PRId64,
|
||||
static_cast<int64_t>(VL_EXTENDS_QQ(lbits, lbits, ld)));
|
||||
digits = _vl_snprintf_string(
|
||||
t_tmp, "%" PRId64,
|
||||
static_cast<int64_t>(VL_EXTENDS_QQ(lbits, lbits, ld)));
|
||||
append = t_tmp;
|
||||
} else {
|
||||
if (VL_SIGN_E(lbits, lwp[VL_WORDS_I(lbits) - 1])) {
|
||||
VlWide<VL_VALUE_STRING_MAX_WIDTH / 4 + 2> neg;
|
||||
VL_NEGATE_W(VL_WORDS_I(lbits), neg, lwp);
|
||||
append = "-"s + VL_DECIMAL_NW(lbits, neg);
|
||||
std::vector<EData> neg(VL_WORDS_I(lbits));
|
||||
VL_NEGATE_W(VL_WORDS_I(lbits), neg.data(), lwp);
|
||||
append = "-"s + VL_DECIMAL_NW(lbits, neg.data());
|
||||
} else {
|
||||
append = VL_DECIMAL_NW(lbits, lwp);
|
||||
}
|
||||
|
|
@ -1180,7 +1194,7 @@ void _vl_vsformat(std::string& output, const std::string& format, int argc,
|
|||
}
|
||||
} else { // Unsigned decimal
|
||||
if (lbits <= VL_QUADSIZE) {
|
||||
digits = VL_SNPRINTF(t_tmp, VL_VALUE_STRING_MAX_WIDTH, "%" PRIu64, ld);
|
||||
digits = _vl_snprintf_string(t_tmp, "%" PRIu64, ld);
|
||||
append = t_tmp;
|
||||
} else {
|
||||
append = VL_DECIMAL_NW(lbits, lwp);
|
||||
|
|
@ -1234,14 +1248,14 @@ void _vl_vsformat(std::string& output, const std::string& format, int argc,
|
|||
// V3Width errors on const %x of string, but V3Randomize may make a %x on a
|
||||
// string, or may have a runtime format
|
||||
const std::string* const strp = static_cast<const std::string*>(thingp);
|
||||
int chars = std::min(static_cast<int>(strp->size()),
|
||||
static_cast<int>(VL_VALUE_STRING_MAX_WIDTH / 2));
|
||||
int chars = static_cast<int>(strp->size());
|
||||
int truncFront = widthSet ? (chars - (static_cast<int>(width) / 2)) : 0;
|
||||
if (truncFront < 0) truncFront = 0;
|
||||
lbits = chars * 8;
|
||||
lwp = strwide;
|
||||
strwide.resize(VL_WORDS_I(lbits));
|
||||
lwp = strwide.data();
|
||||
lsb = lbits - 1;
|
||||
VL_NTOI_W(lbits, strwide, *strp, truncFront);
|
||||
VL_NTOI_W(lbits, strwide.data(), *strp, truncFront);
|
||||
}
|
||||
|
||||
if (widthSet || left) {
|
||||
|
|
@ -1372,9 +1386,10 @@ static void _vl_vsss_skipspace(FILE* fp, int& floc, const WDataInP fromp,
|
|||
}
|
||||
}
|
||||
static void _vl_vsss_read_str(FILE* fp, int& floc, const WDataInP fromp, const std::string& fstr,
|
||||
char* tmpp, const char* acceptp) VL_MT_SAFE {
|
||||
std::back_insert_iterator<std::string> tmpp,
|
||||
const char* acceptp) VL_MT_SAFE {
|
||||
// Read into tmp, consisting of characters from acceptp list
|
||||
char* cp = tmpp;
|
||||
auto cp = tmpp;
|
||||
while (true) {
|
||||
int c = _vl_vsss_peek(fp, floc, fromp, fstr);
|
||||
if (c == EOF || std::isspace(c)) break;
|
||||
|
|
@ -1383,7 +1398,6 @@ static void _vl_vsss_read_str(FILE* fp, int& floc, const WDataInP fromp, const s
|
|||
*cp++ = c;
|
||||
_vl_vsss_advance(fp, floc);
|
||||
}
|
||||
*cp++ = '\0';
|
||||
// VL_DBG_MSGF(" _read got='"<<tmpp<<"'\n");
|
||||
}
|
||||
static char* _vl_vsss_read_bin(FILE* fp, int& floc, const WDataInP fromp, const std::string& fstr,
|
||||
|
|
@ -1442,7 +1456,7 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
|
|||
// Read a Verilog $sscanf/$fscanf style format into the output list
|
||||
// The format must be pre-processed (and lower cased) by Verilator
|
||||
// Arguments are in "width, arg-value (or WDataIn* if wide)" form
|
||||
static thread_local char t_tmp[VL_VALUE_STRING_MAX_WIDTH];
|
||||
static thread_local std::string t_tmp;
|
||||
int floc = fbits - 1;
|
||||
IData got = 0;
|
||||
bool inPct = false;
|
||||
|
|
@ -1468,6 +1482,7 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
|
|||
|
||||
std::string::const_iterator pos = format.cbegin();
|
||||
for (; pos != format.cend(); ++pos) {
|
||||
t_tmp.clear();
|
||||
// VL_DBG_MSGF("_vlscan fmt='%c' floc=%d file='%c'\n", pos[0], floc,
|
||||
// _vl_vsss_peek(fp, floc, fromp, fstr));
|
||||
if (!inPct && pos[0] == '%') {
|
||||
|
|
@ -1530,6 +1545,7 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
|
|||
WDataOutP owp = (obits <= 64) ? qowp : static_cast<WDataOutP>(thingp);
|
||||
|
||||
for (int i = 0; i < VL_WORDS_I(obits); ++i) owp[i] = 0;
|
||||
t_tmp.clear();
|
||||
switch (fmt) {
|
||||
case 'c': {
|
||||
const int c = _vl_vsss_peek(fp, floc, fromp, fstr);
|
||||
|
|
@ -1540,9 +1556,10 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
|
|||
}
|
||||
case 's': {
|
||||
_vl_vsss_skipspace(fp, floc, fromp, fstr);
|
||||
_vl_vsss_read_str(fp, floc, fromp, fstr, t_tmp, nullptr);
|
||||
_vl_vsss_read_str(fp, floc, fromp, fstr,
|
||||
std::back_insert_iterator<std::string>{t_tmp}, nullptr);
|
||||
if (!t_tmp[0]) goto done;
|
||||
int lpos = (static_cast<int>(std::strlen(t_tmp))) - 1;
|
||||
int lpos = (static_cast<int>(t_tmp.size())) - 1;
|
||||
int lsb = 0;
|
||||
for (int i = 0; i < obits && lpos >= 0; --lpos) {
|
||||
_vl_vsss_setbit(owp, obits, lsb, 8, t_tmp[lpos]);
|
||||
|
|
@ -1552,15 +1569,17 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
|
|||
}
|
||||
case 'd': { // Signed/unsigned decimal
|
||||
_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,
|
||||
std::back_insert_iterator<std::string>{t_tmp},
|
||||
"0123456789+-xXzZ?_");
|
||||
if (!t_tmp[0]) goto done;
|
||||
if (formatAttr == VL_VFORMATATTR_SIGNED) {
|
||||
QData ld = 0;
|
||||
std::sscanf(t_tmp, "%30" PRIu64, &ld);
|
||||
std::sscanf(t_tmp.c_str(), "%30" PRIu64, &ld);
|
||||
VL_SET_WQ(owp, ld);
|
||||
} else if (formatAttr == VL_VFORMATATTR_UNSIGNED) {
|
||||
int64_t ld = 0;
|
||||
std::sscanf(t_tmp, "%30" PRId64, &ld);
|
||||
std::sscanf(t_tmp.c_str(), "%30" PRId64, &ld);
|
||||
VL_SET_WQ(owp, ld);
|
||||
}
|
||||
break;
|
||||
|
|
@ -1569,50 +1588,58 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
|
|||
case 'e':
|
||||
case 'g': { // Real number
|
||||
_vl_vsss_skipspace(fp, floc, fromp, fstr);
|
||||
_vl_vsss_read_str(fp, floc, fromp, fstr, t_tmp, "+-.0123456789eE");
|
||||
_vl_vsss_read_str(fp, floc, fromp, fstr,
|
||||
std::back_insert_iterator<std::string>{t_tmp},
|
||||
"+-.0123456789eE");
|
||||
if (!t_tmp[0]) goto done;
|
||||
union {
|
||||
double r;
|
||||
int64_t ld;
|
||||
} u;
|
||||
real = std::strtod(t_tmp, nullptr);
|
||||
real = std::strtod(t_tmp.c_str(), nullptr);
|
||||
u.r = real;
|
||||
VL_SET_WQ(owp, u.ld);
|
||||
break;
|
||||
}
|
||||
case 't': { // Time
|
||||
_vl_vsss_skipspace(fp, floc, fromp, fstr);
|
||||
_vl_vsss_read_str(fp, floc, fromp, fstr, t_tmp, "+-.0123456789eE");
|
||||
_vl_vsss_read_str(fp, floc, fromp, fstr,
|
||||
std::back_insert_iterator<std::string>{t_tmp},
|
||||
"+-.0123456789eE");
|
||||
if (!t_tmp[0]) goto done;
|
||||
// Timeunit was read earlier from up-front arguments
|
||||
const int userUnits = Verilated::threadContextp()->impp()->timeFormatUnits();
|
||||
// 0..-15
|
||||
const int shift = -userUnits + timeunit; // 0..-15
|
||||
real = std::strtod(t_tmp, nullptr) * vl_time_multiplier(-shift);
|
||||
real = std::strtod(t_tmp.c_str(), nullptr) * vl_time_multiplier(-shift);
|
||||
VL_SET_WQ(owp, static_cast<uint64_t>(real));
|
||||
break;
|
||||
}
|
||||
case 'b': {
|
||||
_vl_vsss_skipspace(fp, floc, fromp, fstr);
|
||||
_vl_vsss_read_str(fp, floc, fromp, fstr, t_tmp, "01xXzZ?_");
|
||||
_vl_vsss_read_str(fp, floc, fromp, fstr,
|
||||
std::back_insert_iterator<std::string>{t_tmp}, "01xXzZ?_");
|
||||
if (!t_tmp[0]) goto done;
|
||||
_vl_vsss_based(owp, obits, 1, t_tmp, 0, std::strlen(t_tmp));
|
||||
_vl_vsss_based(owp, obits, 1, t_tmp.c_str(), 0, t_tmp.size());
|
||||
break;
|
||||
}
|
||||
case 'o': {
|
||||
_vl_vsss_skipspace(fp, floc, fromp, fstr);
|
||||
_vl_vsss_read_str(fp, floc, fromp, fstr, t_tmp, "01234567xXzZ?_");
|
||||
_vl_vsss_read_str(fp, floc, fromp, fstr,
|
||||
std::back_insert_iterator<std::string>{t_tmp},
|
||||
"01234567xXzZ?_");
|
||||
if (!t_tmp[0]) goto done;
|
||||
_vl_vsss_based(owp, obits, 3, t_tmp, 0, std::strlen(t_tmp));
|
||||
_vl_vsss_based(owp, obits, 3, t_tmp.c_str(), 0, t_tmp.size());
|
||||
break;
|
||||
}
|
||||
case 'h': // FALLTHRU
|
||||
case 'x': {
|
||||
_vl_vsss_skipspace(fp, floc, fromp, fstr);
|
||||
_vl_vsss_read_str(fp, floc, fromp, fstr, t_tmp,
|
||||
_vl_vsss_read_str(fp, floc, fromp, fstr,
|
||||
std::back_insert_iterator<std::string>{t_tmp},
|
||||
"0123456789abcdefABCDEFxXzZ?_");
|
||||
if (!t_tmp[0]) goto done;
|
||||
_vl_vsss_based(owp, obits, 4, t_tmp, 0, std::strlen(t_tmp));
|
||||
_vl_vsss_based(owp, obits, 4, t_tmp.c_str(), 0, t_tmp.size());
|
||||
break;
|
||||
}
|
||||
case 'u': {
|
||||
|
|
@ -2227,14 +2254,10 @@ IData VL_VALUEPLUSARGS_INN(int, const std::string& ld, std::string& rdr) VL_MT_S
|
|||
|
||||
const char* vl_mc_scan_plusargs(const char* prefixp) VL_MT_SAFE {
|
||||
const std::string& match = Verilated::threadContextp()->impp()->argPlusMatch(prefixp);
|
||||
static thread_local char t_outstr[VL_VALUE_STRING_MAX_WIDTH];
|
||||
static thread_local std::string t_outstr;
|
||||
if (match.empty()) return nullptr;
|
||||
char* dp = t_outstr;
|
||||
for (const char* sp = match.c_str() + std::strlen(prefixp) + 1; // +1 to skip the "+"
|
||||
*sp && (dp - t_outstr) < (VL_VALUE_STRING_MAX_WIDTH - 2);)
|
||||
*dp++ = *sp++;
|
||||
*dp++ = '\0';
|
||||
return t_outstr;
|
||||
t_outstr = match.c_str() + std::strlen(prefixp) + 1;
|
||||
return t_outstr.c_str();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
@ -3050,13 +3073,10 @@ void VerilatedContext::commandArgsAdd(int argc, const char** argv)
|
|||
const char* VerilatedContext::commandArgsPlusMatch(const char* prefixp)
|
||||
VL_MT_SAFE_EXCLUDES(m_argMutex) {
|
||||
const std::string& match = impp()->argPlusMatch(prefixp);
|
||||
static thread_local char t_outstr[VL_VALUE_STRING_MAX_WIDTH];
|
||||
static thread_local std::string t_outstr;
|
||||
if (match.empty()) return "";
|
||||
char* dp = t_outstr;
|
||||
for (const char* sp = match.c_str(); *sp && (dp - t_outstr) < (VL_VALUE_STRING_MAX_WIDTH - 2);)
|
||||
*dp++ = *sp++;
|
||||
*dp++ = '\0';
|
||||
return t_outstr;
|
||||
t_outstr = match.c_str();
|
||||
return t_outstr.c_str();
|
||||
}
|
||||
void VerilatedContext::internalsDump() const VL_MT_SAFE {
|
||||
VL_PRINTF_MT("internalsDump:\n");
|
||||
|
|
|
|||
|
|
@ -3081,23 +3081,19 @@ void vl_vpi_get_value(const VerilatedVpioVarBase* vop, p_vpi_value valuep) {
|
|||
if (valuep->format == vpiVectorVal) {
|
||||
// Vector pointer must come from our memory pool
|
||||
// It only needs to persist until the next vpi_get_value
|
||||
static thread_local t_vpi_vecval t_out[VL_VALUE_STRING_MAX_WORDS * 2];
|
||||
valuep->value.vector = t_out;
|
||||
static thread_local std::vector<t_vpi_vecval> t_out;
|
||||
if (varp->vltype() == VLVT_WDATA) {
|
||||
const int words = VL_WORDS_I(varBits);
|
||||
if (VL_UNCOVERABLE(words >= VL_VALUE_STRING_MAX_WORDS)) {
|
||||
VL_VPI_ERROR_(
|
||||
__FILE__, __LINE__,
|
||||
"vpi_get_value with more than VL_VALUE_STRING_MAX_WORDS; increase and "
|
||||
"recompile");
|
||||
return;
|
||||
}
|
||||
t_out.resize(words);
|
||||
valuep->value.vector = t_out.data();
|
||||
for (int i = 0; i < words; ++i) {
|
||||
t_out[i].aval = get_word(vop, 32, i * 32);
|
||||
t_out[i].bval = 0;
|
||||
}
|
||||
return;
|
||||
} else if (varp->vltype() == VLVT_UINT64 && varBits > 32) {
|
||||
t_out.resize(2);
|
||||
valuep->value.vector = t_out.data();
|
||||
const QData data = get_word(vop, 64, 0);
|
||||
t_out[1].aval = static_cast<IData>(data >> 32ULL);
|
||||
t_out[1].bval = 0;
|
||||
|
|
@ -3105,6 +3101,8 @@ void vl_vpi_get_value(const VerilatedVpioVarBase* vop, p_vpi_value valuep) {
|
|||
t_out[0].bval = 0;
|
||||
return;
|
||||
} else {
|
||||
t_out.resize(1);
|
||||
valuep->value.vector = t_out.data();
|
||||
t_out[0].aval = get_word(vop, 32, 0);
|
||||
t_out[0].bval = 0;
|
||||
return;
|
||||
|
|
@ -3737,7 +3735,7 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
|
||||
const VerilatedVar* const varp = vop->varp();
|
||||
|
||||
static thread_local EData t_out_data[VL_VALUE_STRING_MAX_WORDS * 2];
|
||||
static thread_local std::vector<EData> t_out_data;
|
||||
|
||||
const unsigned size = vop->size();
|
||||
if (VL_UNCOVERABLE(num > size)) {
|
||||
|
|
@ -3751,13 +3749,9 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
= leftIsLow ? index_p[0] - vop->rangep()->left() : vop->rangep()->left() - index_p[0];
|
||||
|
||||
if (arrayvalue_p->format == vpiShortIntVal) {
|
||||
if (VL_UNCOVERABLE((sizeof(PLI_INT16) * num) >= VL_VALUE_STRING_MAX_CHARS)) {
|
||||
VL_FATAL_MT(__FILE__, __LINE__, "",
|
||||
"vpi_get_value_array with more than VL_VALUE_STRING_MAX_WORDS; "
|
||||
"increase and recompile");
|
||||
}
|
||||
t_out_data.resize(num * sizeof(PLI_INT16) / sizeof(EData));
|
||||
|
||||
PLI_INT16* shortintsp = reinterpret_cast<PLI_INT16*>(t_out_data);
|
||||
PLI_INT16* shortintsp = reinterpret_cast<PLI_INT16*>(t_out_data.data());
|
||||
arrayvalue_p->value.shortints = shortintsp;
|
||||
|
||||
if (varp->vltype() == VLVT_UINT8) {
|
||||
|
|
@ -3770,13 +3764,9 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
|
||||
return;
|
||||
} else if (arrayvalue_p->format == vpiIntVal) {
|
||||
if (VL_UNCOVERABLE(num >= VL_VALUE_STRING_MAX_WORDS)) {
|
||||
VL_FATAL_MT(__FILE__, __LINE__, "",
|
||||
"vpi_get_value_array with more than VL_VALUE_STRING_MAX_WORDS; "
|
||||
"increase and recompile");
|
||||
}
|
||||
t_out_data.resize(num * sizeof(PLI_INT32) / sizeof(EData));
|
||||
|
||||
PLI_INT32* integersp = reinterpret_cast<PLI_INT32*>(t_out_data);
|
||||
PLI_INT32* integersp = reinterpret_cast<PLI_INT32*>(t_out_data.data());
|
||||
arrayvalue_p->value.integers = integersp;
|
||||
|
||||
if (varp->vltype() == VLVT_UINT8) {
|
||||
|
|
@ -3792,13 +3782,9 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
|
||||
return;
|
||||
} else if (arrayvalue_p->format == vpiLongIntVal) {
|
||||
if (VL_UNCOVERABLE((sizeof(PLI_INT64) * num) >= VL_VALUE_STRING_MAX_CHARS)) {
|
||||
VL_FATAL_MT(__FILE__, __LINE__, "",
|
||||
"vpi_get_value_array with more than VL_VALUE_STRING_MAX_WORDS; "
|
||||
"increase and recompile");
|
||||
}
|
||||
t_out_data.resize(num * sizeof(PLI_INT64) / sizeof(EData));
|
||||
|
||||
PLI_INT64* longintsp = reinterpret_cast<PLI_INT64*>(t_out_data);
|
||||
PLI_INT64* longintsp = reinterpret_cast<PLI_INT64*>(t_out_data.data());
|
||||
arrayvalue_p->value.longints = longintsp;
|
||||
|
||||
if (varp->vltype() == VLVT_UINT8) {
|
||||
|
|
@ -3817,13 +3803,9 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
|
||||
return;
|
||||
} else if (arrayvalue_p->format == vpiVectorVal) {
|
||||
if (VL_UNCOVERABLE((VL_WORDS_I(varp->entBits()) * 2 * num) >= VL_VALUE_STRING_MAX_WORDS)) {
|
||||
VL_FATAL_MT(__FILE__, __LINE__, "",
|
||||
"vpi_get_value_array with more than VL_VALUE_STRING_MAX_WORDS; "
|
||||
"increase and recompile");
|
||||
}
|
||||
t_out_data.resize((VL_WORDS_I(varp->entBits()) * 4 * num));
|
||||
|
||||
p_vpi_vecval vectorsp = reinterpret_cast<p_vpi_vecval>(t_out_data);
|
||||
p_vpi_vecval vectorsp = reinterpret_cast<p_vpi_vecval>(t_out_data.data());
|
||||
arrayvalue_p->value.vectors = vectorsp;
|
||||
|
||||
if (varp->vltype() == VLVT_UINT8) {
|
||||
|
|
@ -3845,13 +3827,9 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
|
||||
return;
|
||||
} else if (arrayvalue_p->format == vpiRawFourStateVal) {
|
||||
if (VL_UNCOVERABLE((VL_BYTES_I(varp->entBits()) * 2 * num) >= VL_VALUE_STRING_MAX_CHARS)) {
|
||||
VL_FATAL_MT(__FILE__, __LINE__, "",
|
||||
"vpi_get_value_array with more than VL_VALUE_STRING_MAX_WORDS; "
|
||||
"increase and recompile");
|
||||
}
|
||||
t_out_data.resize((VL_BYTES_I(varp->entBits()) * 4 * num) / sizeof(EData));
|
||||
|
||||
PLI_BYTE8* valuep = reinterpret_cast<PLI_BYTE8*>(t_out_data);
|
||||
PLI_BYTE8* valuep = reinterpret_cast<PLI_BYTE8*>(t_out_data.data());
|
||||
arrayvalue_p->value.rawvals = valuep;
|
||||
|
||||
if (varp->vltype() == VLVT_UINT8) {
|
||||
|
|
@ -3873,13 +3851,9 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
|
||||
return;
|
||||
} else if (arrayvalue_p->format == vpiRawTwoStateVal) {
|
||||
if (VL_UNCOVERABLE((VL_BYTES_I(varp->entBits()) * num) >= VL_VALUE_STRING_MAX_CHARS)) {
|
||||
VL_FATAL_MT(__FILE__, __LINE__, "",
|
||||
"vpi_get_value_array with more than VL_VALUE_STRING_MAX_WORDS; "
|
||||
"increase and recompile");
|
||||
}
|
||||
t_out_data.resize((VL_BYTES_I(varp->entBits()) * 2 * num) / sizeof(EData));
|
||||
|
||||
PLI_BYTE8* valuep = reinterpret_cast<PLI_BYTE8*>(t_out_data);
|
||||
PLI_BYTE8* valuep = reinterpret_cast<PLI_BYTE8*>(t_out_data.data());
|
||||
arrayvalue_p->value.rawvals = valuep;
|
||||
|
||||
if (varp->vltype() == VLVT_UINT8) {
|
||||
|
|
|
|||
|
|
@ -498,11 +498,6 @@ using ssize_t = uint32_t; ///< signed size_t; returned from read()
|
|||
|
||||
#define VL_MULS_MAX_WORDS 128 ///< Max size in words of MULS operation
|
||||
|
||||
#ifndef VL_VALUE_STRING_MAX_WORDS
|
||||
#define VL_VALUE_STRING_MAX_WORDS 64 ///< Max size in words of String conversion operation
|
||||
#endif
|
||||
#define VL_VALUE_STRING_MAX_CHARS (VL_VALUE_STRING_MAX_WORDS) * 4
|
||||
|
||||
//=========================================================================
|
||||
// Base macros
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,6 @@
|
|||
|
||||
VL_DEFINE_DEBUG_FUNCTIONS;
|
||||
|
||||
// We use a static char array in VL_VALUE_STRING
|
||||
constexpr int VL_VALUE_STRING_MAX_WIDTH = 8192;
|
||||
|
||||
//######################################################################
|
||||
// EmitCFunc
|
||||
|
||||
|
|
@ -186,7 +183,6 @@ bool EmitCFunc::displayEmitHeader(AstNode* nodep, bool isScan) {
|
|||
puts(",");
|
||||
} else if (const AstSScanF* const dispp = VN_CAST(nodep, SScanF)) {
|
||||
isStmt = false;
|
||||
checkMaxWords(dispp->fromp());
|
||||
putns(nodep, "VL_SSCANF_I");
|
||||
emitIQW(dispp->fromp());
|
||||
puts("NX(");
|
||||
|
|
@ -321,11 +317,6 @@ void EmitCFunc::displayNode(AstNode* nodep, AstSFormatF* fmtp, // fmtp is nullp
|
|||
AstSFormatArg* const fargp = VN_CAST(argp, SFormatArg);
|
||||
AstNode* const subargp = fargp ? fargp->exprp() : argp;
|
||||
const VFormatAttr formatAttr = AstSFormatArg::formatAttrDefauled(fargp, subargp->dtypep());
|
||||
if (subargp->widthMin() > VL_VALUE_STRING_MAX_WIDTH) {
|
||||
nodep->v3warn(E_UNSUPPORTED, "Unsupported: Exceeded limit of "
|
||||
+ cvtToStr(VL_VALUE_STRING_MAX_WIDTH)
|
||||
+ " bits for any $display-like arguments");
|
||||
}
|
||||
puts(", '"s + formatAttr.ascii() + '\'');
|
||||
if (formatAttr.isSigned() || formatAttr.isUnsigned())
|
||||
puts("," + cvtToStr(subargp->widthMin()));
|
||||
|
|
|
|||
|
|
@ -985,18 +985,8 @@ public:
|
|||
puts(")");
|
||||
}
|
||||
void visit(AstFGetS* nodep) override {
|
||||
checkMaxWords(nodep);
|
||||
emitOpName(nodep, nodep->emitC(), nodep->strgp(), nodep->filep(), nullptr);
|
||||
}
|
||||
|
||||
void checkMaxWords(AstNode* nodep) {
|
||||
if (nodep->widthWords() > VL_VALUE_STRING_MAX_WORDS) {
|
||||
nodep->v3error(
|
||||
"String of "
|
||||
<< nodep->width()
|
||||
<< " bits exceeds hardcoded limit VL_VALUE_STRING_MAX_WORDS in verilatedos.h");
|
||||
}
|
||||
}
|
||||
void visit(AstFOpen* nodep) override {
|
||||
putns(nodep, "VL_FOPEN_NN(");
|
||||
iterateConst(nodep->filenamep());
|
||||
|
|
@ -1144,7 +1134,6 @@ public:
|
|||
puts(cvtToStr(nodep->lhsp()->widthWords()));
|
||||
putbs(", ");
|
||||
}
|
||||
checkMaxWords(nodep->lhsp());
|
||||
iterateAndNextConstNull(nodep->lhsp());
|
||||
puts(");\n");
|
||||
}
|
||||
|
|
@ -1156,7 +1145,6 @@ public:
|
|||
puts(cvtToStr(nodep->lhsp()->widthWords()));
|
||||
putbs(", ");
|
||||
}
|
||||
checkMaxWords(nodep->lhsp());
|
||||
iterateAndNextConstNull(nodep->lhsp());
|
||||
puts(")");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
[1000] cyc==99 crc=2961926edde3e5c6018be970cdbf327b72b5f3c5eab42995891005eec8767e5fdf03051edbe9d222ee756ee34d8d6c83ee877aad65c487140ac87d26c636a66214b4a69acad924c568cc8e8c79f97d07a6eedf91011919d0e3cdda5215ee58c942f6c4dea48b3f38abc77bf47e4f6d6a859fcc5b5d46ec9d2f6a5bf7b978b1ba7ca15d0713a2eb06ade1570c4e3a12db687625eef8dfebcb4095ab4bdffe79c1298f609307a5ef773a6432b855e3e54deb88ca342bf5a7fecc5f2f3e165a59cdb9179718a2d11c9d55f14d69f40b01e41fcb7335a8872a6ba7876ec684d6a3af0b82aa31cca6e26340a2589cf7bf886faa8d23844596dc71233c7025c5250a968b770ab72db90b03d8c045fb8848159df544a3a3bf063269be0aa11d5507f5c8b328b760a6df9e3fbe276faad8eadee126443ad3f99d595b12d0ae514b20693298a58642a07718f9ab7ea8c66575f7f8d0e3ba77d992235b3d5a4e015a7ff9b97a8c4f48ebdbfc2365e6bca4dd3ba6bfc7e850f7c8e2842c717a1d85a977a033f564fc
|
||||
[1000] cyc==99 crc=001010010110000110010010011011101101110111100011111001011100011000000001100010111110100101110000110011011011111100110010011110110111001010110101111100111100010111101010101101000010100110010101100010010001000000000101111011101100100001110110011111100101111111011111000000110000010100011110110110111110100111010010001000101110111001110101011011101110001101001101100011010110110010000011111011101000011101111010101011010110010111000100100001110001010000001010110010000111110100100110110001100011011010100110011000100001010010110100101001101001101011001010110110010010010011000101011010001100110010001110100011000111100111111001011111010000011110100110111011101101111110010001000000010001100100011001110100001110001111001101110110100101001000010101111011100101100011001001010000101111011011000100110111101010010010001011001111110011100010101011110001110111101111110100011111100100111101101101011010101000010110011111110011000101101101011101010001101110110010011101001011110110101001011011111101111011100101111000101100011011101001111100101000010101110100000111000100111010001011101011000001101010110111100001010101110000110001001110001110100001001011011011011010000111011000100101111011101111100011011111111010111100101101000000100101011010101101001011110111111111111001111001110000010010100110001111011000001001001100000111101001011110111101110111001110100110010000110010101110000101010111100011111001010100110111101011100010001100101000110100001010111111010110100111111111101100110001011111001011110011111000010110010110100101100111001101101110010001011110010111000110001010001011010001000111001001110101010101111100010100110101101001111101000000101100000001111001000001111111001011011100110011010110101000100001110010101001101011101001111000011101101110110001101000010011010110101000111010111100001011100000101010101000110001110011001010011011100010011000110100000010100010010110001001110011110111101111111000100001101111101010101000110100100011100001000100010110010110110111000111000100100011001111000111000000100101110001010010010100001010100101101000101101110111000010101011011100101101101110010000101100000011110110001100000001000101111110111000100001001000000101011001110111110101010001001010001110100011101111110000011000110010011010011011111000001010101000010001110101010101000001111111010111001000101100110010100010110111011000001010011011011111100111100011111110111110001001110110111110101010110110001110101011011110111000010010011001000100001110101101001111111001100111010101100101011011000100101101000010101110010100010100101100100000011010010011001010011000101001011000011001000010101000000111011100011000111110011010101101111110101010001100011001100101011101011111011111111000110100001110001110111010011101111101100110010010001000110101101100111101010110100100111000000001010110100111111111111001101110010111101010001100010011110100100011101011110110111111110000100011011001011110011010111100101001001101110100111011101001101011111111000111111010000101000011110111110010001110001010000100001011000111000101111010000111011000010110101001011101111010000000110011111101010110010011111100
|
||||
[1000] cyc==99 crc= 192314243495520504127180137665605561133560305907977980572645767762420453196342374495977142083848118677328199954410926369896470387779826147132723516820354745076860457032632655946297928255728968543964166745915172006024500132626396461497513804672014628580018696815895496904892573311712871137124627186823036370377082148964077834353576432995715302906436374312679204850016056851055146537811761039813530712318529622907625876150498063978827107035273870221450288314206660496208608548621605020041493219682464438277662325429134435589503822905673382871235792956484024240442019022849216374924803500568274820554281272350265796425759791074620124878429428705084086619154941929711081214730112189270917662133755927504973090032935288251106416702431782909854889556716921566895788432555014755596483195774905117946064848401749136388638264392835728943610481511493655476599575132747905704111318618362142719608098663894484755603093875223781532061693373185215889242346825339843957120175610142513806425858491904298073857757180300484308506723515542869574650162009995083578811279797165258789447261417648904090841951615620219210343536616611760602942069082200218122744797669849691256256914143691004480682378734732136104365496110765935242206618259991974927972253967904591669242599972548865510107070608718143710199973892533950791217737510447760214665455574778898984084649928310561709348592570630040924393719576972684775103740963711897488212566412285261684141049147038493082057728654475245685418692611046086916177619726327042435913876462912741744062626477808945937602702708559043677550545718729639564789686016768034885389371667322945962045339708859644745350107560231456297274591975535690890723227309742905197452710808864067084924551419665623703303492127600312657565814019788262142599637993410313060533535505190744866919168086263025083652438482534381972584226398647813067331564915556860113808411662278518472600154848627113327234349516655771371564824987604262514833008808755915821783619323472821171380365272017974773638895873997607360348205103244275430775849436470993582837942219143063734280171181186072801811860937440230009459378942573366338882426725376304788334498706706900331126843740948117848894078663523761038138970293371884820612174676878645956415113517889672401179617644822408399193933853978091469347076248825716575368029113888832188884836591924093968908846512378659140339127278000558482600311833521815576317005691099728347295613112351882151548155550195708458272930730104779388407706514146580359700012153700793880911961904037981934426797881839123917584995726302290398342698655235970621888327408750251749146202733350661829245408762765371160873101402050687419839422595131900151352350874494548302735298637915245293728266576723816034219941929237650918012439511062487972161344647475139192564256422217415056747847426423195683798570964894992935292499733057644641782001238491509105725839779490610849382796136259963442122306204881742728356709681613284209250977904814844089949159373731166754123849362954430242875984710832251703022693568971476216178703456218837061023464201612466860084323006808074236237284809547951595080393463452672584953315252195532834597010374088545898592272363738260797831454469728908113106997377908777724024504333339954837991829709271798283041855988927900694292704227233897976309516869509558209245732027598744927253507724438240759081646040766061349527797852972868564037503916874501828310558681433382857200322149705990214286394904729504488867658206260801932895083256926255992962722176246115053840651836711776131254912741035006382929790897586765726189324590678543267698153650888816232402279520795789721570854734287291604273987685084888542124181795193135695697328867265950927519773013077996419461076337052948303018030755554175597224267540738561512054606645611282521934570222767970974370347877506017032013223735133585753900693624202581869166894376460052515283897934854980350704737217452908027375874034386336270953642753754727116876258077964607425952484861152970448445407144222164023977347616465757966985494243261124132427167915059360004126321475390429511813864799289338304485792455088083494914874712852824353361937503504625670187682429441726077998332846204074745747686137315758984294578348675690749161715944165801841543769556469272419900648811037951119322715488662379613672410988536683707748251086239969257968523349070302086682211865107662437955524626158486478396860460350272770969106352208485163515581745404509973678946101638467577844188153925756994287365335216349933834594034103617151116056238489814519889368638998889650236159465828162514443648284678614916087818239350831730722849009229385042906274254283868515222773255448525713146763144584496385480320736796649625379708226896028738103738195259827505001252363855089211032187508959447247964915716218817576748737150963696083426373491060379892986155999667364066653815450591144691164065662262790201874319544086372872412700220648273448367078177172656980884343016579986406280715493018874633931094262310855932
|
||||
*-* All Finished *-*
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ module t (
|
|||
crc[2047:1024], crc[1023:0]);
|
||||
$write("[%0t] cyc==%0d crc=%b%b%b%b\n", $time, cyc, crc[4095:3072], crc[2071:2048],
|
||||
crc[2047:1024], crc[1023:0]);
|
||||
$write("[%0t] cyc==%0d crc=%d\n", $time, cyc, {crc, crc, crc, crc});
|
||||
//Unsupported: $write("[%0t] cyc==%0d crc=%x\n", $time, cyc, crc);
|
||||
if (crc != 4096'h2961926edde3e5c6018be970cdbf327b72b5f3c5eab42995891005eec8767e5fdf03051edbe9d222ee756ee34d8d6c83ee877aad65c487140ac87d26c636a66214b4a69acad924c568cc8e8c79f97d07a6eedf91011919d0e3cdda5215ee58c942f6c4dea48b3f38abc77bf47e4f6d6a859fcc5b5d46ec9d2f6a5bf7b978b1bac862198cc91ac594d07c165309da5ec1ad8ac6b417af8f0224269509cb79944a5b7374f45dd3f10cb48884363dabe942c0b3c8ccdbe330e828baff468e980d9a86d9bbcd1b80de445b5a32a8049e6b09dcb47cf35db4b2ef1a2b69be0fb09106c99e6d01521b7e2a9cd3a85ca6d030fe08843a390a08facff5b29dfb867ca15d0713a2eb06ade1570c4e3a12db687625eef8dfebcb4095ab4bdffe79c1298f609307a5ef773a6432b855e3e54deb88ca342bf5a7fecc5f2f3e165a59cdb9179718a2d11c9d55f14d69f40b01e41fcb7335a8872a6ba7876ec684d6a3af0b82aa31cca6e26340a2589cf7bf886faa8d23844596dc71233c7025c5250a968b770ab72db90b03d8c045fb8848159df544a3a3bf063269be0aa11d5507f5c8b328b760a6df9e3fbe276faad8eadee126443ad3f99d595b12d0ae514b20693298a58642a07718f9ab7ea8c66575f7f8d0e3ba77d992235b3d5a4e015a7ff9b97a8c4f48ebdbfc2365e6bca4dd3ba6bfc7e850f7c8e2842c717a1d85a977a033f564fc
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of either the GNU Lesser General Public License Version 3
|
||||
# or the Perl Artistic License Version 2.0.
|
||||
# SPDX-FileCopyrightText: 2024 Wilson Snyder
|
||||
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
import vltest_bootstrap
|
||||
|
||||
test.scenarios('vlt')
|
||||
|
||||
test.lint(fails=True, expect_filename=test.golden_filename)
|
||||
|
||||
test.passes()
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed under the Creative Commons Public Domain.
|
||||
// SPDX-FileCopyrightText: 2011 Wilson Snyder
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
module t (
|
||||
input clk
|
||||
);
|
||||
|
||||
integer cyc = 0;
|
||||
reg [4095:0] crc;
|
||||
|
||||
// Test loop
|
||||
always @(posedge clk) begin
|
||||
cyc <= cyc + 1;
|
||||
crc <= {crc[4094:0], crc[63] ^ crc[2] ^ crc[0]}; // not a good crc :)
|
||||
if (cyc == 0) begin
|
||||
// Setup
|
||||
crc <= 4096'h9f51804b5275c7b6ab9907144a58649bb778f9718062fa5c336fcc9edcad7cf17aad0a656244017bb21d9f97f7c0c147b6fa7488bb9d5bb8d3635b20fba1deab597121c502b21f49b18da998852d29a6b2b649315a3323a31e7e5f41e9bbb7e44046467438f37694857b963250bdb137a922cfce2af1defd1f93db5aa167f316d751bb274bda96fdee5e2c6eb21886633246b165341f0594c27697b06b62b1ad05ebe3c08909a54272de651296dcdd3d1774fc432d22210d8f6afa50b02cf23336f8cc3a0a2ebfd1a3a60366a1b66ef346e0379116d68caa01279ac2772d1f3cd76d2cbbc68ada6f83ec2441b2679b405486df8aa734ea1729b40c3f82210e8e42823eb3fd6ca77ee19f285741c4e8bac1ab7855c3138e84b6da1d897bbe37faf2d0256ad2f7ff9e704a63d824c1e97bddce990cae1578f9537ae2328d0afd69ffb317cbcf859696736e45e5c628b44727557c535a7d02c07907f2dccd6a21ca9ae9e1dbb1a135a8ebc2e0aa8c7329b898d02896273defe21beaa348e11165b71c48cf1c09714942a5a2ddc2adcb6e42c0f630117ee21205677d5128e8efc18c9a6f82a8475541fd722cca2dd829b7e78fef89dbeab63ab7b849910eb4fe675656c4b42b9452c81a4ca6296190a81dc63e6adfaa31995d7dfe3438ee9df66488d6cf569380569ffe6e5ea313d23af6ff08d979af29374ee9aff1fa143df238a1;
|
||||
end
|
||||
else if (cyc == 99) begin
|
||||
$write("[%0t] cyc==%0d crc=%d\n", $time, cyc, {crc, crc, crc, crc}); // Too wide
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
end
|
||||
endmodule
|
||||
|
|
@ -232,19 +232,19 @@ int _mon_check_value_callbacks() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int _mon_check_too_big() {
|
||||
int _mon_check_big() {
|
||||
#ifdef VERILATOR
|
||||
s_vpi_value v;
|
||||
v.format = vpiVectorVal;
|
||||
|
||||
TestVpiHandle h = VPI_HANDLE("too_big");
|
||||
TestVpiHandle h = VPI_HANDLE("big");
|
||||
CHECK_RESULT_NZ(h);
|
||||
|
||||
Verilated::fatalOnVpiError(false);
|
||||
vpi_get_value(h, &v);
|
||||
Verilated::fatalOnVpiError(true);
|
||||
s_vpi_error_info info;
|
||||
CHECK_RESULT_NZ(vpi_chk_error(&info));
|
||||
CHECK_RESULT_Z(vpi_chk_error(&info));
|
||||
|
||||
v.format = vpiStringVal;
|
||||
vpi_get_value(h, &v);
|
||||
|
|
@ -1559,7 +1559,7 @@ extern "C" int mon_check() {
|
|||
if (int status = _mon_check_vlog_info()) return status;
|
||||
if (int status = _mon_check_multi_index()) return status;
|
||||
if (int status = _mon_check_delayed()) return status;
|
||||
if (int status = _mon_check_too_big()) return status;
|
||||
if (int status = _mon_check_big()) return status;
|
||||
#ifndef IS_VPI
|
||||
VerilatedVpi::selfTest();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ extern "C" int mon_check();
|
|||
reg [31:0] text_word /*verilator public_flat_rw @(posedge clk) */;
|
||||
reg [63:0] text_long /*verilator public_flat_rw @(posedge clk) */;
|
||||
reg [511:0] text /*verilator public_flat_rw @(posedge clk) */;
|
||||
reg [2047:0] too_big /*verilator public_flat_rw @(posedge clk) */;
|
||||
reg [2047:0] big /*verilator public_flat_rw @(posedge clk) */;
|
||||
|
||||
integer status;
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ extern "C" int mon_check();
|
|||
text_word = "Word";
|
||||
text_long = "Long64b";
|
||||
text = "Verilog Test module";
|
||||
too_big = "some text";
|
||||
big = "some text";
|
||||
|
||||
bit1 = 1;
|
||||
integer1 = 123;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ extern "C" int mon_check();
|
|||
reg [31:0] text_word;
|
||||
reg [63:0] text_long;
|
||||
reg [511:0] text;
|
||||
reg [2047:0] too_big;
|
||||
reg [2047:0] big;
|
||||
/*verilator public_off*/
|
||||
integer status;
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ extern "C" int mon_check();
|
|||
text_word = "Word";
|
||||
text_long = "Long64b";
|
||||
text = "Verilog Test module";
|
||||
too_big = "some text";
|
||||
big = "some text";
|
||||
|
||||
bit1 = 1;
|
||||
integer1 = 123;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ extern "C" int mon_check();
|
|||
reg [31:0] text_word;
|
||||
reg [63:0] text_long;
|
||||
reg [511:0] text;
|
||||
reg [2047:0] too_big;
|
||||
reg [2047:0] big;
|
||||
|
||||
integer status;
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ extern "C" int mon_check();
|
|||
text_word = "Word";
|
||||
text_long = "Long64b";
|
||||
text = "Verilog Test module";
|
||||
too_big = "some text";
|
||||
big = "some text";
|
||||
|
||||
bit1 = 1;
|
||||
integer1 = 123;
|
||||
|
|
|
|||
Loading…
Reference in New Issue