Commit 6a0eb53f by Marcus Winter

dataflow_cpp: changed internal exceptions to asserts

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