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,
|
||||
VerilatedTraceSigType type, bool array, int arraynum) {
|
||||
declare(code, name, dtypenum, direction, kind, type, array, arraynum, false, 0, 0);
|
||||
VerilatedTraceSigType type) {
|
||||
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,
|
||||
VerilatedTraceSigType type, bool array, int arraynum) {
|
||||
declare(code, name, dtypenum, direction, kind, type, array, arraynum, false, 0, 0);
|
||||
VerilatedTraceSigType type) {
|
||||
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,
|
||||
VerilatedTraceSigType type, bool array, int arraynum, int msb,
|
||||
int lsb) {
|
||||
declare(code, name, dtypenum, direction, kind, type, array, arraynum, true, msb, lsb);
|
||||
VerilatedTraceSigType type, int msb, int lsb) {
|
||||
declare(code, name, dtypenum, direction, kind, type, false, -1, 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,
|
||||
VerilatedTraceSigType type, bool array, int arraynum, int msb,
|
||||
int lsb) {
|
||||
declare(code, name, dtypenum, direction, kind, type, array, arraynum, true, msb, lsb);
|
||||
VerilatedTraceSigType type, int msb, int lsb) {
|
||||
declare(code, name, dtypenum, direction, kind, type, false, -1, true, msb, lsb);
|
||||
}
|
||||
void VerilatedFst::declArray(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection direction, VerilatedTraceSigKind kind,
|
||||
VerilatedTraceSigType type, bool array, int arraynum, int msb,
|
||||
int lsb) {
|
||||
declare(code, name, dtypenum, direction, kind, type, array, arraynum, true, msb, lsb);
|
||||
void VerilatedFst::declWide(uint32_t code, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection direction, VerilatedTraceSigKind kind,
|
||||
VerilatedTraceSigType type, int msb, int lsb) {
|
||||
declare(code, name, dtypenum, direction, kind, type, false, -1, 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,
|
||||
VerilatedTraceSigType type, bool array, int arraynum) {
|
||||
declare(code, name, dtypenum, direction, kind, type, array, arraynum, false, 63, 0);
|
||||
VerilatedTraceSigType type) {
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -113,29 +113,72 @@ public:
|
|||
void pushPrefix(const char*, VerilatedTracePrefixType);
|
||||
void popPrefix();
|
||||
|
||||
void declEvent(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
||||
bool array, int arraynum);
|
||||
void declBit(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
||||
bool array, int arraynum);
|
||||
void declBus(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
||||
bool array, int arraynum, int msb, int lsb);
|
||||
void declQuad(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
||||
bool array, int arraynum, int msb, int lsb);
|
||||
void declArray(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
||||
bool array, int arraynum, int msb, int lsb);
|
||||
void declDouble(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
||||
bool array, int arraynum);
|
||||
// versions to call when the sig is not array member
|
||||
void declEvent(uint32_t code, const char* name, int dtypenum, VerilatedTraceSigDirection,
|
||||
VerilatedTraceSigKind, VerilatedTraceSigType);
|
||||
void declBit(uint32_t code, const char* name, int dtypenum, VerilatedTraceSigDirection,
|
||||
VerilatedTraceSigKind, VerilatedTraceSigType);
|
||||
void declBus(uint32_t code, const char* name, int dtypenum, VerilatedTraceSigDirection,
|
||||
VerilatedTraceSigKind, VerilatedTraceSigType, int msb, int lsb);
|
||||
void declQuad(uint32_t code, const char* name, int dtypenum, VerilatedTraceSigDirection,
|
||||
VerilatedTraceSigKind, VerilatedTraceSigType, int msb, int lsb);
|
||||
void declWide(uint32_t code, const char* name, int dtypenum, VerilatedTraceSigDirection,
|
||||
VerilatedTraceSigKind, VerilatedTraceSigType, int msb, int lsb);
|
||||
void declDouble(uint32_t code, const char* name, int dtypenum, VerilatedTraceSigDirection,
|
||||
VerilatedTraceSigKind, VerilatedTraceSigType);
|
||||
|
||||
// versions to call when the sig is array member
|
||||
void declEventArray(uint32_t code, const char* name, int dtypenum, VerilatedTraceSigDirection,
|
||||
VerilatedTraceSigKind, VerilatedTraceSigType, 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,
|
||||
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
|
||||
// Declare specialization here as it's used in VerilatedFstC just below
|
||||
template <>
|
||||
|
|
|
|||
|
|
@ -547,42 +547,53 @@ void VerilatedSaif::declare(const uint32_t code, uint32_t fidx, const char* name
|
|||
arraynum);
|
||||
}
|
||||
|
||||
void VerilatedSaif::declEvent(const uint32_t code, const uint32_t fidx, const char* name,
|
||||
const int dtypenum, const VerilatedTraceSigDirection,
|
||||
const VerilatedTraceSigKind, const VerilatedTraceSigType,
|
||||
const bool array, const int arraynum) {
|
||||
declare(code, fidx, name, "event", array, arraynum, false, 0, 0);
|
||||
// versions to call when the sig is not array member
|
||||
void VerilatedSaif::declEvent(const uint32_t code, const uint32_t fidx, const char* name) {
|
||||
declare(code, fidx, name, "event", false, -1, false, 0, 0);
|
||||
}
|
||||
|
||||
void VerilatedSaif::declBit(const uint32_t code, const uint32_t fidx, const char* name,
|
||||
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::declBit(const uint32_t code, const uint32_t fidx, const char* name) {
|
||||
declare(code, fidx, name, "wire", false, -1, false, 0, 0);
|
||||
}
|
||||
void VerilatedSaif::declBus(const uint32_t code, const uint32_t fidx, const char* name,
|
||||
const int dtypenum, const VerilatedTraceSigDirection,
|
||||
const VerilatedTraceSigKind, const VerilatedTraceSigType,
|
||||
const bool array, const int arraynum, const int msb, const int lsb) {
|
||||
declare(code, fidx, name, "wire", array, arraynum, true, msb, lsb);
|
||||
const int msb, const int lsb) {
|
||||
declare(code, fidx, name, "wire", false, -1, true, msb, lsb);
|
||||
}
|
||||
void VerilatedSaif::declQuad(const uint32_t code, const uint32_t fidx, const char* name,
|
||||
const int dtypenum, const VerilatedTraceSigDirection,
|
||||
const VerilatedTraceSigKind, const VerilatedTraceSigType,
|
||||
const bool array, const int arraynum, const int msb, const int lsb) {
|
||||
declare(code, fidx, name, "wire", array, arraynum, true, msb, lsb);
|
||||
const int msb, const int lsb) {
|
||||
declare(code, fidx, name, "wire", false, -1, true, msb, lsb);
|
||||
}
|
||||
void VerilatedSaif::declArray(const uint32_t code, const uint32_t fidx, const char* name,
|
||||
const int dtypenum, const VerilatedTraceSigDirection,
|
||||
const VerilatedTraceSigKind, const VerilatedTraceSigType,
|
||||
const bool array, const int arraynum, const int msb, const int lsb) {
|
||||
declare(code, fidx, name, "wire", array, arraynum, true, msb, lsb);
|
||||
void VerilatedSaif::declWide(const uint32_t code, const uint32_t fidx, const char* name,
|
||||
const int msb, const int lsb) {
|
||||
declare(code, fidx, name, "wire", false, -1, true, msb, lsb);
|
||||
}
|
||||
void VerilatedSaif::declDouble(const uint32_t code, const uint32_t fidx, const char* name,
|
||||
const int dtypenum, const VerilatedTraceSigDirection,
|
||||
const VerilatedTraceSigKind, const VerilatedTraceSigType,
|
||||
const bool array, const int arraynum) {
|
||||
declare(code, fidx, name, "real", array, arraynum, false, 63, 0);
|
||||
void VerilatedSaif::declDouble(const uint32_t code, const uint32_t fidx, const char* name) {
|
||||
declare(code, fidx, name, "real", false, -1, 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 popPrefix();
|
||||
|
||||
void declEvent(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
||||
bool array, int arraynum);
|
||||
void declBit(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
||||
bool array, int arraynum);
|
||||
void declBus(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
||||
bool array, int arraynum, int msb, int lsb);
|
||||
void declQuad(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
||||
bool array, int arraynum, int msb, int lsb);
|
||||
void declArray(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
||||
bool array, int arraynum, int msb, int lsb);
|
||||
void declDouble(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
||||
bool array, int arraynum);
|
||||
// versions to call when the sig is not array member
|
||||
void declEvent(uint32_t code, uint32_t fidx, const char* name);
|
||||
void declBit(uint32_t code, uint32_t fidx, const char* name);
|
||||
void declBus(uint32_t code, uint32_t fidx, const char* name, int msb, int lsb);
|
||||
void declQuad(uint32_t code, uint32_t fidx, const char* name, int msb, int lsb);
|
||||
void declWide(uint32_t code, uint32_t fidx, const char* name, int msb, int lsb);
|
||||
void declDouble(uint32_t code, uint32_t fidx, const char* name);
|
||||
|
||||
// versions to call when the sig is array member
|
||||
void declEventArray(uint32_t code, uint32_t fidx, const char* name, int arraynum);
|
||||
void declBitArray(uint32_t code, uint32_t fidx, const char* name, int arraynum);
|
||||
void declBusArray(uint32_t code, uint32_t fidx, const char* name, int arraynum, int msb,
|
||||
int lsb);
|
||||
void declQuadArray(uint32_t code, uint32_t fidx, const char* name, int arraynum, int msb,
|
||||
int lsb);
|
||||
void declWideArray(uint32_t code, uint32_t fidx, const char* name, int arraynum, int msb,
|
||||
int lsb);
|
||||
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
|
||||
// Declare specialization here as it's used in VerilatedSaifC just below
|
||||
template <>
|
||||
|
|
|
|||
|
|
@ -451,35 +451,44 @@ void VerilatedVcd::declare(uint32_t code, const char* name, const char* wirep, b
|
|||
printStr(decl.c_str());
|
||||
}
|
||||
|
||||
void VerilatedVcd::declEvent(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind,
|
||||
VerilatedTraceSigType, bool array, int arraynum) {
|
||||
declare(code, name, "event", array, arraynum, false, 0, 0);
|
||||
// versions to call when the sig is not array member
|
||||
void VerilatedVcd::declEvent(uint32_t code, const char* name) {
|
||||
declare(code, name, "event", false, -1, false, 0, 0);
|
||||
}
|
||||
void VerilatedVcd::declBit(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind,
|
||||
VerilatedTraceSigType, bool array, int arraynum) {
|
||||
declare(code, name, "wire", array, arraynum, false, 0, 0);
|
||||
void VerilatedVcd::declBit(uint32_t code, const char* name) {
|
||||
declare(code, name, "wire", false, -1, false, 0, 0);
|
||||
}
|
||||
void VerilatedVcd::declBus(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind,
|
||||
VerilatedTraceSigType, bool array, int arraynum, int msb, int lsb) {
|
||||
declare(code, name, "wire", array, arraynum, true, msb, lsb);
|
||||
void VerilatedVcd::declBus(uint32_t code, const char* name, int msb, int lsb) {
|
||||
declare(code, name, "wire", false, -1, true, msb, lsb);
|
||||
}
|
||||
void VerilatedVcd::declQuad(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind,
|
||||
VerilatedTraceSigType, bool array, int arraynum, int msb, int lsb) {
|
||||
declare(code, name, "wire", array, arraynum, true, msb, lsb);
|
||||
void VerilatedVcd::declQuad(uint32_t code, const char* name, int msb, int lsb) {
|
||||
declare(code, name, "wire", false, -1, true, msb, lsb);
|
||||
}
|
||||
void VerilatedVcd::declArray(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind,
|
||||
VerilatedTraceSigType, bool array, int arraynum, int msb, int lsb) {
|
||||
declare(code, name, "wire", array, arraynum, true, msb, lsb);
|
||||
void VerilatedVcd::declWide(uint32_t code, const char* name, int msb, int lsb) {
|
||||
declare(code, name, "wire", false, -1, true, msb, lsb);
|
||||
}
|
||||
void VerilatedVcd::declDouble(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind,
|
||||
VerilatedTraceSigType, bool array, int arraynum) {
|
||||
declare(code, name, "real", array, arraynum, false, 63, 0);
|
||||
void VerilatedVcd::declDouble(uint32_t code, const char* name) {
|
||||
declare(code, name, "real", false, -1, 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 popPrefix();
|
||||
|
||||
void declEvent(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
||||
bool array, int arraynum);
|
||||
void declBit(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
||||
bool array, int arraynum);
|
||||
void declBus(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
||||
bool array, int arraynum, int msb, int lsb);
|
||||
void declQuad(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
||||
bool array, int arraynum, int msb, int lsb);
|
||||
void declArray(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
||||
bool array, int arraynum, int msb, int lsb);
|
||||
void declDouble(uint32_t code, uint32_t fidx, const char* name, int dtypenum,
|
||||
VerilatedTraceSigDirection, VerilatedTraceSigKind, VerilatedTraceSigType,
|
||||
bool array, int arraynum);
|
||||
// versions to call when the sig is not array member
|
||||
void declEvent(uint32_t code, const char* name);
|
||||
void declBit(uint32_t code, const char* name);
|
||||
void declBus(uint32_t code, const char* name, int msb, int lsb);
|
||||
void declQuad(uint32_t code, const char* name, int msb, int lsb);
|
||||
void declWide(uint32_t code, const char* name, int msb, int lsb);
|
||||
void declDouble(uint32_t code, const char* name);
|
||||
|
||||
// versions to call when the sig is array member
|
||||
void declEventArray(uint32_t code, const char* name, int arraynum);
|
||||
void declBitArray(uint32_t code, const char* name, int arraynum);
|
||||
void declBusArray(uint32_t code, const char* name, int arraynum, int msb, int lsb);
|
||||
void declQuadArray(uint32_t code, const char* name, int arraynum, int msb, int lsb);
|
||||
void declWideArray(uint32_t code, const char* name, int arraynum, int msb, int lsb);
|
||||
void declDoubleArray(uint32_t code, 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, 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
|
||||
// Declare specialization here as it's used in VerilatedFstC just below
|
||||
template <>
|
||||
|
|
|
|||
|
|
@ -627,21 +627,27 @@ class EmitCTrace final : public EmitCFunc {
|
|||
|
||||
void emitTraceInitOne(const AstTraceDecl* nodep, int enumNum) {
|
||||
if (nodep->dtypep()->basicp()->isDouble()) {
|
||||
puts("tracep->declDouble(");
|
||||
puts("VL_TRACE_DECL_DOUBLE");
|
||||
} else if (nodep->isWide()) {
|
||||
puts("tracep->declArray(");
|
||||
puts("VL_TRACE_DECL_WIDE");
|
||||
} else if (nodep->isQuad()) {
|
||||
puts("tracep->declQuad(");
|
||||
puts("VL_TRACE_DECL_QUAD");
|
||||
} else if (nodep->bitRange().ranged()) {
|
||||
puts("tracep->declBus(");
|
||||
puts("VL_TRACE_DECL_BUS");
|
||||
} else if (nodep->dtypep()->basicp()->isEvent()) {
|
||||
puts("tracep->declEvent(");
|
||||
puts("VL_TRACE_DECL_EVENT");
|
||||
} else {
|
||||
puts("tracep->declBit(");
|
||||
puts("VL_TRACE_DECL_BIT");
|
||||
}
|
||||
|
||||
if (nodep->arrayRange().ranged()) {
|
||||
puts("_ARRAY(tracep");
|
||||
} else {
|
||||
puts("(tracep");
|
||||
}
|
||||
|
||||
// Code
|
||||
puts("c+" + cvtToStr(nodep->code()));
|
||||
puts(",c+" + cvtToStr(nodep->code()));
|
||||
if (nodep->arrayRange().ranged()) puts("+i*" + cvtToStr(nodep->widthWords()));
|
||||
|
||||
// Function index
|
||||
|
|
@ -676,9 +682,7 @@ class EmitCTrace final : public EmitCFunc {
|
|||
|
||||
// Array range
|
||||
if (nodep->arrayRange().ranged()) {
|
||||
puts(", true,(i+" + cvtToStr(nodep->arrayRange().lo()) + ")");
|
||||
} else {
|
||||
puts(", false,-1");
|
||||
puts(", (i+" + cvtToStr(nodep->arrayRange().lo()) + ")");
|
||||
}
|
||||
|
||||
// Bit range
|
||||
|
|
|
|||
Loading…
Reference in New Issue