mirror of
https://github.com/TomHarte/CLK.git
synced 2025-08-08 14:25:05 +00:00
Fixes automatic flushing for non-1/1-clocked actors.
This commit is contained in:
@@ -103,9 +103,9 @@ template <class T, class LocalTimeScale = HalfCycles, int multiplier = 1, int di
|
|||||||
}
|
}
|
||||||
|
|
||||||
if constexpr (has_sequence_points<T>::value) {
|
if constexpr (has_sequence_points<T>::value) {
|
||||||
time_until_event_ -= rhs;
|
time_until_event_ -= rhs * multiplier;
|
||||||
if(time_until_event_ <= LocalTimeScale(0)) {
|
if(time_until_event_ <= LocalTimeScale(0)) {
|
||||||
time_overrun_ = time_until_event_;
|
time_overrun_ = time_until_event_ / divider;
|
||||||
flush();
|
flush();
|
||||||
update_sequence_point();
|
update_sequence_point();
|
||||||
return true;
|
return true;
|
||||||
@@ -185,7 +185,7 @@ template <class T, class LocalTimeScale = HalfCycles, int multiplier = 1, int di
|
|||||||
/// @returns the number of cycles until the next sequence-point-based flush, if the embedded object
|
/// @returns the number of cycles until the next sequence-point-based flush, if the embedded object
|
||||||
/// supports sequence points; @c LocalTimeScale() otherwise.
|
/// supports sequence points; @c LocalTimeScale() otherwise.
|
||||||
[[nodiscard]] LocalTimeScale cycles_until_implicit_flush() const {
|
[[nodiscard]] LocalTimeScale cycles_until_implicit_flush() const {
|
||||||
return time_until_event_;
|
return time_until_event_ / divider;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Indicates whether a sequence-point-caused flush will occur if the specified period is added.
|
/// Indicates whether a sequence-point-caused flush will occur if the specified period is added.
|
||||||
@@ -199,7 +199,7 @@ template <class T, class LocalTimeScale = HalfCycles, int multiplier = 1, int di
|
|||||||
/// Updates this template's record of the next sequence point.
|
/// Updates this template's record of the next sequence point.
|
||||||
void update_sequence_point() {
|
void update_sequence_point() {
|
||||||
if constexpr (has_sequence_points<T>::value) {
|
if constexpr (has_sequence_points<T>::value) {
|
||||||
time_until_event_ = object_.get_next_sequence_point();
|
time_until_event_ = object_.get_next_sequence_point() * divider;
|
||||||
assert(time_until_event_ > LocalTimeScale(0));
|
assert(time_until_event_ > LocalTimeScale(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user