Optimize size of trace declaration object code (#7150)
This commit is contained in:
parent
6f892d58ac
commit
1af7fa92c2
|
|
@ -260,40 +260,70 @@ void VerilatedFst::declare(uint32_t code, const char* name, int dtypenum,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VerilatedFst::declEvent(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
// versions to call when the sig is not array member
|
||||||
|
void VerilatedFst::declEvent(uint32_t code, const char* name, int dtypenum,
|
||||||
VerilatedTraceSigDirection direction, VerilatedTraceSigKind kind,
|
VerilatedTraceSigDirection direction, VerilatedTraceSigKind kind,
|
||||||
VerilatedTraceSigType type, bool array, int arraynum) {
|
VerilatedTraceSigType type) {
|
||||||
declare(code, name, dtypenum, direction, kind, type, array, arraynum, false, 0, 0);
|
declare(code, name, dtypenum, direction, kind, type, false, -1, false, 0, 0);
|
||||||
}
|
}
|
||||||
void VerilatedFst::declBit(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void VerilatedFst::declBit(uint32_t code, const char* name, int dtypenum,
|
||||||
VerilatedTraceSigDirection direction, VerilatedTraceSigKind kind,
|
VerilatedTraceSigDirection direction, VerilatedTraceSigKind kind,
|
||||||
VerilatedTraceSigType type, bool array, int arraynum) {
|
VerilatedTraceSigType type) {
|
||||||
declare(code, name, dtypenum, direction, kind, type, array, arraynum, false, 0, 0);
|
declare(code, name, dtypenum, direction, kind, type, false, -1, false, 0, 0);
|
||||||
}
|
}
|
||||||
void VerilatedFst::declBus(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void VerilatedFst::declBus(uint32_t code, const char* name, int dtypenum,
|
||||||
VerilatedTraceSigDirection direction, VerilatedTraceSigKind kind,
|
VerilatedTraceSigDirection direction, VerilatedTraceSigKind kind,
|
||||||
VerilatedTraceSigType type, bool array, int arraynum, int msb,
|
VerilatedTraceSigType type, int msb, int lsb) {
|
||||||
int lsb) {
|
declare(code, name, dtypenum, direction, kind, type, false, -1, true, msb, lsb);
|
||||||
declare(code, name, dtypenum, direction, kind, type, array, arraynum, true, msb, lsb);
|
|
||||||
}
|
}
|
||||||
void VerilatedFst::declQuad(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void VerilatedFst::declQuad(uint32_t code, const char* name, int dtypenum,
|
||||||
VerilatedTraceSigDirection direction, VerilatedTraceSigKind kind,
|
VerilatedTraceSigDirection direction, VerilatedTraceSigKind kind,
|
||||||
VerilatedTraceSigType type, bool array, int arraynum, int msb,
|
VerilatedTraceSigType type, int msb, int lsb) {
|
||||||
int lsb) {
|
declare(code, name, dtypenum, direction, kind, type, false, -1, true, msb, lsb);
|
||||||
declare(code, name, dtypenum, direction, kind, type, array, arraynum, true, msb, lsb);
|
|
||||||
}
|
}
|
||||||
void VerilatedFst::declArray(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void VerilatedFst::declWide(uint32_t code, const char* name, int dtypenum,
|
||||||
VerilatedTraceSigDirection direction, VerilatedTraceSigKind kind,
|
VerilatedTraceSigDirection direction, VerilatedTraceSigKind kind,
|
||||||
VerilatedTraceSigType type, bool array, int arraynum, int msb,
|
VerilatedTraceSigType type, int msb, int lsb) {
|
||||||
int lsb) {
|
declare(code, name, dtypenum, direction, kind, type, false, -1, true, msb, lsb);
|
||||||
declare(code, name, dtypenum, direction, kind, type, array, arraynum, true, msb, lsb);
|
|
||||||
}
|
}
|
||||||
void VerilatedFst::declDouble(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void VerilatedFst::declDouble(uint32_t code, const char* name, int dtypenum,
|
||||||
VerilatedTraceSigDirection direction, VerilatedTraceSigKind kind,
|
VerilatedTraceSigDirection direction, VerilatedTraceSigKind kind,
|
||||||
VerilatedTraceSigType type, bool array, int arraynum) {
|
VerilatedTraceSigType type) {
|
||||||
declare(code, name, dtypenum, direction, kind, type, array, arraynum, false, 63, 0);
|
declare(code, name, dtypenum, direction, kind, type, false, -1, false, 63, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// versions to call when the sig is array member
|
||||||
|
void VerilatedFst::declEventArray(uint32_t code, const char* name, int dtypenum,
|
||||||
|
VerilatedTraceSigDirection direction, VerilatedTraceSigKind kind,
|
||||||
|
VerilatedTraceSigType type, int arraynum) {
|
||||||
|
declare(code, name, dtypenum, direction, kind, type, true, arraynum, false, 0, 0);
|
||||||
|
}
|
||||||
|
void VerilatedFst::declBitArray(uint32_t code, const char* name, int dtypenum,
|
||||||
|
VerilatedTraceSigDirection direction, VerilatedTraceSigKind kind,
|
||||||
|
VerilatedTraceSigType type, int arraynum) {
|
||||||
|
declare(code, name, dtypenum, direction, kind, type, true, arraynum, false, 0, 0);
|
||||||
|
}
|
||||||
|
void VerilatedFst::declBusArray(uint32_t code, const char* name, int dtypenum,
|
||||||
|
VerilatedTraceSigDirection direction, VerilatedTraceSigKind kind,
|
||||||
|
VerilatedTraceSigType type, int arraynum, int msb, int lsb) {
|
||||||
|
declare(code, name, dtypenum, direction, kind, type, true, arraynum, true, msb, lsb);
|
||||||
|
}
|
||||||
|
void VerilatedFst::declQuadArray(uint32_t code, const char* name, int dtypenum,
|
||||||
|
VerilatedTraceSigDirection direction, VerilatedTraceSigKind kind,
|
||||||
|
VerilatedTraceSigType type, int arraynum, int msb, int lsb) {
|
||||||
|
declare(code, name, dtypenum, direction, kind, type, true, arraynum, true, msb, lsb);
|
||||||
|
}
|
||||||
|
void VerilatedFst::declWideArray(uint32_t code, const char* name, int dtypenum,
|
||||||
|
VerilatedTraceSigDirection direction, VerilatedTraceSigKind kind,
|
||||||
|
VerilatedTraceSigType type, int arraynum, int msb, int lsb) {
|
||||||
|
declare(code, name, dtypenum, direction, kind, type, true, arraynum, true, msb, lsb);
|
||||||
|
}
|
||||||
|
void VerilatedFst::declDoubleArray(uint32_t code, const char* name, int dtypenum,
|
||||||
|
VerilatedTraceSigDirection direction,
|
||||||
|
VerilatedTraceSigKind kind, VerilatedTraceSigType type,
|
||||||
|
int arraynum) {
|
||||||
|
declare(code, name, dtypenum, direction, kind, type, true, arraynum, false, 63, 0);
|
||||||
|
}
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
// Get/commit trace buffer
|
// Get/commit trace buffer
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -113,29 +113,72 @@ public:
|
||||||
void pushPrefix(const char*, VerilatedTracePrefixType);
|
void pushPrefix(const char*, VerilatedTracePrefixType);
|
||||||
void popPrefix();
|
void popPrefix();
|
||||||
|
|
||||||
void declEvent(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
// versions to call when the sig is not array member
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
void declEvent(uint32_t code, const char* name, int dtypenum, VerilatedTraceSigDirection,
|
||||||
bool array, int arraynum);
|
VerilatedTraceSigKind, VerilatedTraceSigType);
|
||||||
void declBit(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void declBit(uint32_t code, const char* name, int dtypenum, VerilatedTraceSigDirection,
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
VerilatedTraceSigKind, VerilatedTraceSigType);
|
||||||
bool array, int arraynum);
|
void declBus(uint32_t code, const char* name, int dtypenum, VerilatedTraceSigDirection,
|
||||||
void declBus(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
VerilatedTraceSigKind, VerilatedTraceSigType, int msb, int lsb);
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
void declQuad(uint32_t code, const char* name, int dtypenum, VerilatedTraceSigDirection,
|
||||||
bool array, int arraynum, int msb, int lsb);
|
VerilatedTraceSigKind, VerilatedTraceSigType, int msb, int lsb);
|
||||||
void declQuad(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void declWide(uint32_t code, const char* name, int dtypenum, VerilatedTraceSigDirection,
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
VerilatedTraceSigKind, VerilatedTraceSigType, int msb, int lsb);
|
||||||
bool array, int arraynum, int msb, int lsb);
|
void declDouble(uint32_t code, const char* name, int dtypenum, VerilatedTraceSigDirection,
|
||||||
void declArray(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
VerilatedTraceSigKind, VerilatedTraceSigType);
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
|
||||||
bool array, int arraynum, int msb, int lsb);
|
// versions to call when the sig is array member
|
||||||
void declDouble(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void declEventArray(uint32_t code, const char* name, int dtypenum, VerilatedTraceSigDirection,
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
VerilatedTraceSigKind, VerilatedTraceSigType, int arraynum);
|
||||||
bool array, int arraynum);
|
void declBitArray(uint32_t code, const char* name, int dtypenum, VerilatedTraceSigDirection,
|
||||||
|
VerilatedTraceSigKind, VerilatedTraceSigType, int arraynum);
|
||||||
|
void declBusArray(uint32_t code, const char* name, int dtypenum, VerilatedTraceSigDirection,
|
||||||
|
VerilatedTraceSigKind, VerilatedTraceSigType, int arraynum, int msb,
|
||||||
|
int lsb);
|
||||||
|
void declQuadArray(uint32_t code, const char* name, int dtypenum, VerilatedTraceSigDirection,
|
||||||
|
VerilatedTraceSigKind, VerilatedTraceSigType, int arraynum, int msb,
|
||||||
|
int lsb);
|
||||||
|
void declWideArray(uint32_t code, const char* name, int dtypenum, VerilatedTraceSigDirection,
|
||||||
|
VerilatedTraceSigKind, VerilatedTraceSigType, int arraynum, int msb,
|
||||||
|
int lsb);
|
||||||
|
void declDoubleArray(uint32_t code, const char* name, int dtypenum, VerilatedTraceSigDirection,
|
||||||
|
VerilatedTraceSigKind, VerilatedTraceSigType, int arraynum);
|
||||||
|
|
||||||
void declDTypeEnum(int dtypenum, const char* name, uint32_t elements, unsigned int minValbits,
|
void declDTypeEnum(int dtypenum, const char* name, uint32_t elements, unsigned int minValbits,
|
||||||
const char** itemNamesp, const char** itemValuesp);
|
const char** itemNamesp, const char** itemValuesp);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// duck-typed interface to decl* methods
|
||||||
|
// We use macros in order to strip out unused args at compile time.
|
||||||
|
#define VL_TRACE_DECL_EVENT(tracep, code, fidx, name, dtypenum, dir, kind, type) \
|
||||||
|
tracep->declEvent(code, name, dtypenum, dir, kind, type)
|
||||||
|
#define VL_TRACE_DECL_BIT(tracep, code, fidx, name, dtypenum, dir, kind, type) \
|
||||||
|
tracep->declBit(code, name, dtypenum, dir, kind, type)
|
||||||
|
#define VL_TRACE_DECL_BUS(tracep, code, fidx, name, dtypenum, dir, kind, type, msb, lsb) \
|
||||||
|
tracep->declBus(code, name, dtypenum, dir, kind, type, msb, lsb)
|
||||||
|
#define VL_TRACE_DECL_QUAD(tracep, code, fidx, name, dtypenum, dir, kind, type, msb, lsb) \
|
||||||
|
tracep->declQuad(code, name, dtypenum, dir, kind, type, msb, lsb)
|
||||||
|
#define VL_TRACE_DECL_WIDE(tracep, code, fidx, name, dtypenum, dir, kind, type, msb, lsb) \
|
||||||
|
tracep->declWide(code, name, dtypenum, dir, kind, type, msb, lsb)
|
||||||
|
#define VL_TRACE_DECL_DOUBLE(tracep, code, fidx, name, dtypenum, dir, kind, type) \
|
||||||
|
tracep->declDouble(code, name, dtypenum, dir, kind, type)
|
||||||
|
|
||||||
|
#define VL_TRACE_DECL_EVENT_ARRAY(tracep, code, fidx, name, dtypenum, dir, kind, type, arraynum) \
|
||||||
|
tracep->declEventArray(code, name, dtypenum, dir, kind, type, arraynum)
|
||||||
|
#define VL_TRACE_DECL_BIT_ARRAY(tracep, code, fidx, name, dtypenum, dir, kind, type, arraynum) \
|
||||||
|
tracep->declBitArray(code, name, dtypenum, dir, kind, type, arraynum)
|
||||||
|
#define VL_TRACE_DECL_BUS_ARRAY(tracep, code, fidx, name, dtypenum, dir, kind, type, arraynum, \
|
||||||
|
msb, lsb) \
|
||||||
|
tracep->declBusArray(code, name, dtypenum, dir, kind, type, arraynum, msb, lsb)
|
||||||
|
#define VL_TRACE_DECL_QUAD_ARRAY(tracep, code, fidx, name, dtypenum, dir, kind, type, arraynum, \
|
||||||
|
msb, lsb) \
|
||||||
|
tracep->declQuadArray(code, name, dtypenum, dir, kind, type, arraynum, msb, lsb)
|
||||||
|
#define VL_TRACE_DECL_WIDE_ARRAY(tracep, code, fidx, name, dtypenum, dir, kind, type, arraynum, \
|
||||||
|
msb, lsb) \
|
||||||
|
tracep->declWideArray(code, name, dtypenum, dir, kind, type, arraynum, msb, lsb)
|
||||||
|
#define VL_TRACE_DECL_DOUBLE_ARRAY(tracep, code, fidx, name, dtypenum, dir, kind, type, arraynum) \
|
||||||
|
tracep->declDoubleArray(code, name, dtypenum, dir, kind, type, arraynum)
|
||||||
|
|
||||||
#ifndef DOXYGEN
|
#ifndef DOXYGEN
|
||||||
// Declare specialization here as it's used in VerilatedFstC just below
|
// Declare specialization here as it's used in VerilatedFstC just below
|
||||||
template <>
|
template <>
|
||||||
|
|
|
||||||
|
|
@ -547,42 +547,53 @@ void VerilatedSaif::declare(const uint32_t code, uint32_t fidx, const char* name
|
||||||
arraynum);
|
arraynum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VerilatedSaif::declEvent(const uint32_t code, const uint32_t fidx, const char* name,
|
// versions to call when the sig is not array member
|
||||||
const int dtypenum, const VerilatedTraceSigDirection,
|
void VerilatedSaif::declEvent(const uint32_t code, const uint32_t fidx, const char* name) {
|
||||||
const VerilatedTraceSigKind, const VerilatedTraceSigType,
|
declare(code, fidx, name, "event", false, -1, false, 0, 0);
|
||||||
const bool array, const int arraynum) {
|
|
||||||
declare(code, fidx, name, "event", array, arraynum, false, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
void VerilatedSaif::declBit(const uint32_t code, const uint32_t fidx, const char* name) {
|
||||||
void VerilatedSaif::declBit(const uint32_t code, const uint32_t fidx, const char* name,
|
declare(code, fidx, name, "wire", false, -1, false, 0, 0);
|
||||||
const int dtypenum, const VerilatedTraceSigDirection,
|
|
||||||
const VerilatedTraceSigKind, const VerilatedTraceSigType,
|
|
||||||
const bool array, const int arraynum) {
|
|
||||||
declare(code, fidx, name, "wire", array, arraynum, false, 0, 0);
|
|
||||||
}
|
}
|
||||||
void VerilatedSaif::declBus(const uint32_t code, const uint32_t fidx, const char* name,
|
void VerilatedSaif::declBus(const uint32_t code, const uint32_t fidx, const char* name,
|
||||||
const int dtypenum, const VerilatedTraceSigDirection,
|
const int msb, const int lsb) {
|
||||||
const VerilatedTraceSigKind, const VerilatedTraceSigType,
|
declare(code, fidx, name, "wire", false, -1, true, msb, lsb);
|
||||||
const bool array, const int arraynum, const int msb, const int lsb) {
|
|
||||||
declare(code, fidx, name, "wire", array, arraynum, true, msb, lsb);
|
|
||||||
}
|
}
|
||||||
void VerilatedSaif::declQuad(const uint32_t code, const uint32_t fidx, const char* name,
|
void VerilatedSaif::declQuad(const uint32_t code, const uint32_t fidx, const char* name,
|
||||||
const int dtypenum, const VerilatedTraceSigDirection,
|
const int msb, const int lsb) {
|
||||||
const VerilatedTraceSigKind, const VerilatedTraceSigType,
|
declare(code, fidx, name, "wire", false, -1, true, msb, lsb);
|
||||||
const bool array, const int arraynum, const int msb, const int lsb) {
|
|
||||||
declare(code, fidx, name, "wire", array, arraynum, true, msb, lsb);
|
|
||||||
}
|
}
|
||||||
void VerilatedSaif::declArray(const uint32_t code, const uint32_t fidx, const char* name,
|
void VerilatedSaif::declWide(const uint32_t code, const uint32_t fidx, const char* name,
|
||||||
const int dtypenum, const VerilatedTraceSigDirection,
|
const int msb, const int lsb) {
|
||||||
const VerilatedTraceSigKind, const VerilatedTraceSigType,
|
declare(code, fidx, name, "wire", false, -1, true, msb, lsb);
|
||||||
const bool array, const int arraynum, const int msb, const int lsb) {
|
|
||||||
declare(code, fidx, name, "wire", array, arraynum, true, msb, lsb);
|
|
||||||
}
|
}
|
||||||
void VerilatedSaif::declDouble(const uint32_t code, const uint32_t fidx, const char* name,
|
void VerilatedSaif::declDouble(const uint32_t code, const uint32_t fidx, const char* name) {
|
||||||
const int dtypenum, const VerilatedTraceSigDirection,
|
declare(code, fidx, name, "real", false, -1, false, 63, 0);
|
||||||
const VerilatedTraceSigKind, const VerilatedTraceSigType,
|
}
|
||||||
const bool array, const int arraynum) {
|
|
||||||
declare(code, fidx, name, "real", array, arraynum, false, 63, 0);
|
// versions to call when the sig is array member
|
||||||
|
void VerilatedSaif::declEventArray(const uint32_t code, const uint32_t fidx, const char* name,
|
||||||
|
const int arraynum) {
|
||||||
|
declare(code, fidx, name, "event", true, arraynum, false, 0, 0);
|
||||||
|
}
|
||||||
|
void VerilatedSaif::declBitArray(const uint32_t code, const uint32_t fidx, const char* name,
|
||||||
|
const int arraynum) {
|
||||||
|
declare(code, fidx, name, "wire", true, arraynum, false, 0, 0);
|
||||||
|
}
|
||||||
|
void VerilatedSaif::declBusArray(const uint32_t code, const uint32_t fidx, const char* name,
|
||||||
|
const int arraynum, const int msb, const int lsb) {
|
||||||
|
declare(code, fidx, name, "wire", true, arraynum, true, msb, lsb);
|
||||||
|
}
|
||||||
|
void VerilatedSaif::declQuadArray(const uint32_t code, const uint32_t fidx, const char* name,
|
||||||
|
const int arraynum, const int msb, const int lsb) {
|
||||||
|
declare(code, fidx, name, "wire", true, arraynum, true, msb, lsb);
|
||||||
|
}
|
||||||
|
void VerilatedSaif::declWideArray(const uint32_t code, const uint32_t fidx, const char* name,
|
||||||
|
const int arraynum, const int msb, const int lsb) {
|
||||||
|
declare(code, fidx, name, "wire", true, arraynum, true, msb, lsb);
|
||||||
|
}
|
||||||
|
void VerilatedSaif::declDoubleArray(const uint32_t code, const uint32_t fidx, const char* name,
|
||||||
|
const int arraynum) {
|
||||||
|
declare(code, fidx, name, "real", true, arraynum, false, 63, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
|
||||||
|
|
@ -146,26 +146,57 @@ public:
|
||||||
void pushPrefix(const char*, VerilatedTracePrefixType);
|
void pushPrefix(const char*, VerilatedTracePrefixType);
|
||||||
void popPrefix();
|
void popPrefix();
|
||||||
|
|
||||||
void declEvent(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
// versions to call when the sig is not array member
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
void declEvent(uint32_t code, uint32_t fidx, const char* name);
|
||||||
bool array, int arraynum);
|
void declBit(uint32_t code, uint32_t fidx, const char* name);
|
||||||
void declBit(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void declBus(uint32_t code, uint32_t fidx, const char* name, int msb, int lsb);
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
void declQuad(uint32_t code, uint32_t fidx, const char* name, int msb, int lsb);
|
||||||
bool array, int arraynum);
|
void declWide(uint32_t code, uint32_t fidx, const char* name, int msb, int lsb);
|
||||||
void declBus(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void declDouble(uint32_t code, uint32_t fidx, const char* name);
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
|
||||||
bool array, int arraynum, int msb, int lsb);
|
// versions to call when the sig is array member
|
||||||
void declQuad(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void declEventArray(uint32_t code, uint32_t fidx, const char* name, int arraynum);
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
void declBitArray(uint32_t code, uint32_t fidx, const char* name, int arraynum);
|
||||||
bool array, int arraynum, int msb, int lsb);
|
void declBusArray(uint32_t code, uint32_t fidx, const char* name, int arraynum, int msb,
|
||||||
void declArray(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
int lsb);
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
void declQuadArray(uint32_t code, uint32_t fidx, const char* name, int arraynum, int msb,
|
||||||
bool array, int arraynum, int msb, int lsb);
|
int lsb);
|
||||||
void declDouble(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void declWideArray(uint32_t code, uint32_t fidx, const char* name, int arraynum, int msb,
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
int lsb);
|
||||||
bool array, int arraynum);
|
void declDoubleArray(uint32_t code, uint32_t fidx, const char* name, int arraynum);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// duck-typed interface to decl* methods
|
||||||
|
// We use macros in order to strip out unused args at compile time.
|
||||||
|
#define VL_TRACE_DECL_EVENT(tracep, code, fidx, name, dtypenum, dir, kind, type) \
|
||||||
|
tracep->declEvent(code, fidx, name)
|
||||||
|
#define VL_TRACE_DECL_BIT(tracep, code, fidx, name, dtypenum, dir, kind, type) \
|
||||||
|
tracep->declBit(code, fidx, name)
|
||||||
|
#define VL_TRACE_DECL_BUS(tracep, code, fidx, name, dtypenum, dir, kind, type, msb, lsb) \
|
||||||
|
tracep->declBus(code, fidx, name, msb, lsb)
|
||||||
|
#define VL_TRACE_DECL_QUAD(tracep, code, fidx, name, dtypenum, dir, kind, type, msb, lsb) \
|
||||||
|
tracep->declQuad(code, fidx, name, msb, lsb)
|
||||||
|
#define VL_TRACE_DECL_WIDE(tracep, code, fidx, name, dtypenum, dir, kind, type, msb, lsb) \
|
||||||
|
tracep->declWide(code, fidx, name, msb, lsb)
|
||||||
|
#define VL_TRACE_DECL_DOUBLE(tracep, code, fidx, name, dtypenum, dir, kind, type) \
|
||||||
|
tracep->declDouble(code, fidx, name)
|
||||||
|
|
||||||
|
#define VL_TRACE_DECL_EVENT_ARRAY(tracep, code, fidx, name, dtypenum, dir, kind, type, arraynum) \
|
||||||
|
tracep->declEventArray(code, fidx, name, arraynum)
|
||||||
|
#define VL_TRACE_DECL_BIT_ARRAY(tracep, code, fidx, name, dtypenum, dir, kind, type, arraynum) \
|
||||||
|
tracep->declBitArray(code, fidx, name, arraynum)
|
||||||
|
#define VL_TRACE_DECL_BUS_ARRAY(tracep, code, fidx, name, dtypenum, dir, kind, type, arraynum, \
|
||||||
|
msb, lsb) \
|
||||||
|
tracep->declBusArray(code, fidx, name, arraynum, msb, lsb)
|
||||||
|
#define VL_TRACE_DECL_QUAD_ARRAY(tracep, code, fidx, name, dtypenum, dir, kind, type, arraynum, \
|
||||||
|
msb, lsb) \
|
||||||
|
tracep->declQuadArray(code, fidx, name, arraynum, msb, lsb)
|
||||||
|
#define VL_TRACE_DECL_WIDE_ARRAY(tracep, code, fidx, name, dtypenum, dir, kind, type, arraynum, \
|
||||||
|
msb, lsb) \
|
||||||
|
tracep->declWideArray(code, fidx, name, arraynum, msb, lsb)
|
||||||
|
#define VL_TRACE_DECL_DOUBLE_ARRAY(tracep, code, fidx, name, dtypenum, dir, kind, type, arraynum) \
|
||||||
|
tracep->declDoubleArray(code, fidx, name, arraynum)
|
||||||
|
|
||||||
#ifndef DOXYGEN
|
#ifndef DOXYGEN
|
||||||
// Declare specialization here as it's used in VerilatedSaifC just below
|
// Declare specialization here as it's used in VerilatedSaifC just below
|
||||||
template <>
|
template <>
|
||||||
|
|
|
||||||
|
|
@ -451,35 +451,44 @@ void VerilatedVcd::declare(uint32_t code, const char* name, const char* wirep, b
|
||||||
printStr(decl.c_str());
|
printStr(decl.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void VerilatedVcd::declEvent(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
// versions to call when the sig is not array member
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind,
|
void VerilatedVcd::declEvent(uint32_t code, const char* name) {
|
||||||
VerilatedTraceSigType, bool array, int arraynum) {
|
declare(code, name, "event", false, -1, false, 0, 0);
|
||||||
declare(code, name, "event", array, arraynum, false, 0, 0);
|
|
||||||
}
|
}
|
||||||
void VerilatedVcd::declBit(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void VerilatedVcd::declBit(uint32_t code, const char* name) {
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind,
|
declare(code, name, "wire", false, -1, false, 0, 0);
|
||||||
VerilatedTraceSigType, bool array, int arraynum) {
|
|
||||||
declare(code, name, "wire", array, arraynum, false, 0, 0);
|
|
||||||
}
|
}
|
||||||
void VerilatedVcd::declBus(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void VerilatedVcd::declBus(uint32_t code, const char* name, int msb, int lsb) {
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind,
|
declare(code, name, "wire", false, -1, true, msb, lsb);
|
||||||
VerilatedTraceSigType, bool array, int arraynum, int msb, int lsb) {
|
|
||||||
declare(code, name, "wire", array, arraynum, true, msb, lsb);
|
|
||||||
}
|
}
|
||||||
void VerilatedVcd::declQuad(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void VerilatedVcd::declQuad(uint32_t code, const char* name, int msb, int lsb) {
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind,
|
declare(code, name, "wire", false, -1, true, msb, lsb);
|
||||||
VerilatedTraceSigType, bool array, int arraynum, int msb, int lsb) {
|
|
||||||
declare(code, name, "wire", array, arraynum, true, msb, lsb);
|
|
||||||
}
|
}
|
||||||
void VerilatedVcd::declArray(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void VerilatedVcd::declWide(uint32_t code, const char* name, int msb, int lsb) {
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind,
|
declare(code, name, "wire", false, -1, true, msb, lsb);
|
||||||
VerilatedTraceSigType, bool array, int arraynum, int msb, int lsb) {
|
|
||||||
declare(code, name, "wire", array, arraynum, true, msb, lsb);
|
|
||||||
}
|
}
|
||||||
void VerilatedVcd::declDouble(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void VerilatedVcd::declDouble(uint32_t code, const char* name) {
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind,
|
declare(code, name, "real", false, -1, false, 63, 0);
|
||||||
VerilatedTraceSigType, bool array, int arraynum) {
|
}
|
||||||
declare(code, name, "real", array, arraynum, false, 63, 0);
|
|
||||||
|
// versions to call when the sig is array member
|
||||||
|
void VerilatedVcd::declEventArray(uint32_t code, const char* name, int arraynum) {
|
||||||
|
declare(code, name, "event", true, arraynum, false, 0, 0);
|
||||||
|
}
|
||||||
|
void VerilatedVcd::declBitArray(uint32_t code, const char* name, int arraynum) {
|
||||||
|
declare(code, name, "wire", true, arraynum, false, 0, 0);
|
||||||
|
}
|
||||||
|
void VerilatedVcd::declBusArray(uint32_t code, const char* name, int arraynum, int msb, int lsb) {
|
||||||
|
declare(code, name, "wire", true, arraynum, true, msb, lsb);
|
||||||
|
}
|
||||||
|
void VerilatedVcd::declQuadArray(uint32_t code, const char* name, int arraynum, int msb, int lsb) {
|
||||||
|
declare(code, name, "wire", true, arraynum, true, msb, lsb);
|
||||||
|
}
|
||||||
|
void VerilatedVcd::declWideArray(uint32_t code, const char* name, int arraynum, int msb, int lsb) {
|
||||||
|
declare(code, name, "wire", true, arraynum, true, msb, lsb);
|
||||||
|
}
|
||||||
|
void VerilatedVcd::declDoubleArray(uint32_t code, const char* name, int arraynum) {
|
||||||
|
declare(code, name, "real", true, arraynum, false, 63, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
|
||||||
|
|
@ -137,26 +137,55 @@ public:
|
||||||
void pushPrefix(const char*, VerilatedTracePrefixType);
|
void pushPrefix(const char*, VerilatedTracePrefixType);
|
||||||
void popPrefix();
|
void popPrefix();
|
||||||
|
|
||||||
void declEvent(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
// versions to call when the sig is not array member
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
void declEvent(uint32_t code, const char* name);
|
||||||
bool array, int arraynum);
|
void declBit(uint32_t code, const char* name);
|
||||||
void declBit(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void declBus(uint32_t code, const char* name, int msb, int lsb);
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
void declQuad(uint32_t code, const char* name, int msb, int lsb);
|
||||||
bool array, int arraynum);
|
void declWide(uint32_t code, const char* name, int msb, int lsb);
|
||||||
void declBus(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void declDouble(uint32_t code, const char* name);
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
|
||||||
bool array, int arraynum, int msb, int lsb);
|
// versions to call when the sig is array member
|
||||||
void declQuad(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void declEventArray(uint32_t code, const char* name, int arraynum);
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
void declBitArray(uint32_t code, const char* name, int arraynum);
|
||||||
bool array, int arraynum, int msb, int lsb);
|
void declBusArray(uint32_t code, const char* name, int arraynum, int msb, int lsb);
|
||||||
void declArray(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
void declQuadArray(uint32_t code, const char* name, int arraynum, int msb, int lsb);
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
void declWideArray(uint32_t code, const char* name, int arraynum, int msb, int lsb);
|
||||||
bool array, int arraynum, int msb, int lsb);
|
void declDoubleArray(uint32_t code, const char* name, int arraynum);
|
||||||
void declDouble(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
|
||||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
|
||||||
bool array, int arraynum);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// duck-typed interface to decl* methods
|
||||||
|
// We use macros in order to strip out unused args at compile time.
|
||||||
|
|
||||||
|
#define VL_TRACE_DECL_EVENT(tracep, code, fidx, name, dtypenum, dir, kind, type) \
|
||||||
|
tracep->declEvent(code, name)
|
||||||
|
#define VL_TRACE_DECL_BIT(tracep, code, fidx, name, dtypenum, dir, kind, type) \
|
||||||
|
tracep->declBit(code, name)
|
||||||
|
#define VL_TRACE_DECL_BUS(tracep, code, fidx, name, dtypenum, dir, kind, type, msb, lsb) \
|
||||||
|
tracep->declBus(code, name, msb, lsb)
|
||||||
|
#define VL_TRACE_DECL_QUAD(tracep, code, fidx, name, dtypenum, dir, kind, type, msb, lsb) \
|
||||||
|
tracep->declQuad(code, name, msb, lsb)
|
||||||
|
#define VL_TRACE_DECL_WIDE(tracep, code, fidx, name, dtypenum, dir, kind, type, msb, lsb) \
|
||||||
|
tracep->declWide(code, name, msb, lsb)
|
||||||
|
#define VL_TRACE_DECL_DOUBLE(tracep, code, fidx, name, dtypenum, dir, kind, type) \
|
||||||
|
tracep->declDouble(code, name)
|
||||||
|
|
||||||
|
#define VL_TRACE_DECL_EVENT_ARRAY(tracep, code, fidx, name, dtypenum, dir, kind, type, arraynum) \
|
||||||
|
tracep->declEventArray(code, name, arraynum)
|
||||||
|
#define VL_TRACE_DECL_BIT_ARRAY(tracep, code, fidx, name, dtypenum, dir, kind, type, arraynum) \
|
||||||
|
tracep->declBitArray(code, name, arraynum)
|
||||||
|
#define VL_TRACE_DECL_BUS_ARRAY(tracep, code, fidx, name, dtypenum, dir, kind, type, arraynum, \
|
||||||
|
msb, lsb) \
|
||||||
|
tracep->declBusArray(code, name, arraynum, msb, lsb)
|
||||||
|
#define VL_TRACE_DECL_QUAD_ARRAY(tracep, code, fidx, name, dtypenum, dir, kind, type, arraynum, \
|
||||||
|
msb, lsb) \
|
||||||
|
tracep->declQuadArray(code, name, arraynum, msb, lsb)
|
||||||
|
#define VL_TRACE_DECL_WIDE_ARRAY(tracep, code, fidx, name, dtypenum, dir, kind, type, arraynum, \
|
||||||
|
msb, lsb) \
|
||||||
|
tracep->declWideArray(code, name, arraynum, msb, lsb)
|
||||||
|
#define VL_TRACE_DECL_DOUBLE_ARRAY(tracep, code, fidx, name, dtypenum, dir, kind, type, arraynum) \
|
||||||
|
tracep->declDoubleArray(code, name, arraynum)
|
||||||
|
|
||||||
#ifndef DOXYGEN
|
#ifndef DOXYGEN
|
||||||
// Declare specialization here as it's used in VerilatedFstC just below
|
// Declare specialization here as it's used in VerilatedFstC just below
|
||||||
template <>
|
template <>
|
||||||
|
|
|
||||||
|
|
@ -627,21 +627,27 @@ class EmitCTrace final : public EmitCFunc {
|
||||||
|
|
||||||
void emitTraceInitOne(const AstTraceDecl* nodep, int enumNum) {
|
void emitTraceInitOne(const AstTraceDecl* nodep, int enumNum) {
|
||||||
if (nodep->dtypep()->basicp()->isDouble()) {
|
if (nodep->dtypep()->basicp()->isDouble()) {
|
||||||
puts("tracep->declDouble(");
|
puts("VL_TRACE_DECL_DOUBLE");
|
||||||
} else if (nodep->isWide()) {
|
} else if (nodep->isWide()) {
|
||||||
puts("tracep->declArray(");
|
puts("VL_TRACE_DECL_WIDE");
|
||||||
} else if (nodep->isQuad()) {
|
} else if (nodep->isQuad()) {
|
||||||
puts("tracep->declQuad(");
|
puts("VL_TRACE_DECL_QUAD");
|
||||||
} else if (nodep->bitRange().ranged()) {
|
} else if (nodep->bitRange().ranged()) {
|
||||||
puts("tracep->declBus(");
|
puts("VL_TRACE_DECL_BUS");
|
||||||
} else if (nodep->dtypep()->basicp()->isEvent()) {
|
} else if (nodep->dtypep()->basicp()->isEvent()) {
|
||||||
puts("tracep->declEvent(");
|
puts("VL_TRACE_DECL_EVENT");
|
||||||
} else {
|
} else {
|
||||||
puts("tracep->declBit(");
|
puts("VL_TRACE_DECL_BIT");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nodep->arrayRange().ranged()) {
|
||||||
|
puts("_ARRAY(tracep");
|
||||||
|
} else {
|
||||||
|
puts("(tracep");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Code
|
// Code
|
||||||
puts("c+" + cvtToStr(nodep->code()));
|
puts(",c+" + cvtToStr(nodep->code()));
|
||||||
if (nodep->arrayRange().ranged()) puts("+i*" + cvtToStr(nodep->widthWords()));
|
if (nodep->arrayRange().ranged()) puts("+i*" + cvtToStr(nodep->widthWords()));
|
||||||
|
|
||||||
// Function index
|
// Function index
|
||||||
|
|
@ -676,9 +682,7 @@ class EmitCTrace final : public EmitCFunc {
|
||||||
|
|
||||||
// Array range
|
// Array range
|
||||||
if (nodep->arrayRange().ranged()) {
|
if (nodep->arrayRange().ranged()) {
|
||||||
puts(", true,(i+" + cvtToStr(nodep->arrayRange().lo()) + ")");
|
puts(", (i+" + cvtToStr(nodep->arrayRange().lo()) + ")");
|
||||||
} else {
|
|
||||||
puts(", false,-1");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bit range
|
// Bit range
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue