Support VPI parameter and localparam (#2370)

This commit is contained in:
Ludwig Rogiers
2020-06-12 18:38:01 -04:00
committed by GitHub
parent 35226d5e1a
commit c367b671b6
11 changed files with 871 additions and 515 deletions
+2 -2
View File
@@ -2603,7 +2603,7 @@ void VerilatedScope::exportInsert(int finalize, const char* namep, void* cb) VL_
}
}
void VerilatedScope::varInsert(int finalize, const char* namep, void* datap,
void VerilatedScope::varInsert(int finalize, const char* namep, void* datap, bool isParam,
VerilatedVarType vltype, int vlflags, int dims, ...) VL_MT_UNSAFE {
// Grab dimensions
// In the future we may just create a large table at emit time and
@@ -2611,7 +2611,7 @@ void VerilatedScope::varInsert(int finalize, const char* namep, void* datap,
if (!finalize) return;
if (!m_varsp) m_varsp = new VerilatedVarNameMap();
VerilatedVar var(namep, datap, vltype, static_cast<VerilatedVarFlags>(vlflags), dims);
VerilatedVar var(namep, datap, vltype, static_cast<VerilatedVarFlags>(vlflags), dims, isParam);
va_list ap;
va_start(ap, dims);
+2 -2
View File
@@ -335,8 +335,8 @@ public: // But internals only - called from VerilatedModule's
void configure(VerilatedSyms* symsp, const char* prefixp, const char* suffixp,
const char* identifier, vlsint8_t timeunit, const Type& type) VL_MT_UNSAFE;
void exportInsert(int finalize, const char* namep, void* cb) VL_MT_UNSAFE;
void varInsert(int finalize, const char* namep, void* datap, VerilatedVarType vltype,
int vlflags, int dims, ...) VL_MT_UNSAFE;
void varInsert(int finalize, const char* namep, void* datap, bool isParam,
VerilatedVarType vltype, int vlflags, int dims, ...) VL_MT_UNSAFE;
// ACCESSORS
const char* name() const { return m_namep; }
const char* identifier() const { return m_identifierp; }
+5 -2
View File
@@ -232,13 +232,15 @@ class VerilatedVar : public VerilatedVarProps {
void* m_datap; // Location of data
const char* m_namep; // Name - slowpath
protected:
bool m_isParam;
friend class VerilatedScope;
// CONSTRUCTORS
VerilatedVar(const char* namep, void* datap, VerilatedVarType vltype,
VerilatedVarFlags vlflags, int dims)
VerilatedVarFlags vlflags, int dims, bool isParam)
: VerilatedVarProps(vltype, vlflags, (dims > 0 ? 1 : 0), ((dims > 1) ? dims - 1 : 0))
, m_datap(datap)
, m_namep(namep) {}
, m_namep(namep)
, m_isParam(isParam) {}
public:
~VerilatedVar() {}
@@ -247,6 +249,7 @@ public:
const VerilatedRange& range() const { return packed(); } // Deprecated
const VerilatedRange& array() const { return unpacked(); } // Deprecated
const char* name() const { return m_namep; }
bool isParam() const { return m_isParam; }
};
#endif // Guard
+446 -492
View File
File diff suppressed because it is too large Load Diff