Commit 8ca94138 by Marcus Winter

dataflow_cpp: missed some exceptions, fixed wrong asserts

parent 356f023c
...@@ -90,10 +90,7 @@ class Inputs<Slices, T1, embb::base::internal::Nil, embb::base::internal::Nil, ...@@ -90,10 +90,7 @@ class Inputs<Slices, T1, embb::base::internal::Nil, embb::base::internal::Nil,
} }
virtual void OnClock(int clock) { virtual void OnClock(int clock) {
const int idx = clock % Slices; const int idx = clock % Slices;
if (count_[idx] == 0) { assert(count_[idx] > 0);
EMBB_THROW(embb::base::ErrorException,
"All inputs already fired for this clock.");
}
if (--count_[idx] == 0) { if (--count_[idx] == 0) {
count_[idx] = 1; count_[idx] = 1;
listener_->OnClock(clock); listener_->OnClock(clock);
...@@ -143,7 +140,7 @@ class Inputs<Slices, T1, T2, embb::base::internal::Nil, ...@@ -143,7 +140,7 @@ class Inputs<Slices, T1, T2, embb::base::internal::Nil,
} }
virtual void OnClock(int clock) { virtual void OnClock(int clock) {
const int idx = clock % Slices; const int idx = clock % Slices;
assert(count_[idx] == 0); assert(count_[idx] > 0);
if (--count_[idx] == 0) { if (--count_[idx] == 0) {
count_[idx] = 2; count_[idx] = 2;
listener_->OnClock(clock); listener_->OnClock(clock);
...@@ -197,10 +194,7 @@ class Inputs<Slices, T1, T2, T3, embb::base::internal::Nil, ...@@ -197,10 +194,7 @@ class Inputs<Slices, T1, T2, T3, embb::base::internal::Nil,
} }
virtual void OnClock(int clock) { virtual void OnClock(int clock) {
const int idx = clock % Slices; const int idx = clock % Slices;
if (count_[idx] == 0) { assert(count_[idx] > 0);
EMBB_THROW(embb::base::ErrorException,
"All inputs already fired for this clock.");
}
if (--count_[idx] == 0) { if (--count_[idx] == 0) {
count_[idx] = 3; count_[idx] = 3;
listener_->OnClock(clock); listener_->OnClock(clock);
...@@ -257,7 +251,7 @@ class Inputs<Slices, T1, T2, T3, T4, embb::base::internal::Nil> ...@@ -257,7 +251,7 @@ class Inputs<Slices, T1, T2, T3, T4, embb::base::internal::Nil>
} }
virtual void OnClock(int clock) { virtual void OnClock(int clock) {
const int idx = clock % Slices; const int idx = clock % Slices;
assert(count_[idx] == 0); assert(count_[idx] > 0);
if (--count_[idx] == 0) { if (--count_[idx] == 0) {
count_[idx] = 4; count_[idx] = 4;
listener_->OnClock(clock); listener_->OnClock(clock);
...@@ -319,7 +313,7 @@ class Inputs ...@@ -319,7 +313,7 @@ class Inputs
} }
virtual void OnClock(int clock) { virtual void OnClock(int clock) {
const int idx = clock % Slices; const int idx = clock % Slices;
assert(count_[idx] == 0); assert(count_[idx] > 0);
if (--count_[idx] == 0) { if (--count_[idx] == 0) {
count_[idx] = 5; count_[idx] = 5;
listener_->OnClock(clock); listener_->OnClock(clock);
......
...@@ -842,9 +842,8 @@ class Network : public internal::ClockListener { ...@@ -842,9 +842,8 @@ class Network : public internal::ClockListener {
*/ */
virtual void OnClock(int clock) { virtual void OnClock(int clock) {
const int idx = clock % Slices; const int idx = clock % Slices;
const int cnt = --sink_counter_[idx]; assert(sink_counter_[idx] > 0);
assert(cnt == 0); --sink_counter_[idx];
EMBB_UNUSED_IN_RELEASE(cnt);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment