mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 10:03:44 +02:00
This commit is contained in:
+19
-38
@@ -624,16 +624,6 @@ class EmitCTrace final : public EmitCFunc {
|
||||
}
|
||||
|
||||
void emitTraceInitOne(const AstTraceDecl* nodep, int enumNum) {
|
||||
std::string direction;
|
||||
direction = nodep->declDirection().traceSigDirection();
|
||||
|
||||
AstCCall* const callp = nodep->dtypeCallp();
|
||||
if (callp) {
|
||||
callp->argTypes(callp->argTypes() + ", " + cvtToStr(nodep->fidx()) + ", c+"
|
||||
+ cvtToStr(nodep->code()) + "-1, " + direction);
|
||||
return;
|
||||
}
|
||||
|
||||
if (nodep->dtypep()->basicp()->isDouble()) {
|
||||
puts("tracep->declDouble(");
|
||||
} else if (nodep->isWide()) {
|
||||
@@ -654,11 +644,7 @@ class EmitCTrace final : public EmitCFunc {
|
||||
|
||||
// Function index
|
||||
puts(",");
|
||||
if (nodep->inDtypeFunc()) {
|
||||
puts("fidx");
|
||||
} else {
|
||||
puts(cvtToStr(nodep->fidx()));
|
||||
}
|
||||
puts(cvtToStr(nodep->fidx()));
|
||||
|
||||
// Name
|
||||
puts(",");
|
||||
@@ -668,10 +654,14 @@ class EmitCTrace final : public EmitCFunc {
|
||||
puts("," + cvtToStr(enumNum));
|
||||
|
||||
// Direction
|
||||
if (nodep->inDtypeFunc()) {
|
||||
puts(", direction");
|
||||
if (nodep->declDirection().isInout()) {
|
||||
puts(", VerilatedTraceSigDirection::INOUT");
|
||||
} else if (nodep->declDirection().isWritable()) {
|
||||
puts(", VerilatedTraceSigDirection::OUTPUT");
|
||||
} else if (nodep->declDirection().isNonOutput()) {
|
||||
puts(", VerilatedTraceSigDirection::INPUT");
|
||||
} else {
|
||||
puts(", " + direction);
|
||||
puts(", VerilatedTraceSigDirection::NONE");
|
||||
}
|
||||
|
||||
// Kind
|
||||
@@ -762,7 +752,16 @@ class EmitCTrace final : public EmitCFunc {
|
||||
puts("VL_SC_BV_DATAP(");
|
||||
}
|
||||
iterateConst(varrefp); // Put var name out
|
||||
emitTraceIndex(nodep, arrayindex);
|
||||
// Tracing only supports 1D arrays
|
||||
if (nodep->declp()->arrayRange().ranged()) {
|
||||
if (arrayindex == -2) {
|
||||
puts("[i]");
|
||||
} else if (arrayindex == -1) {
|
||||
puts("[0]");
|
||||
} else {
|
||||
puts("[" + cvtToStr(arrayindex) + "]");
|
||||
}
|
||||
}
|
||||
if (varp->isSc()) puts(".read()");
|
||||
if (emitTraceIsScUint(nodep)) {
|
||||
puts(nodep->isQuad() ? ".to_uint64()" : ".to_uint()");
|
||||
@@ -775,24 +774,10 @@ class EmitCTrace final : public EmitCFunc {
|
||||
} else {
|
||||
puts("(");
|
||||
iterateConst(nodep->valuep());
|
||||
emitTraceIndex(nodep, arrayindex);
|
||||
puts(")");
|
||||
}
|
||||
}
|
||||
|
||||
void emitTraceIndex(const AstTraceInc* const nodep, int arrayindex) {
|
||||
// Tracing only supports 1D arrays
|
||||
if (nodep->declp()->arrayRange().ranged()) {
|
||||
if (arrayindex == -2) {
|
||||
puts("[i]");
|
||||
} else if (arrayindex == -1) {
|
||||
puts("[0]");
|
||||
} else {
|
||||
puts("[" + cvtToStr(arrayindex) + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// VISITORS
|
||||
using EmitCFunc::visit; // Suppress hidden overloaded virtual function warning
|
||||
void visit(AstCFunc* nodep) override {
|
||||
@@ -812,11 +797,7 @@ class EmitCTrace final : public EmitCFunc {
|
||||
}
|
||||
void visit(AstTracePushPrefix* nodep) override {
|
||||
putns(nodep, "tracep->pushPrefix(");
|
||||
if (nodep->quotedPrefix()) {
|
||||
putsQuoted(VIdProtect::protectWordsIf(nodep->prefix(), nodep->protect()));
|
||||
} else {
|
||||
puts(nodep->prefix());
|
||||
}
|
||||
putsQuoted(VIdProtect::protectWordsIf(nodep->prefix(), nodep->protect()));
|
||||
puts(", VerilatedTracePrefixType::");
|
||||
puts(nodep->prefixType().ascii());
|
||||
puts(");\n");
|
||||
|
||||
Reference in New Issue
Block a user