Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion systemc-components/common/include/qkmulti-quantum.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@ class tlm_quantumkeeper_multi_quantum : public tlm_quantumkeeper_multithread
sc_core::sc_time quantum = tlm_utils::tlm_quantumkeeper::get_global_quantum();
sc_core::sc_time next_quantum_boundary = sc_core::sc_time_stamp() + quantum;
sc_core::sc_time now = get_current_time();
if (next_quantum_boundary >= now) {
if (now < next_quantum_boundary) {
return next_quantum_boundary - now;
} else if (now == next_quantum_boundary) {
// At the exact boundary: the CPU has used its quantum but hasn't
// exceeded it. Return a minimal non-zero value so sync() doesn't
// block. The timehandler will advance the kernel on the next delta
// cycle; blocking here risks a deadlock when sc_suspend_all()
// prevents next_time() from seeing the scheduled tick event.
return sc_core::sc_time(1, sc_core::SC_PS);
} else {
return sc_core::SC_ZERO_TIME;
}
Expand Down
Loading