Commit 6a0eb53f by Marcus Winter

dataflow_cpp: changed internal exceptions to asserts

parent 3891cb15
......@@ -57,9 +57,7 @@ class In {
Type GetValue(int clock) const {
SignalType const & signal = GetSignal(clock);
if (signal.IsBlank())
EMBB_THROW(embb::base::ErrorException,
"Signal is blank, cannot get a value.")
assert(!signal.IsBlank());
return signal.GetValue();
}
......@@ -86,9 +84,7 @@ class In {
void Receive(SignalType const & value) {
const int idx = value.GetClock() % Slices;
if (values_[idx].GetClock() >= value.GetClock())
EMBB_THROW(embb::base::ErrorException,
"Received signal does not increase clock.");
assert(values_[idx].GetClock() < value.GetClock());
values_[idx] = value;
listener_->OnClock(value.GetClock());
#if EMBB_DATAFLOW_TRACE_SIGNAL_HISTORY
......
......@@ -143,10 +143,7 @@ class Inputs<Slices, T1, T2, embb::base::internal::Nil,
}
virtual void OnClock(int clock) {
const int idx = clock % Slices;
if (count_[idx] == 0) {
EMBB_THROW(embb::base::ErrorException,
"All inputs already fired for this clock.");
}
assert(count_[idx] == 0);
if (--count_[idx] == 0) {
count_[idx] = 2;
listener_->OnClock(clock);
......@@ -260,10 +257,7 @@ class Inputs<Slices, T1, T2, T3, T4, embb::base::internal::Nil>
}
virtual void OnClock(int clock) {
const int idx = clock % Slices;
if (count_[idx] == 0) {
EMBB_THROW(embb::base::ErrorException,
"All inputs already fired for this clock.");
}
assert(count_[idx] == 0);
if (--count_[idx] == 0) {
count_[idx] = 4;
listener_->OnClock(clock);
......@@ -325,10 +319,7 @@ class Inputs
}
virtual void OnClock(int clock) {
const int idx = clock % Slices;
if (count_[idx] == 0) {
EMBB_THROW(embb::base::ErrorException,
"All inputs already fired for this clock.");
}
assert(count_[idx] == 0);
if (--count_[idx] == 0) {
count_[idx] = 5;
listener_->OnClock(clock);
......
......@@ -108,10 +108,7 @@ class Process< Slices, Serial, Inputs<Slices, I1, I2, I3, I4, I5>,
}
virtual void OnClock(int clock) {
if (!inputs_.AreAtClock(clock)) {
EMBB_THROW(embb::base::ErrorException,
"Some inputs are not at expected clock.")
}
assert(inputs_.AreAtClock(clock));
bool ordered = Serial;
if (ordered) {
......
......@@ -112,9 +112,7 @@ class Select
virtual void OnClock(int clock) {
//const int idx = clock % Slices;
if (!inputs_.AreAtClock(clock))
EMBB_THROW(embb::base::ErrorException,
"Some inputs are not at expected clock.")
assert(inputs_.AreAtClock(clock));
Run(clock);
}
......
......@@ -88,10 +88,8 @@ class Sink< Slices, Inputs<Slices, I1, I2, I3, I4, I5> >
}
virtual void OnClock(int clock) {
if (!inputs_.AreAtClock(clock)) {
EMBB_THROW(embb::base::ErrorException,
"Some inputs are not at expected clock.")
}
EMBB_UNUSED_IN_RELEASE(clock);
assert(inputs_.AreAtClock(clock));
bool retry = true;
while (retry) {
......
......@@ -110,9 +110,7 @@ class Switch
virtual void OnClock(int clock) {
//const int idx = clock % Slices;
if (!inputs_.AreAtClock(clock))
EMBB_THROW(embb::base::ErrorException,
"Some inputs are not at expected clock.")
assert(inputs_.AreAtClock(clock));
Run(clock);
}
......
......@@ -843,9 +843,7 @@ class Network : public internal::ClockListener {
virtual void OnClock(int clock) {
const int idx = clock % Slices;
const int cnt = --sink_counter_[idx];
if (cnt < 0)
EMBB_THROW(embb::base::ErrorException,
"More sinks than expected signaled reception of given clock.")
assert(cnt == 0);
}
/**
......
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