Internals: Detab and fix spacing style issues in include files. No functional change.

When merging, recommend using "git merge -Xignore-all-space"
This commit is contained in:
Wilson Snyder 2019-05-08 21:13:38 -04:00
parent b23fc06388
commit f96942a526
4 changed files with 1617 additions and 1588 deletions

View File

@ -1790,7 +1790,8 @@ void Verilated::flushCb(VerilatedVoidCb cb) VL_MT_SAFE {
else if (!s_flushCb) { s_flushCb=cb; }
else {
// Someday we may allow multiple callbacks ala atexit(), but until then
VL_FATAL_MT("unknown",0,"", "Verilated::flushCb called twice with different callbacks");
VL_FATAL_MT("unknown", 0, "",
"Verilated::flushCb called twice with different callbacks");
}
}
@ -2079,7 +2080,8 @@ void VerilatedScope::exportInsert(int finalize, const char* namep, void* cb) VL_
if (funcnum >= m_funcnumMax) { m_funcnumMax = funcnum+1; }
} else {
if (VL_UNLIKELY(funcnum >= m_funcnumMax)) {
VL_FATAL_MT(__FILE__,__LINE__,"","Internal: Bad funcnum vs. pre-finalize maximum");
VL_FATAL_MT(__FILE__, __LINE__, "",
"Internal: Bad funcnum vs. pre-finalize maximum");
}
if (VL_UNLIKELY(!m_callbacksp)) { // First allocation
m_callbacksp = new void* [m_funcnumMax];

View File

@ -753,17 +753,17 @@ extern double sc_time_stamp();
#define VL_CLEAN_QQ(obits,lbits,lhs) ((lhs) & VL_MASK_Q(obits))
// EMIT_RULE: VL_ASSIGNCLEAN: oclean=clean; obits==lbits;
#define VL_ASSIGNCLEAN_W(obits,owp,lwp) VL_CLEAN_WW(obits,obits,owp,lwp)
#define VL_ASSIGNCLEAN_W(obits,owp,lwp) VL_CLEAN_WW((obits), (obits), (owp), (lwp))
static inline WDataOutP _VL_CLEAN_INPLACE_W(int obits, WDataOutP owp) VL_MT_SAFE {
int words = VL_WORDS_I(obits);
owp[words-1] &= VL_MASK_I(obits);
return(owp);
return owp;
}
static inline WDataOutP VL_CLEAN_WW(int obits, int, WDataOutP owp, WDataInP lwp) VL_MT_SAFE {
int words = VL_WORDS_I(obits);
for (int i=0; (i < (words-1)); ++i) owp[i] = lwp[i];
owp[words-1] = lwp[words-1] & VL_MASK_I(obits);
return(owp);
return owp;
}
static inline WDataOutP VL_ZERO_W(int obits, WDataOutP owp) VL_MT_SAFE {
int words = VL_WORDS_I(obits);
@ -783,7 +783,7 @@ static inline WDataOutP VL_ALLONES_W(int obits, WDataOutP owp) VL_MT_SAFE {
static inline WDataOutP VL_ASSIGN_W(int obits, WDataOutP owp, WDataInP lwp) VL_MT_SAFE {
int words = VL_WORDS_I(obits);
for (int i=0; i < words; ++i) owp[i] = lwp[i];
return(owp);
return owp;
}
// EMIT_RULE: VL_ASSIGNBIT: rclean=clean;
@ -913,17 +913,17 @@ static inline WDataOutP VL_EXTEND_WI(int obits, int, WDataOutP owp, IData ld) VL
// Note for extracts that obits != lbits
owp[0] = ld;
for (int i=1; i < VL_WORDS_I(obits); ++i) owp[i] = 0;
return(owp);
return owp;
}
static inline WDataOutP VL_EXTEND_WQ(int obits, int, WDataOutP owp, QData ld) VL_MT_SAFE {
VL_SET_WQ(owp, ld);
for (int i=2; i < VL_WORDS_I(obits); ++i) owp[i] = 0;
return(owp);
return owp;
}
static inline WDataOutP VL_EXTEND_WW(int obits, int lbits, WDataOutP owp, WDataInP lwp) VL_MT_SAFE {
for (int i=0; i < VL_WORDS_I(lbits); ++i) owp[i] = lwp[i];
for (int i=VL_WORDS_I(lbits); i < VL_WORDS_I(obits); ++i) owp[i] = 0;
return(owp);
return owp;
}
// EMIT_RULE: VL_EXTENDS: oclean=*dirty*; obits=lbits;
@ -942,14 +942,14 @@ static inline WDataOutP VL_EXTENDS_WI(int obits, int lbits, WDataOutP owp, IData
IData sign = VL_SIGNONES_I(lbits, ld);
owp[0] = ld | (sign & ~VL_MASK_I(lbits));
for (int i=1; i < VL_WORDS_I(obits); ++i) owp[i] = sign;
return(owp);
return owp;
}
static inline WDataOutP VL_EXTENDS_WQ(int obits, int lbits, WDataOutP owp, QData ld) VL_MT_SAFE {
VL_SET_WQ(owp, ld);
IData sign = VL_SIGNONES_I(lbits, owp[1]);
owp[1] |= sign & ~VL_MASK_I(lbits);
for (int i=2; i < VL_WORDS_I(obits); ++i) owp[i] = sign;
return(owp);
return owp;
}
static inline WDataOutP VL_EXTENDS_WW(int obits, int lbits, WDataOutP owp, WDataInP lwp) VL_MT_SAFE {
for (int i=0; i < VL_WORDS_I(lbits)-1; ++i) owp[i] = lwp[i];
@ -957,7 +957,7 @@ static inline WDataOutP VL_EXTENDS_WW(int obits, int lbits, WDataOutP owp, WData
IData sign = VL_SIGNONES_I(lbits, lwp[lmsw]);
owp[lmsw] = lwp[lmsw] | (sign & ~VL_MASK_I(lbits));
for (int i=VL_WORDS_I(lbits); i < VL_WORDS_I(obits); ++i) owp[i] = sign;
return(owp);
return owp;
}
//===================================================================
@ -1140,12 +1140,12 @@ static inline IData VL_MOSTSETBITP1_W(int words, WDataInP lwp) VL_MT_SAFE {
// EMIT_RULE: VL_AND: oclean=lclean||rclean; obits=lbits; lbits==rbits;
static inline WDataOutP VL_AND_W(int words, WDataOutP owp, WDataInP lwp, WDataInP rwp) VL_MT_SAFE {
for (int i=0; (i < words); ++i) owp[i] = (lwp[i] & rwp[i]);
return(owp);
return owp;
}
// EMIT_RULE: VL_OR: oclean=lclean&&rclean; obits=lbits; lbits==rbits;
static inline WDataOutP VL_OR_W(int words, WDataOutP owp, WDataInP lwp, WDataInP rwp) VL_MT_SAFE {
for (int i=0; (i < words); ++i) owp[i] = (lwp[i] | rwp[i]);
return(owp);
return owp;
}
// EMIT_RULE: VL_CHANGEXOR: oclean=1; obits=32; lbits==rbits;
static inline IData VL_CHANGEXOR_W(int words, WDataInP lwp, WDataInP rwp) VL_MT_SAFE {
@ -1156,17 +1156,17 @@ static inline IData VL_CHANGEXOR_W(int words, WDataInP lwp,WDataInP rwp) VL_MT_S
// EMIT_RULE: VL_XOR: oclean=lclean&&rclean; obits=lbits; lbits==rbits;
static inline WDataOutP VL_XOR_W(int words, WDataOutP owp, WDataInP lwp, WDataInP rwp) VL_MT_SAFE {
for (int i=0; (i < words); ++i) owp[i] = (lwp[i] ^ rwp[i]);
return(owp);
return owp;
}
// EMIT_RULE: VL_XNOR: oclean=dirty; obits=lbits; lbits==rbits;
static inline WDataOutP VL_XNOR_W(int words, WDataOutP owp, WDataInP lwp, WDataInP rwp) VL_MT_SAFE {
for (int i=0; (i < words); ++i) owp[i] = (lwp[i] ^ ~rwp[i]);
return(owp);
return owp;
}
// EMIT_RULE: VL_NOT: oclean=dirty; obits=lbits;
static inline WDataOutP VL_NOT_W(int words, WDataOutP owp, WDataInP lwp) VL_MT_SAFE {
for (int i=0; i < words; ++i) owp[i] = ~(lwp[i]);
return(owp);
return owp;
}
//=========================================================================
@ -1286,18 +1286,18 @@ static inline WDataOutP VL_ADD_W(int words, WDataOutP owp,WDataInP lwp,WDataInP
owp[i] = (carry & VL_ULL(0xffffffff));
carry = (carry >> VL_ULL(32)) & VL_ULL(0xffffffff);
}
return(owp);
return owp;
}
static inline WDataOutP VL_SUB_W(int words, WDataOutP owp, WDataInP lwp, WDataInP rwp) VL_MT_SAFE {
QData carry = 0;
for (int i=0; i<words; ++i) {
carry = carry + static_cast<QData>(lwp[i]) + static_cast<QData>(static_cast<IData>(~rwp[i]));
if (i==0) carry++; // Negation of temp2
if (i==0) ++carry; // Negation of temp2
owp[i] = (carry & VL_ULL(0xffffffff));
carry = (carry >> VL_ULL(32)) & VL_ULL(0xffffffff);
}
return(owp);
return owp;
}
// Optimization bug in GCC 2.96 and presumably all-pre GCC 3 versions need this workaround,
@ -1310,11 +1310,11 @@ static inline WDataOutP VL_NEGATE_W(int words, WDataOutP owp, WDataInP lwp) VL_M
QData carry = 0;
for (int i=0; i<words; ++i) {
carry = carry + static_cast<QData>(static_cast<IData>(~lwp[i]));
if (i==0) carry++; // Negation of temp2
if (i==0) ++carry; // Negation of temp2
owp[i] = (carry & VL_ULL(0xffffffff));
carry = (carry >> VL_ULL(32)) & VL_ULL(0xffffffff);
}
return(owp);
return owp;
}
static inline WDataOutP VL_MUL_W(int words, WDataOutP owp, WDataInP lwp, WDataInP rwp) VL_MT_SAFE {
@ -1330,7 +1330,7 @@ static inline WDataOutP VL_MUL_W(int words, WDataOutP owp,WDataInP lwp,WDataInP
}
}
// Last output word is dirty
return(owp);
return owp;
}
static inline IData VL_MULS_III(int, int lbits, int, IData lhs, IData rhs) VL_PURE {
@ -1370,14 +1370,14 @@ static inline WDataOutP VL_MULS_WWW(int,int lbits,int, WDataOutP owp,WDataInP lw
QData carry = 0;
for (int i=0; i<words; ++i) {
carry = carry + static_cast<QData>(static_cast<IData>(~owp[i]));
if (i==0) carry++; // Negation of temp2
if (i==0) ++carry; // Negation of temp2
owp[i] = (carry & VL_ULL(0xffffffff));
carry = (carry >> VL_ULL(32)) & VL_ULL(0xffffffff);
}
//Not needed: owp[words-1] |= 1<<VL_BITBIT_I(lbits-1); // Set sign bit
}
// Last output word is dirty
return(owp);
return owp;
}
static inline IData VL_DIVS_III(int lbits, IData lhs, IData rhs) VL_PURE {
@ -1649,7 +1649,7 @@ static inline WDataOutP VL_REPLICATE_WII(int obits, int lbits, int,
for (unsigned i=1; i < rep; ++i){
_VL_INSERT_WI(obits, owp, ld, i*lbits+lbits-1, i*lbits);
}
return(owp);
return owp;
}
static inline WDataOutP VL_REPLICATE_WQI(int obits, int lbits, int,
WDataOutP owp, QData ld, IData rep) VL_MT_SAFE {
@ -1657,7 +1657,7 @@ static inline WDataOutP VL_REPLICATE_WQI(int obits, int lbits, int,
for (unsigned i=1; i < rep; ++i){
_VL_INSERT_WQ(obits, owp, ld, i*lbits+lbits-1, i*lbits);
}
return(owp);
return owp;
}
static inline WDataOutP VL_REPLICATE_WWI(int obits, int lbits, int,
WDataOutP owp, WDataInP lwp, IData rep) VL_MT_SAFE {
@ -1665,7 +1665,7 @@ static inline WDataOutP VL_REPLICATE_WWI(int obits, int lbits, int,
for (unsigned i=1; i < rep; ++i){
_VL_INSERT_WW(obits, owp, lwp, i*lbits+lbits-1, i*lbits);
}
return(owp);
return owp;
}
// Left stream operator. Output will always be clean. LHS and RHS must be clean.
@ -1811,63 +1811,63 @@ static inline WDataOutP VL_CONCAT_WII(int obits, int lbits, int rbits,
owp[0] = rd;
for (int i=1; i < VL_WORDS_I(obits); ++i) owp[i] = 0;
_VL_INSERT_WI(obits, owp, ld, rbits+lbits-1, rbits);
return(owp);
return owp;
}
static inline WDataOutP VL_CONCAT_WWI(int obits, int lbits, int rbits,
WDataOutP owp, WDataInP lwp, IData rd) VL_MT_SAFE {
owp[0] = rd;
for (int i=1; i < VL_WORDS_I(obits); ++i) owp[i] = 0;
_VL_INSERT_WW(obits, owp, lwp, rbits+lbits-1, rbits);
return(owp);
return owp;
}
static inline WDataOutP VL_CONCAT_WIW(int obits, int lbits, int rbits,
WDataOutP owp, IData ld, WDataInP rwp) VL_MT_SAFE {
for (int i=0; i < VL_WORDS_I(rbits); ++i) owp[i] = rwp[i];
for (int i=VL_WORDS_I(rbits); i < VL_WORDS_I(obits); ++i) owp[i] = 0;
_VL_INSERT_WI(obits, owp, ld, rbits+lbits-1, rbits);
return(owp);
return owp;
}
static inline WDataOutP VL_CONCAT_WIQ(int obits, int lbits, int rbits,
WDataOutP owp, IData ld, QData rd) VL_MT_SAFE {
VL_SET_WQ(owp, rd);
for (int i=2; i < VL_WORDS_I(obits); ++i) owp[i] = 0;
_VL_INSERT_WI(obits, owp, ld, rbits+lbits-1, rbits);
return(owp);
return owp;
}
static inline WDataOutP VL_CONCAT_WQI(int obits, int lbits, int rbits,
WDataOutP owp, QData ld, IData rd) VL_MT_SAFE {
owp[0] = rd;
for (int i=1; i < VL_WORDS_I(obits); ++i) owp[i] = 0;
_VL_INSERT_WQ(obits, owp, ld, rbits+lbits-1, rbits);
return(owp);
return owp;
}
static inline WDataOutP VL_CONCAT_WQQ(int obits, int lbits, int rbits,
WDataOutP owp, QData ld, QData rd) VL_MT_SAFE {
VL_SET_WQ(owp, rd);
for (int i=2; i < VL_WORDS_I(obits); ++i) owp[i] = 0;
_VL_INSERT_WQ(obits, owp, ld, rbits+lbits-1, rbits);
return(owp);
return owp;
}
static inline WDataOutP VL_CONCAT_WWQ(int obits, int lbits, int rbits,
WDataOutP owp, WDataInP lwp, QData rd) VL_MT_SAFE {
VL_SET_WQ(owp, rd);
for (int i=2; i < VL_WORDS_I(obits); ++i) owp[i] = 0;
_VL_INSERT_WW(obits, owp, lwp, rbits+lbits-1, rbits);
return(owp);
return owp;
}
static inline WDataOutP VL_CONCAT_WQW(int obits, int lbits, int rbits,
WDataOutP owp, QData ld, WDataInP rwp) VL_MT_SAFE {
for (int i=0; i < VL_WORDS_I(rbits); ++i) owp[i] = rwp[i];
for (int i=VL_WORDS_I(rbits); i < VL_WORDS_I(obits); ++i) owp[i] = 0;
_VL_INSERT_WQ(obits, owp, ld, rbits+lbits-1, rbits);
return(owp);
return owp;
}
static inline WDataOutP VL_CONCAT_WWW(int obits, int lbits, int rbits,
WDataOutP owp, WDataInP lwp, WDataInP rwp) VL_MT_SAFE {
for (int i=0; i < VL_WORDS_I(rbits); ++i) owp[i] = rwp[i];
for (int i=VL_WORDS_I(rbits); i < VL_WORDS_I(obits); ++i) owp[i] = 0;
_VL_INSERT_WW(obits, owp, lwp, rbits+lbits-1, rbits);
return(owp);
return owp;
}
//===================================================================
@ -1900,7 +1900,7 @@ static inline WDataOutP VL_SHIFTL_WWI(int obits,int,int,WDataOutP owp,WDataInP l
for (int i=0; i < VL_WORDS_I(obits); ++i) owp[i] = 0;
_VL_INSERT_WW(obits, owp, lwp, obits-1, rd);
}
return(owp);
return owp;
}
static inline WDataOutP VL_SHIFTL_WWW(int obits, int lbits, int rbits,
WDataOutP owp, WDataInP lwp, WDataInP rwp) VL_MT_SAFE {
@ -1956,7 +1956,7 @@ static inline WDataOutP VL_SHIFTR_WWI(int obits, int, int,
}
for (int i=words; i<VL_WORDS_I(obits); ++i) owp[i]=0;
}
return(owp);
return owp;
}
static inline WDataOutP VL_SHIFTR_WWW(int obits, int lbits, int rbits,
WDataOutP owp, WDataInP lwp, WDataInP rwp) VL_MT_SAFE {
@ -2035,7 +2035,7 @@ static inline WDataOutP VL_SHIFTRS_WWI(int obits, int lbits, int,
for (int i=words; i<VL_WORDS_I(obits); ++i) owp[i] = sign;
owp[lmsw] &= VL_MASK_I(lbits);
}
return(owp);
return owp;
}
static inline WDataOutP VL_SHIFTRS_WWW(int obits, int lbits, int rbits,
WDataOutP owp, WDataInP lwp, WDataInP rwp) VL_MT_SAFE {
@ -2207,10 +2207,11 @@ static inline void VL_ASSIGNSEL_WIIW(int obits, int lsb, WDataOutP owp, WDataInP
// Triops
static inline WDataOutP VL_COND_WIWW(int obits, int, int, int,
WDataOutP owp, int cond, WDataInP w1p, WDataInP w2p) VL_MT_SAFE {
WDataOutP owp, int cond,
WDataInP w1p, WDataInP w2p) VL_MT_SAFE {
int words = VL_WORDS_I(obits);
for (int i=0; i < words; ++i) owp[i] = cond ? w1p[i] : w2p[i];
return(owp);
return owp;
}
//======================================================================
@ -2243,19 +2244,23 @@ static inline WDataOutP VL_CONST_W_4X(int obits, WDataOutP o,
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3;
_END(obits,4); }
static inline WDataOutP VL_CONST_W_5X(int obits, WDataOutP o,
IData d4,IData d3,IData d2,IData d1,IData d0) VL_MT_SAFE {
IData d4,
IData d3, IData d2, IData d1, IData d0) VL_MT_SAFE {
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4;
_END(obits,5); }
static inline WDataOutP VL_CONST_W_6X(int obits, WDataOutP o,
IData d5,IData d4,IData d3,IData d2,IData d1,IData d0) VL_MT_SAFE {
IData d5, IData d4,
IData d3, IData d2, IData d1, IData d0) VL_MT_SAFE {
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5;
_END(obits,6); }
static inline WDataOutP VL_CONST_W_7X(int obits, WDataOutP o,
IData d6,IData d5,IData d4,IData d3,IData d2,IData d1,IData d0) VL_MT_SAFE {
IData d6, IData d5, IData d4,
IData d3, IData d2, IData d1, IData d0) VL_MT_SAFE {
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6;
_END(obits,7); }
static inline WDataOutP VL_CONST_W_8X(int obits, WDataOutP o,
IData d7,IData d6,IData d5,IData d4,IData d3,IData d2,IData d1,IData d0) VL_MT_SAFE {
IData d7, IData d6, IData d5, IData d4,
IData d3, IData d2, IData d1, IData d0) VL_MT_SAFE {
o[0]=d0; o[1]=d1; o[2]=d2; o[3]=d3; o[4]=d4; o[5]=d5; o[6]=d6; o[7]=d7;
_END(obits,8); }
//

View File

@ -293,7 +293,8 @@ public: // But only for verilated*.cpp
}
}
static inline const VerilatedScope* scopeFind(const char* namep) VL_MT_SAFE {
VerilatedLockGuard lock(s_s.m_nameMutex); // If too slow, can assume this is only VL_MT_SAFE_POSINIT
VerilatedLockGuard lock(s_s.m_nameMutex);
// If too slow, can assume this is only VL_MT_SAFE_POSINIT
VerilatedScopeNameMap::const_iterator it=s_s.m_nameMap.find(namep);
if (VL_LIKELY(it != s_s.m_nameMap.end())) return it->second;
else return NULL;
@ -308,7 +309,8 @@ public: // But only for verilated*.cpp
static void scopesDump() VL_MT_SAFE {
VerilatedLockGuard lock(s_s.m_nameMutex);
VL_PRINTF_MT(" scopesDump:\n");
for (VerilatedScopeNameMap::const_iterator it=s_s.m_nameMap.begin(); it!=s_s.m_nameMap.end(); ++it) {
for (VerilatedScopeNameMap::const_iterator it=s_s.m_nameMap.begin();
it!=s_s.m_nameMap.end(); ++it) {
const VerilatedScope* scopep = it->second;
scopep->scopeDump();
}
@ -351,7 +353,8 @@ public: // But only for verilated*.cpp
static const char* exportName(int funcnum) VL_MT_SAFE {
// Slowpath; find name for given export; errors only so no map to reverse-map it
VerilatedLockGuard lock(s_s.m_exportMutex);
for (ExportNameMap::const_iterator it=s_s.m_exportMap.begin(); it!=s_s.m_exportMap.end(); ++it) {
for (ExportNameMap::const_iterator it=s_s.m_exportMap.begin();
it!=s_s.m_exportMap.end(); ++it) {
if (it->second == funcnum) return it->first;
}
return "*UNKNOWN*";
@ -359,7 +362,8 @@ public: // But only for verilated*.cpp
static void exportsDump() VL_MT_SAFE {
VerilatedLockGuard lock(s_s.m_exportMutex);
bool first = true;
for (ExportNameMap::const_iterator it=s_s.m_exportMap.begin(); it!=s_s.m_exportMap.end(); ++it) {
for (ExportNameMap::const_iterator it=s_s.m_exportMap.begin();
it!=s_s.m_exportMap.end(); ++it) {
if (first) { VL_PRINTF_MT(" exportDump:\n"); first=false; }
VL_PRINTF_MT(" DPI_EXPORT_NAME %05d: %s\n", it->second, it->first);
}

View File

@ -295,7 +295,9 @@ public:
return dynamic_cast<VerilatedVpioMemoryWordIter*>((VerilatedVpio*)h); }
virtual vluint32_t type() const { return vpiIterator; }
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;
}
}
virtual vpiHandle dovpi_scan() {
vpiHandle result;
@ -484,9 +486,7 @@ public:
if (m_flag) return &m_errorInfo;
return NULL;
}
void resetError() {
m_flag=false;
}
void resetError() { m_flag = false; }
static void vpi_unsupported() {
// Not supported yet
p_vpi_error_info error_info_p = VerilatedVpiImp::error_info()->getError();
@ -1100,7 +1100,8 @@ vpiHandle vpi_iterate(PLI_INT32 type, vpiHandle object) {
if (vop->varp()->dims() < 2) return 0;
if (vop->varp()->dims() > 2) {
_VL_VPI_WARNING(__FILE__, __LINE__, "%s: %s, object %s has unsupported number of indices (%d)",
VL_FUNC, VerilatedVpiError::strFromVpiMethod(type), vop->fullname() , vop->varp()->dims());
VL_FUNC, VerilatedVpiError::strFromVpiMethod(type),
vop->fullname() , vop->varp()->dims());
}
return (new VerilatedVpioMemoryWordIter(object, vop->varp()))->castVpiHandle();
}
@ -1111,7 +1112,8 @@ vpiHandle vpi_iterate(PLI_INT32 type, vpiHandle object) {
// Unsupported is multidim list
if (vop->varp()->dims() > 2) {
_VL_VPI_WARNING(__FILE__, __LINE__, "%s: %s, object %s has unsupported number of indices (%d)",
VL_FUNC, VerilatedVpiError::strFromVpiMethod(type), vop->fullname() , vop->varp()->dims());
VL_FUNC, VerilatedVpiError::strFromVpiMethod(type),
vop->fullname() , vop->varp()->dims());
}
return ((new VerilatedVpioRange(vop->rangep()))->castVpiHandle());
}
@ -1359,13 +1361,17 @@ void vpi_get_value(vpiHandle object, p_vpi_value value_p) {
value_p->value.str = outStr;
switch (vop->varp()->vltype()) {
// outStrSz does not include NULL termination so add one
case VLVT_UINT8 : VL_SNPRINTF(outStr, outStrSz+1, "%hhu",
case VLVT_UINT8:
VL_SNPRINTF(outStr, outStrSz+1, "%hhu",
static_cast<unsigned char>(*(reinterpret_cast<CData*>(vop->varDatap())))); return;
case VLVT_UINT16: VL_SNPRINTF(outStr, outStrSz+1, "%hu",
case VLVT_UINT16:
VL_SNPRINTF(outStr, outStrSz+1, "%hu",
static_cast<unsigned short>(*(reinterpret_cast<SData*>(vop->varDatap())))); return;
case VLVT_UINT32: VL_SNPRINTF(outStr, outStrSz+1, "%u",
case VLVT_UINT32:
VL_SNPRINTF(outStr, outStrSz+1, "%u",
static_cast<unsigned int>(*(reinterpret_cast<IData*>(vop->varDatap())))); return;
case VLVT_UINT64: VL_SNPRINTF(outStr, outStrSz+1, "%llu",
case VLVT_UINT64:
VL_SNPRINTF(outStr, outStrSz+1, "%llu",
static_cast<unsigned long long>(*(reinterpret_cast<QData*>(vop->varDatap())))); return;
default:
strcpy(outStr, "-1");
@ -1508,13 +1514,16 @@ vpiHandle vpi_put_value(vpiHandle object, p_vpi_value value_p,
if (VL_UNLIKELY(!value_p->value.vector)) return NULL;
switch (vop->varp()->vltype()) {
case VLVT_UINT8:
*(reinterpret_cast<CData*>(vop->varDatap())) = value_p->value.vector[0].aval & vop->mask();
*(reinterpret_cast<CData*>(vop->varDatap()))
= value_p->value.vector[0].aval & vop->mask();
return object;
case VLVT_UINT16:
*(reinterpret_cast<SData*>(vop->varDatap())) = value_p->value.vector[0].aval & vop->mask();
*(reinterpret_cast<SData*>(vop->varDatap()))
= value_p->value.vector[0].aval & vop->mask();
return object;
case VLVT_UINT32:
*(reinterpret_cast<IData*>(vop->varDatap())) = value_p->value.vector[0].aval & vop->mask();
*(reinterpret_cast<IData*>(vop->varDatap()))
= value_p->value.vector[0].aval & vop->mask();
return object;
case VLVT_WDATA: {
int words = VL_WORDS_I(vop->varp()->packed().elements());
@ -1644,9 +1653,12 @@ vpiHandle vpi_put_value(vpiHandle object, p_vpi_value value_p,
vop->fullname());
}
switch (vop->varp()->vltype()) {
case VLVT_UINT8 : *(reinterpret_cast<CData*>(vop->varDatap())) = val & vop->mask(); break;
case VLVT_UINT16: *(reinterpret_cast<SData*>(vop->varDatap())) = val & vop->mask(); break;
case VLVT_UINT32: *(reinterpret_cast<IData*>(vop->varDatap())) = val & vop->mask(); break;
case VLVT_UINT8:
*(reinterpret_cast<CData*>(vop->varDatap())) = val & vop->mask(); break;
case VLVT_UINT16:
*(reinterpret_cast<SData*>(vop->varDatap())) = val & vop->mask(); break;
case VLVT_UINT32:
*(reinterpret_cast<IData*>(vop->varDatap())) = val & vop->mask(); break;
case VLVT_UINT64: *(reinterpret_cast<QData*>(vop->varDatap())) = val;
(reinterpret_cast<IData*>(vop->varDatap()))[1] &= vop->mask(); break;
case VLVT_WDATA:
@ -1680,7 +1692,8 @@ vpiHandle vpi_put_value(vpiHandle object, p_vpi_value value_p,
else if (digit >= 'a' && digit <= 'f') hex = digit - 'a' + 10;
else if (digit >= 'A' && digit <= 'F') hex = digit - 'A' + 10;
else {
_VL_VPI_WARNING(__FILE__, __LINE__, "%s: Non hex character '%c' in '%s' as value %s for %s",
_VL_VPI_WARNING(__FILE__, __LINE__,
"%s: Non hex character '%c' in '%s' as value %s for %s",
VL_FUNC, digit, value_p->value.str,
VerilatedVpiError::strFromVpiVal(value_p->format),
vop->fullname());
@ -1703,7 +1716,8 @@ vpiHandle vpi_put_value(vpiHandle object, p_vpi_value value_p,
}
default:
_VL_VPI_ERROR(__FILE__, __LINE__, "%s: Unsupported format (%s) for %s",
VL_FUNC, VerilatedVpiError::strFromVpiVal(value_p->format), vop->fullname());
VL_FUNC, VerilatedVpiError::strFromVpiVal(value_p->format),
vop->fullname());
return 0;
}
} else if (value_p->format == vpiStringVal) {
@ -1724,25 +1738,29 @@ vpiHandle vpi_put_value(vpiHandle object, p_vpi_value value_p,
}
default:
_VL_VPI_ERROR(__FILE__, __LINE__, "%s: Unsupported format (%s) for %s",
VL_FUNC, VerilatedVpiError::strFromVpiVal(value_p->format), vop->fullname());
VL_FUNC, VerilatedVpiError::strFromVpiVal(value_p->format),
vop->fullname());
return 0;
}
} else if (value_p->format == vpiIntVal) {
switch (vop->varp()->vltype()) {
case VLVT_UINT8:
*(reinterpret_cast<CData*>(vop->varDatap())) = vop->mask() & value_p->value.integer;
*(reinterpret_cast<CData*>(vop->varDatap()))
= vop->mask() & value_p->value.integer;
return object;
case VLVT_UINT16:
*(reinterpret_cast<SData*>(vop->varDatap())) = vop->mask() & value_p->value.integer;
*(reinterpret_cast<SData*>(vop->varDatap()))
= vop->mask() & value_p->value.integer;
return object;
case VLVT_UINT32:
*(reinterpret_cast<IData*>(vop->varDatap())) = vop->mask() & value_p->value.integer;
*(reinterpret_cast<IData*>(vop->varDatap()))
= vop->mask() & value_p->value.integer;
return object;
case VLVT_WDATA: // FALLTHRU
case VLVT_UINT64: // FALLTHRU
default:
_VL_VPI_ERROR(__FILE__, __LINE__, "%s: Unsupported format (%s) for %s",
VL_FUNC, VerilatedVpiError::strFromVpiVal(value_p->format), vop->fullname());
_VL_VPI_ERROR(__FILE__, __LINE__, "%s: Unsupported format (%s) for %s", VL_FUNC,
VerilatedVpiError::strFromVpiVal(value_p->format), vop->fullname());
return 0;
}
}