Expose VPI cbNextDeadline via the public API (#2212)

Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
This commit is contained in:
Matthew Ballance 2020-03-28 13:47:21 -04:00 committed by GitHub
parent 4145a38c47
commit 510be53521
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 0 deletions

View File

@ -566,6 +566,10 @@ bool VerilatedVpi::callCbs(vluint32_t reason) VL_MT_UNSAFE_ONE {
return VerilatedVpiImp::callCbs(reason);
}
QData VerilatedVpi::cbNextDeadline() VL_MT_UNSAFE_ONE {
return VerilatedVpiImp::cbNextDeadline();
}
//======================================================================
// VerilatedVpiImp implementation

View File

@ -44,6 +44,9 @@ public:
/// Call callbacks of arbitrary types
/// Users can call this from their application code
static bool callCbs(vluint32_t reason) VL_MT_UNSAFE_ONE;
/// Returns time of the next registered VPI callback, or
/// ~(0) if none are registered
static QData cbNextDeadline() VL_MT_UNSAFE_ONE;
/// Self test, for internal use only
static void selfTest() VL_MT_UNSAFE_ONE;
};

View File

@ -235,6 +235,7 @@ int main(int argc, char** argv, char** env) {
topp->eval();
VerilatedVpi::callValueCbs();
VerilatedVpi::callTimedCbs();
CHECK_RESULT(VerilatedVpi::cbNextDeadline(), main_time+1);
topp->clk = !topp->clk;
// mon_do();
#if VM_TRACE