Includes: Fix spacing and style in prep for new LXT2. No functional change.

This commit is contained in:
Wilson Snyder 2018-08-22 19:14:06 -04:00
parent aad5c3ae75
commit 0b84222500
4 changed files with 536 additions and 536 deletions

View File

@ -97,7 +97,7 @@ protected:
void* m_userthis; ///< Fake "this" for caller
vluint32_t m_code; ///< Starting code number
// CONSTRUCTORS
VerilatedVcdCallInfo (VerilatedVcdCallback_t icb, VerilatedVcdCallback_t fcb,
VerilatedVcdCallInfo(VerilatedVcdCallback_t icb, VerilatedVcdCallback_t fcb,
VerilatedVcdCallback_t changecb,
void* ut, vluint32_t code)
: m_initcb(icb), m_fullcb(fcb), m_changecb(changecb), m_userthis(ut), m_code(code) {};
@ -146,7 +146,7 @@ VerilatedVcd::VerilatedVcd(VerilatedVcdFile* filep)
m_wroteBytes = 0;
}
void VerilatedVcd::open (const char* filename) {
void VerilatedVcd::open(const char* filename) {
m_assertOne.check();
if (isOpen()) return;
@ -159,7 +159,7 @@ void VerilatedVcd::open (const char* filename) {
Verilated::flushCb(&flush_all);
// SPDIFF_ON
openNext (m_rolloverMB!=0);
openNext(m_rolloverMB!=0);
if (!isOpen()) return;
dumpHeader();
@ -175,7 +175,7 @@ void VerilatedVcd::open (const char* filename) {
}
}
void VerilatedVcd::openNext (bool incFilename) {
void VerilatedVcd::openNext(bool incFilename) {
// Open next filename in concat sequence, mangle filename if
// incFilename is true.
m_assertOne.check();
@ -272,7 +272,7 @@ VerilatedVcd::~VerilatedVcd() {
VerilatedVcdSingleton::removeVcd(this);
}
void VerilatedVcd::closePrev () {
void VerilatedVcd::closePrev() {
// This function is on the flush() call path
if (!isOpen()) return;
@ -281,7 +281,7 @@ void VerilatedVcd::closePrev () {
m_filep->close();
}
void VerilatedVcd::closeErr () {
void VerilatedVcd::closeErr() {
// This function is on the flush() call path
// Close due to an error. We might abort before even getting here,
// depending on the definition of vl_fatal.
@ -304,7 +304,7 @@ void VerilatedVcd::close() {
closePrev();
}
void VerilatedVcd::printStr (const char* str) {
void VerilatedVcd::printStr(const char* str) {
// Not fast...
while (*str) {
*m_writep++ = *str++;
@ -312,13 +312,13 @@ void VerilatedVcd::printStr (const char* str) {
}
}
void VerilatedVcd::printQuad (vluint64_t n) {
void VerilatedVcd::printQuad(vluint64_t n) {
char buf [100];
sprintf(buf,"%" VL_PRI64 "u", n);
printStr(buf);
}
void VerilatedVcd::printTime (vluint64_t timeui) {
void VerilatedVcd::printTime(vluint64_t timeui) {
// VCD file format specification does not allow non-integers for timestamps
// Dinotrace doesn't mind, but Cadence vvision seems to choke
if (VL_UNLIKELY(timeui < m_timeLastDump)) {
@ -347,7 +347,7 @@ void VerilatedVcd::bufferResize(vluint64_t minsize) {
}
}
void VerilatedVcd::bufferFlush () VL_MT_UNSAFE_ONE {
void VerilatedVcd::bufferFlush() VL_MT_UNSAFE_ONE {
// This function is on the flush() call path
// We add output data to m_writep.
// When it gets nearly full we dump it using this routine which calls write()
@ -381,19 +381,19 @@ void VerilatedVcd::bufferFlush () VL_MT_UNSAFE_ONE {
//=============================================================================
// Simple methods
void VerilatedVcd::set_time_unit (const char* unitp) {
//cout<<" set_time_unit ("<<unitp<<") == "<<timescaleToDouble(unitp)
void VerilatedVcd::set_time_unit(const char* unitp) {
//cout<<" set_time_unit("<<unitp<<") == "<<timescaleToDouble(unitp)
// <<" == "<<doubleToTimescale(timescaleToDouble(unitp))<<endl;
m_timeUnit = timescaleToDouble(unitp);
}
void VerilatedVcd::set_time_resolution (const char* unitp) {
//cout<<"set_time_resolution ("<<unitp<<") == "<<timescaleToDouble(unitp)
void VerilatedVcd::set_time_resolution(const char* unitp) {
//cout<<"set_time_resolution("<<unitp<<") == "<<timescaleToDouble(unitp)
// <<" == "<<doubleToTimescale(timescaleToDouble(unitp))<<endl;
m_timeRes = timescaleToDouble(unitp);
}
double VerilatedVcd::timescaleToDouble (const char* unitp) {
double VerilatedVcd::timescaleToDouble(const char* unitp) {
char* endp;
double value = strtod(unitp, &endp);
if (value==0.0 && endp==unitp) value=1; // On error so we allow just "ns" to return 1e-9.
@ -411,7 +411,7 @@ double VerilatedVcd::timescaleToDouble (const char* unitp) {
return value;
}
std::string VerilatedVcd::doubleToTimescale (double value) {
std::string VerilatedVcd::doubleToTimescale(double value) {
const char* suffixp = "s";
if (value>=1e0) { suffixp="s"; value *= 1e0; }
else if (value>=1e-3 ) { suffixp="ms"; value *= 1e3; }
@ -427,14 +427,14 @@ std::string VerilatedVcd::doubleToTimescale (double value) {
//=============================================================================
// Definitions
void VerilatedVcd::printIndent (int level_change) {
void VerilatedVcd::printIndent(int level_change) {
if (level_change<0) m_modDepth += level_change;
assert(m_modDepth>=0);
for (int i=0; i<m_modDepth; i++) printStr(" ");
if (level_change>0) m_modDepth += level_change;
}
void VerilatedVcd::dumpHeader () {
void VerilatedVcd::dumpHeader() {
printStr("$version Generated by VerilatedVcd $end\n");
time_t time_str = time(NULL);
printStr("$date "); printStr(ctime(&time_str)); printStr(" $end\n");
@ -447,7 +447,7 @@ void VerilatedVcd::dumpHeader () {
makeNameMap();
// Signal header
assert (m_modDepth==0);
assert(m_modDepth==0);
printIndent(1);
printStr("\n");
@ -508,18 +508,18 @@ void VerilatedVcd::dumpHeader () {
printIndent(-1);
printStr("$enddefinitions $end\n\n\n");
assert (m_modDepth==0);
assert(m_modDepth==0);
// Reclaim storage
deleteNameMap();
}
void VerilatedVcd::module (const std::string& name) {
void VerilatedVcd::module(const std::string& name) {
m_assertOne.check();
m_modName = name;
}
void VerilatedVcd::declare (vluint32_t code, const char* name, const char* wirep,
void VerilatedVcd::declare(vluint32_t code, const char* name, const char* wirep,
int arraynum, bool tri, bool bussed, int msb, int lsb) {
if (!code) { VL_FATAL_MT(__FILE__,__LINE__,"","Internal: internal trace problem, code 0 is illegal"); }
@ -590,29 +590,29 @@ void VerilatedVcd::declare (vluint32_t code, const char* name, const char* wirep
}
void VerilatedVcd::declBit (vluint32_t code, const char* name, int arraynum)
{ declare (code, name, "wire", arraynum, false, false, 0, 0); }
{ declare(code, name, "wire", arraynum, false, false, 0, 0); }
void VerilatedVcd::declBus (vluint32_t code, const char* name, int arraynum, int msb, int lsb)
{ declare (code, name, "wire", arraynum, false, true, msb, lsb); }
{ declare(code, name, "wire", arraynum, false, true, msb, lsb); }
void VerilatedVcd::declQuad (vluint32_t code, const char* name, int arraynum, int msb, int lsb)
{ declare (code, name, "wire", arraynum, false, true, msb, lsb); }
{ declare(code, name, "wire", arraynum, false, true, msb, lsb); }
void VerilatedVcd::declArray (vluint32_t code, const char* name, int arraynum, int msb, int lsb)
{ declare (code, name, "wire", arraynum, false, true, msb, lsb); }
{ declare(code, name, "wire", arraynum, false, true, msb, lsb); }
void VerilatedVcd::declTriBit (vluint32_t code, const char* name, int arraynum)
{ declare (code, name, "wire", arraynum, true, false, 0, 0); }
{ declare(code, name, "wire", arraynum, true, false, 0, 0); }
void VerilatedVcd::declTriBus (vluint32_t code, const char* name, int arraynum, int msb, int lsb)
{ declare (code, name, "wire", arraynum, true, true, msb, lsb); }
{ declare(code, name, "wire", arraynum, true, true, msb, lsb); }
void VerilatedVcd::declTriQuad (vluint32_t code, const char* name, int arraynum, int msb, int lsb)
{ declare (code, name, "wire", arraynum, true, true, msb, lsb); }
{ declare(code, name, "wire", arraynum, true, true, msb, lsb); }
void VerilatedVcd::declTriArray (vluint32_t code, const char* name, int arraynum, int msb, int lsb)
{ declare (code, name, "wire", arraynum, true, true, msb, lsb); }
{ declare(code, name, "wire", arraynum, true, true, msb, lsb); }
void VerilatedVcd::declFloat (vluint32_t code, const char* name, int arraynum)
{ declare (code, name, "real", arraynum, false, false, 31, 0); }
{ declare(code, name, "real", arraynum, false, false, 31, 0); }
void VerilatedVcd::declDouble (vluint32_t code, const char* name, int arraynum)
{ declare (code, name, "real", arraynum, false, false, 63, 0); }
{ declare(code, name, "real", arraynum, false, false, 63, 0); }
//=============================================================================
void VerilatedVcd::fullDouble (vluint32_t code, const double newval) {
void VerilatedVcd::fullDouble(vluint32_t code, const double newval) {
// cppcheck-suppress invalidPointerCast
(*(reinterpret_cast<double*>(&m_sigs_oldvalp[code]))) = newval;
// Buffer can't overflow before sprintf; we sized during declaration
@ -621,7 +621,7 @@ void VerilatedVcd::fullDouble (vluint32_t code, const double newval) {
*m_writep++=' '; printCode(code); *m_writep++='\n';
bufferCheck();
}
void VerilatedVcd::fullFloat (vluint32_t code, const float newval) {
void VerilatedVcd::fullFloat(vluint32_t code, const float newval) {
// cppcheck-suppress invalidPointerCast
(*(reinterpret_cast<float*>(&m_sigs_oldvalp[code]))) = newval;
// Buffer can't overflow before sprintf; we sized during declaration
@ -634,9 +634,9 @@ void VerilatedVcd::fullFloat (vluint32_t code, const float newval) {
//=============================================================================
// Callbacks
void VerilatedVcd::addCallback VL_MT_UNSAFE_ONE (
void VerilatedVcd::addCallback(
VerilatedVcdCallback_t initcb, VerilatedVcdCallback_t fullcb, VerilatedVcdCallback_t changecb,
void* userthis)
void* userthis) VL_MT_UNSAFE_ONE
{
m_assertOne.check();
if (VL_UNLIKELY(isOpen())) {
@ -650,9 +650,9 @@ void VerilatedVcd::addCallback VL_MT_UNSAFE_ONE (
//=============================================================================
// Dumping
void VerilatedVcd::dumpFull (vluint64_t timeui) {
void VerilatedVcd::dumpFull(vluint64_t timeui) {
m_assertOne.check();
dumpPrep (timeui);
dumpPrep(timeui);
Verilated::quiesce();
for (vluint32_t ent = 0; ent< m_callbacks.size(); ent++) {
VerilatedVcdCallInfo *cip = m_callbacks[ent];
@ -660,7 +660,7 @@ void VerilatedVcd::dumpFull (vluint64_t timeui) {
}
}
void VerilatedVcd::dump (vluint64_t timeui) {
void VerilatedVcd::dump(vluint64_t timeui) {
m_assertOne.check();
if (!isOpen()) return;
if (VL_UNLIKELY(m_fullDump)) {
@ -672,7 +672,7 @@ void VerilatedVcd::dump (vluint64_t timeui) {
openNext(true);
if (!isOpen()) return;
}
dumpPrep (timeui);
dumpPrep(timeui);
Verilated::quiesce();
for (vluint32_t ent = 0; ent< m_callbacks.size(); ent++) {
VerilatedVcdCallInfo *cip = m_callbacks[ent];
@ -680,7 +680,7 @@ void VerilatedVcd::dump (vluint64_t timeui) {
}
}
void VerilatedVcd::dumpPrep (vluint64_t timeui) {
void VerilatedVcd::dumpPrep(vluint64_t timeui) {
printStr("#");
printTime(timeui);
printStr("\n");
@ -705,28 +705,28 @@ vluint8_t ch;
vluint64_t timestamp = 1;
double doub = 0;
void vcdInit (VerilatedVcd* vcdp, void* userthis, vluint32_t code) {
void vcdInit(VerilatedVcd* vcdp, void* userthis, vluint32_t code) {
vcdp->scopeEscape('.');
vcdp->module ("top");
vcdp->declBus (0x2, "v1",-1,5,1);
vcdp->declBus (0x3, "v2",-1,6,0);
vcdp->module ("top.sub1");
vcdp->declBit (0x4, "s1",-1);
vcdp->declBit (0x5, "ch",-1);
vcdp->module ("top.sub2");
vcdp->declArray (0x6, "s2",-1, 40,3);
vcdp->module("top");
vcdp->declBus(0x2, "v1",-1,5,1);
vcdp->declBus(0x3, "v2",-1,6,0);
vcdp->module("top.sub1");
vcdp->declBit(0x4, "s1",-1);
vcdp->declBit(0x5, "ch",-1);
vcdp->module("top.sub2");
vcdp->declArray(0x6, "s2",-1, 40,3);
// Note need to add 3 for next code.
vcdp->module ("top2");
vcdp->declBus (0x2, "t2v1",-1,4,1);
vcdp->module("top2");
vcdp->declBus(0x2, "t2v1",-1,4,1);
vcdp->declTriBit (0x10, "io1", -1);
vcdp->declTriBus (0x12, "io5", -1,4,0);
vcdp->declTriArray (0x16, "io96",-1,95,0);
vcdp->declTriArray(0x16, "io96",-1,95,0);
// Note need to add 6 for next code.
vcdp->declDouble (0x1c, "doub",-1);
// Note need to add 2 for next code.
}
void vcdFull (VerilatedVcd* vcdp, void* userthis, vluint32_t code) {
void vcdFull(VerilatedVcd* vcdp, void* userthis, vluint32_t code) {
vcdp->fullBus (0x2, v1,5);
vcdp->fullBus (0x3, v2,7);
vcdp->fullBit (0x4, s1);
@ -734,11 +734,11 @@ void vcdFull (VerilatedVcd* vcdp, void* userthis, vluint32_t code) {
vcdp->fullArray(0x6, &s2[0], 38);
vcdp->fullTriBit (0x10, tri96[0]&1, tri96__tri[0]&1);
vcdp->fullTriBus (0x12, tri96[0]&0x1f, tri96__tri[0]&0x1f, 5);
vcdp->fullTriArray (0x16, tri96, tri96__tri, 96);
vcdp->fullTriArray(0x16, tri96, tri96__tri, 96);
vcdp->fullDouble(0x1c, doub);
}
void vcdChange (VerilatedVcd* vcdp, void* userthis, vluint32_t code) {
void vcdChange(VerilatedVcd* vcdp, void* userthis, vluint32_t code) {
vcdp->chgBus (0x2, v1,5);
vcdp->chgBus (0x3, v2,7);
vcdp->chgBit (0x4, s1);
@ -761,8 +761,8 @@ main() {
doub = 0;
{
VerilatedVcdC* vcdp = new VerilatedVcdC;
vcdp->spTrace()->addCallback (&vcdInit, &vcdFull, &vcdChange, 0);
vcdp->open ("test.vcd");
vcdp->spTrace()->addCallback(&vcdInit, &vcdFull, &vcdChange, 0);
vcdp->open("test.vcd");
// Dumping
vcdp->dump(timestamp++);
v1 = 0xfff;

View File

@ -59,7 +59,7 @@ protected:
friend class VerilatedVcd;
vluint32_t m_code; ///< VCD file code number
int m_bits; ///< Size of value in bits
VerilatedVcdSig (vluint32_t code, int bits)
VerilatedVcdSig(vluint32_t code, int bits)
: m_code(code), m_bits(bits) {}
public:
~VerilatedVcdSig() {}
@ -121,25 +121,25 @@ private:
void openNext();
void makeNameMap();
void deleteNameMap();
void printIndent (int levelchange);
void printStr (const char* str);
void printQuad (vluint64_t n);
void printTime (vluint64_t timeui);
void declare (vluint32_t code, const char* name, const char* wirep,
void printIndent(int levelchange);
void printStr(const char* str);
void printQuad(vluint64_t n);
void printTime(vluint64_t timeui);
void declare(vluint32_t code, const char* name, const char* wirep,
int arraynum, bool tri, bool bussed, int msb, int lsb);
void dumpHeader();
void dumpPrep (vluint64_t timeui);
void dumpFull (vluint64_t timeui);
void dumpPrep(vluint64_t timeui);
void dumpFull(vluint64_t timeui);
// cppcheck-suppress functionConst
void dumpDone ();
inline void printCode (vluint32_t code) {
void dumpDone();
inline void printCode(vluint32_t code) {
if (code>=(94*94*94)) *m_writep++ = static_cast<char>((code/94/94/94)%94+33);
if (code>=(94*94)) *m_writep++ = static_cast<char>((code/94/94)%94+33);
if (code>=(94)) *m_writep++ = static_cast<char>((code/94)%94+33);
*m_writep++ = static_cast<char>((code)%94+33);
}
static std::string stringCode (vluint32_t code) VL_PURE {
static std::string stringCode(vluint32_t code) VL_PURE {
std::string out;
if (code>=(94*94*94)) out += static_cast<char>((code/94/94/94)%94+33);
if (code>=(94*94)) out += static_cast<char>((code/94/94)%94+33);
@ -165,34 +165,34 @@ public:
// METHODS
void open(const char* filename) VL_MT_UNSAFE_ONE; ///< Open the file; call isOpen() to see if errors
void openNext (bool incFilename); ///< Open next data-only file
void openNext(bool incFilename); ///< Open next data-only file
void close() VL_MT_UNSAFE_ONE; ///< Close the file
/// Flush any remaining data to this file
void flush() VL_MT_UNSAFE_ONE { bufferFlush(); }
/// Flush any remaining data from all files
static void flush_all() VL_MT_UNSAFE_ONE;
void set_time_unit (const char* unit); ///< Set time units (s/ms, defaults to ns)
void set_time_unit (const std::string& unit) { set_time_unit(unit.c_str()); }
void set_time_unit(const char* unit); ///< Set time units (s/ms, defaults to ns)
void set_time_unit(const std::string& unit) { set_time_unit(unit.c_str()); }
void set_time_resolution (const char* unit); ///< Set time resolution (s/ms, defaults to ns)
void set_time_resolution (const std::string& unit) { set_time_resolution(unit.c_str()); }
void set_time_resolution(const char* unit); ///< Set time resolution (s/ms, defaults to ns)
void set_time_resolution(const std::string& unit) { set_time_resolution(unit.c_str()); }
double timescaleToDouble (const char* unitp);
std::string doubleToTimescale (double value);
double timescaleToDouble(const char* unitp);
std::string doubleToTimescale(double value);
/// Inside dumping routines, called each cycle to make the dump
void dump (vluint64_t timeui);
void dump(vluint64_t timeui);
/// Call dump with a absolute unscaled time in seconds
void dumpSeconds (double secs) { dump(static_cast<vluint64_t>(secs * m_timeRes)); }
void dumpSeconds(double secs) { dump(static_cast<vluint64_t>(secs * m_timeRes)); }
/// Inside dumping routines, declare callbacks for tracings
void addCallback (VerilatedVcdCallback_t init, VerilatedVcdCallback_t full,
void addCallback(VerilatedVcdCallback_t init, VerilatedVcdCallback_t full,
VerilatedVcdCallback_t change,
void* userthis) VL_MT_UNSAFE_ONE;
/// Inside dumping routines, declare a module
void module (const std::string& name);
void module(const std::string& name);
/// Inside dumping routines, declare a signal
void declBit (vluint32_t code, const char* name, int arraynum);
void declBus (vluint32_t code, const char* name, int arraynum, int msb, int lsb);
@ -207,13 +207,13 @@ public:
// ... other module_start for submodules (based on cell name)
/// Inside dumping routines, dump one signal
void fullBit (vluint32_t code, const vluint32_t newval) {
void fullBit(vluint32_t code, const vluint32_t newval) {
// Note the &1, so we don't require clean input -- makes more common no change case faster
m_sigs_oldvalp[code] = newval;
*m_writep++=('0'+static_cast<char>(newval&1)); printCode(code); *m_writep++='\n';
bufferCheck();
}
void fullBus (vluint32_t code, const vluint32_t newval, int bits) {
void fullBus(vluint32_t code, const vluint32_t newval, int bits) {
m_sigs_oldvalp[code] = newval;
*m_writep++='b';
for (int bit=bits-1; bit>=0; --bit) {
@ -222,7 +222,7 @@ public:
*m_writep++=' '; printCode(code); *m_writep++='\n';
bufferCheck();
}
void fullQuad (vluint32_t code, const vluint64_t newval, int bits) {
void fullQuad(vluint32_t code, const vluint64_t newval, int bits) {
(*(reinterpret_cast<vluint64_t*>(&m_sigs_oldvalp[code]))) = newval;
*m_writep++='b';
for (int bit=bits-1; bit>=0; --bit) {
@ -231,7 +231,7 @@ public:
*m_writep++=' '; printCode(code); *m_writep++='\n';
bufferCheck();
}
void fullArray (vluint32_t code, const vluint32_t* newval, int bits) {
void fullArray(vluint32_t code, const vluint32_t* newval, int bits) {
for (int word=0; word<(((bits-1)/32)+1); ++word) {
m_sigs_oldvalp[code+word] = newval[word];
}
@ -242,7 +242,7 @@ public:
*m_writep++=' '; printCode(code); *m_writep++='\n';
bufferCheck();
}
void fullTriBit (vluint32_t code, const vluint32_t newval, const vluint32_t newtri) {
void fullTriBit(vluint32_t code, const vluint32_t newval, const vluint32_t newtri) {
m_sigs_oldvalp[code] = newval;
m_sigs_oldvalp[code+1] = newtri;
*m_writep++ = "01zz"[m_sigs_oldvalp[code]
@ -250,7 +250,7 @@ public:
printCode(code); *m_writep++='\n';
bufferCheck();
}
void fullTriBus (vluint32_t code, const vluint32_t newval, const vluint32_t newtri, int bits) {
void fullTriBus(vluint32_t code, const vluint32_t newval, const vluint32_t newtri, int bits) {
m_sigs_oldvalp[code] = newval;
m_sigs_oldvalp[code+1] = newtri;
*m_writep++='b';
@ -261,7 +261,7 @@ public:
*m_writep++=' '; printCode(code); *m_writep++='\n';
bufferCheck();
}
void fullTriQuad (vluint32_t code, const vluint64_t newval, const vluint32_t newtri, int bits) {
void fullTriQuad(vluint32_t code, const vluint64_t newval, const vluint32_t newtri, int bits) {
(*(reinterpret_cast<vluint64_t*>(&m_sigs_oldvalp[code]))) = newval;
(*(reinterpret_cast<vluint64_t*>(&m_sigs_oldvalp[code+1]))) = newtri;
*m_writep++='b';
@ -272,7 +272,7 @@ public:
*m_writep++=' '; printCode(code); *m_writep++='\n';
bufferCheck();
}
void fullTriArray (vluint32_t code, const vluint32_t* newvalp, const vluint32_t* newtrip, int bits) {
void fullTriArray(vluint32_t code, const vluint32_t* newvalp, const vluint32_t* newtrip, int bits) {
for (int word=0; word<(((bits-1)/32)+1); ++word) {
m_sigs_oldvalp[code+word*2] = newvalp[word];
m_sigs_oldvalp[code+word*2+1] = newtrip[word];
@ -286,18 +286,18 @@ public:
*m_writep++=' '; printCode(code); *m_writep++='\n';
bufferCheck();
}
void fullDouble (vluint32_t code, const double newval);
void fullFloat (vluint32_t code, const float newval);
void fullDouble(vluint32_t code, const double newval);
void fullFloat(vluint32_t code, const float newval);
/// Inside dumping routines, dump one signal as unknowns
/// Presently this code doesn't change the oldval vector.
/// Thus this is for special standalone applications that after calling
/// fullBitX, must when then value goes non-X call fullBit.
inline void fullBitX (vluint32_t code) {
inline void fullBitX(vluint32_t code) {
*m_writep++='x'; printCode(code); *m_writep++='\n';
bufferCheck();
}
inline void fullBusX (vluint32_t code, int bits) {
inline void fullBusX(vluint32_t code, int bits) {
*m_writep++='b';
for (int bit=bits-1; bit>=0; --bit) {
*m_writep++='x';
@ -305,28 +305,28 @@ public:
*m_writep++=' '; printCode(code); *m_writep++='\n';
bufferCheck();
}
inline void fullQuadX (vluint32_t code, int bits) { fullBusX (code, bits); }
inline void fullArrayX (vluint32_t code, int bits) { fullBusX (code, bits); }
inline void fullQuadX(vluint32_t code, int bits) { fullBusX (code, bits); }
inline void fullArrayX(vluint32_t code, int bits) { fullBusX (code, bits); }
/// Inside dumping routines, dump one signal if it has changed
inline void chgBit (vluint32_t code, const vluint32_t newval) {
inline void chgBit(vluint32_t code, const vluint32_t newval) {
vluint32_t diff = m_sigs_oldvalp[code] ^ newval;
if (VL_UNLIKELY(diff)) {
// Verilator 3.510 and newer provide clean input, so the below is only for back compatibility
if (VL_UNLIKELY(diff & 1)) { // Change after clean?
fullBit (code, newval);
fullBit(code, newval);
}
}
}
inline void chgBus (vluint32_t code, const vluint32_t newval, int bits) {
inline void chgBus(vluint32_t code, const vluint32_t newval, int bits) {
vluint32_t diff = m_sigs_oldvalp[code] ^ newval;
if (VL_UNLIKELY(diff)) {
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(vluint32_t code, const vluint64_t newval, int bits) {
vluint64_t diff = (*(reinterpret_cast<vluint64_t*>(&m_sigs_oldvalp[code]))) ^ newval;
if (VL_UNLIKELY(diff)) {
if (VL_UNLIKELY(bits==64 || (diff & ((1ULL<<bits)-1) ))) {
@ -334,34 +334,34 @@ public:
}
}
}
inline void chgArray (vluint32_t code, const vluint32_t* newval, int bits) {
inline void chgArray(vluint32_t code, const vluint32_t* newval, int bits) {
for (int word=0; word<(((bits-1)/32)+1); ++word) {
if (VL_UNLIKELY(m_sigs_oldvalp[code+word] ^ newval[word])) {
fullArray (code,newval,bits);
fullArray(code,newval,bits);
return;
}
}
}
inline void chgTriBit (vluint32_t code, const vluint32_t newval, const vluint32_t newtri) {
inline void chgTriBit(vluint32_t code, const vluint32_t newval, const vluint32_t newtri) {
vluint32_t diff = ((m_sigs_oldvalp[code] ^ newval)
| (m_sigs_oldvalp[code+1] ^ newtri));
if (VL_UNLIKELY(diff)) {
// Verilator 3.510 and newer provide clean input, so the below is only for back compatibility
if (VL_UNLIKELY(diff & 1)) { // Change after clean?
fullTriBit (code, newval, newtri);
fullTriBit(code, newval, newtri);
}
}
}
inline void chgTriBus (vluint32_t code, const vluint32_t newval, const vluint32_t newtri, int bits) {
inline void chgTriBus(vluint32_t code, const vluint32_t newval, const vluint32_t newtri, int bits) {
vluint32_t diff = ((m_sigs_oldvalp[code] ^ newval)
| (m_sigs_oldvalp[code+1] ^ newtri));
if (VL_UNLIKELY(diff)) {
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 vluint32_t newtri, int bits) {
inline void chgTriQuad(vluint32_t code, const vluint64_t newval, const vluint32_t newtri, int bits) {
vluint64_t diff = ( ((*(reinterpret_cast<vluint64_t*>(&m_sigs_oldvalp[code]))) ^ newval)
| ((*(reinterpret_cast<vluint64_t*>(&m_sigs_oldvalp[code+1]))) ^ newtri));
if (VL_UNLIKELY(diff)) {
@ -370,25 +370,25 @@ public:
}
}
}
inline void chgTriArray (vluint32_t code, const vluint32_t* newvalp, const vluint32_t* newtrip, int bits) {
inline void chgTriArray(vluint32_t code, const vluint32_t* newvalp, const vluint32_t* newtrip, int bits) {
for (int word=0; word<(((bits-1)/32)+1); ++word) {
if (VL_UNLIKELY((m_sigs_oldvalp[code+word*2] ^ newvalp[word])
| (m_sigs_oldvalp[code+word*2+1] ^ newtrip[word]))) {
fullTriArray (code,newvalp,newtrip,bits);
fullTriArray(code,newvalp,newtrip,bits);
return;
}
}
}
inline void chgDouble (vluint32_t code, const double newval) {
inline void chgDouble(vluint32_t code, const double newval) {
// cppcheck-suppress invalidPointerCast
if (VL_UNLIKELY((*(reinterpret_cast<double*>(&m_sigs_oldvalp[code]))) != newval)) {
fullDouble (code, newval);
fullDouble(code, newval);
}
}
inline void chgFloat (vluint32_t code, const float newval) {
inline void chgFloat(vluint32_t code, const float newval) {
// cppcheck-suppress invalidPointerCast
if (VL_UNLIKELY((*(reinterpret_cast<float*>(&m_sigs_oldvalp[code]))) != newval)) {
fullFloat (code, newval);
fullFloat(code, newval);
}
}
@ -431,23 +431,23 @@ public:
/// Flush dump
void flush() VL_MT_UNSAFE_ONE { m_sptrace.flush(); }
/// Write one cycle of dump data
void dump (vluint64_t timeui) { m_sptrace.dump(timeui); }
void dump(vluint64_t timeui) { m_sptrace.dump(timeui); }
/// Write one cycle of dump data - backward compatible and to reduce
/// conversion warnings. It's better to use a vluint64_t time instead.
void dump (double timestamp) { dump(static_cast<vluint64_t>(timestamp)); }
void dump (vluint32_t timestamp) { dump(static_cast<vluint64_t>(timestamp)); }
void dump (int timestamp) { dump(static_cast<vluint64_t>(timestamp)); }
void dump(double timestamp) { dump(static_cast<vluint64_t>(timestamp)); }
void dump(vluint32_t timestamp) { dump(static_cast<vluint64_t>(timestamp)); }
void dump(int timestamp) { dump(static_cast<vluint64_t>(timestamp)); }
/// Set time units (s/ms, defaults to ns)
/// See also VL_TIME_PRECISION, and VL_TIME_MULTIPLIER in verilated.h
void set_time_unit (const char* unit) { m_sptrace.set_time_unit(unit); }
void set_time_unit (const std::string& unit) { set_time_unit(unit.c_str()); }
void set_time_unit(const char* unit) { m_sptrace.set_time_unit(unit); }
void set_time_unit(const std::string& unit) { set_time_unit(unit.c_str()); }
/// Set time resolution (s/ms, defaults to ns)
/// See also VL_TIME_PRECISION, and VL_TIME_MULTIPLIER in verilated.h
void set_time_resolution (const char* unit) { m_sptrace.set_time_resolution(unit); }
void set_time_resolution (const std::string& unit) { set_time_resolution(unit.c_str()); }
void set_time_resolution(const char* unit) { m_sptrace.set_time_resolution(unit); }
void set_time_resolution(const std::string& unit) { set_time_resolution(unit.c_str()); }
/// Internal class access
inline VerilatedVcd* spTrace () { return &m_sptrace; };
inline VerilatedVcd* spTrace() { return &m_sptrace; };
};
#endif // guard

View File

@ -31,8 +31,8 @@
#if (SYSTEMC_VERSION>=20050714)
// SystemC 2.1.v1
// cppcheck-suppress unusedFunction
void VerilatedVcdSc::write_comment (const std::string &) {}
void VerilatedVcdSc::trace (const unsigned int &, const std::string &, const char **) {}
void VerilatedVcdSc::write_comment(const std::string &) {}
void VerilatedVcdSc::trace(const unsigned int &, const std::string &, const char **) {}
# define DECL_TRACE_METHOD_A(tp) \
void VerilatedVcdSc::trace( const tp& object, const std::string& name ) {}
@ -81,8 +81,8 @@ void VerilatedVcdSc::trace (const unsigned int &, const std::string &, const cha
#elif (SYSTEMC_VERSION>20011000)
// SystemC 2.0.1
// cppcheck-suppress unusedFunction
void VerilatedVcdSc::write_comment (const sc_string &) {}
void VerilatedVcdSc::trace (const unsigned int &, const sc_string &, const char **) {}
void VerilatedVcdSc::write_comment(const sc_string &) {}
void VerilatedVcdSc::trace(const unsigned int &, const sc_string &, const char **) {}
#define DECL_TRACE_METHOD_A(tp) \
void VerilatedVcdSc::trace( const tp& object, const sc_string& name ) {}
@ -124,8 +124,8 @@ void VerilatedVcdSc::trace (const unsigned int &, const sc_string &, const char
#else
// SystemC 1.2.1beta
// cppcheck-suppress unusedFunction
void VerilatedVcdSc::write_comment (const sc_string &) {}
void VerilatedVcdSc::trace (const unsigned int &, const sc_string &, const char **) {}
void VerilatedVcdSc::write_comment(const sc_string &) {}
void VerilatedVcdSc::trace(const unsigned int &, const sc_string &, const char **) {}
#define DECL_TRACE_METHOD_A(tp) \
void VerilatedVcdSc::trace( const tp& object, const sc_string& name ) {}

View File

@ -64,7 +64,7 @@ public:
// METHODS
/// Called by SystemC simulate()
virtual void cycle (bool delta_cycle) {
virtual void cycle(bool delta_cycle) {
# if (SYSTEMC_VERSION>20011000)
if (!delta_cycle) { this->dump(sc_time_stamp().to_double()); }
# else
@ -78,10 +78,10 @@ private:
#ifdef NC_SYSTEMC
// Cadence Incisive has these as abstract functions so we must create them
virtual void set_time_unit( int exponent10_seconds ) {} // deprecated
virtual void set_time_unit(int exponent10_seconds) {} // deprecated
#endif
#if defined(NC_SYSTEMC) || (SYSTEMC_VERSION>=20111100)
virtual void set_time_unit( double v, sc_time_unit tu ) {}
virtual void set_time_unit(double v, sc_time_unit tu) {}
#endif
@ -89,12 +89,12 @@ private:
# if (SYSTEMC_VERSION>=20050714)
// SystemC 2.1.v1
# define DECL_TRACE_METHOD_A(tp) \
virtual void trace( const tp& object, const std::string& name );
virtual void trace(const tp& object, const std::string& name);
# define DECL_TRACE_METHOD_B(tp) \
virtual void trace( const tp& object, const std::string& name, int width );
virtual void trace(const tp& object, const std::string& name, int width);
virtual void write_comment (const std::string &);
virtual void trace (const unsigned int &, const std::string &, const char **);
virtual void write_comment(const std::string &);
virtual void trace(const unsigned int &, const std::string &, const char **);
#if (SYSTEMC_VERSION>=20171012)
DECL_TRACE_METHOD_A( sc_event )
@ -138,14 +138,14 @@ private:
# elif (SYSTEMC_VERSION>20011000)
// SystemC 2.0.1
# define DECL_TRACE_METHOD_A(tp) \
virtual void trace( const tp& object, const sc_string& name );
virtual void trace(const tp& object, const sc_string& name);
# define DECL_TRACE_METHOD_B(tp) \
virtual void trace( const tp& object, const sc_string& name, int width );
virtual void trace(const tp& object, const sc_string& name, int width);
virtual void write_comment (const sc_string &);
virtual void trace (const unsigned int &, const sc_string &, const char **);
virtual void delta_cycles (bool) {}
virtual void space( int n ) {}
virtual void write_comment(const sc_string &);
virtual void trace(const unsigned int &, const sc_string &, const char **);
virtual void delta_cycles(bool) {}
virtual void space(int n) {}
DECL_TRACE_METHOD_A( bool )
DECL_TRACE_METHOD_A( sc_bit )
@ -182,12 +182,12 @@ private:
# else
// SystemC 1.2.1beta
# define DECL_TRACE_METHOD_A(tp) \
virtual void trace( const tp& object, const sc_string& name );
virtual void trace(const tp& object, const sc_string& name);
# define DECL_TRACE_METHOD_B(tp) \
virtual void trace( const tp& object, const sc_string& name, int width );
virtual void trace(const tp& object, const sc_string& name, int width);
virtual void write_comment (const sc_string &);
virtual void trace (const unsigned int &, const sc_string &, const char **);
virtual void write_comment(const sc_string &);
virtual void trace(const unsigned int &, const sc_string &, const char **);
DECL_TRACE_METHOD_A( bool )
DECL_TRACE_METHOD_B( unsigned char )
@ -220,4 +220,4 @@ private:
# undef DECL_TRACE_METHOD_B
};
#endif // guard
#endif // Guard