23 namespace DiscreteEvent {
    30 std::string toString(
const Event<T> & e) {
    32     s << 
"(" << e.time << 
"," << e.value << 
")";
    37 std::string toString(
const std::vector<
Event<T> > & es) {
    39     typename std::vector<Event<T> >::iterator i;
    43         s << 
"[" << toString<T>(es.front());
    45         for (; i != es.end(); ++i) {
    46             s << 
"," << toString<T>(*i);
    55     return toString<T>(signal.events);
    65 namespace DiscreteEvent {
    69     tuple(
const sc_core::sc_time & time, 
const O value) : time(time), value(value) {}
    71     sc_core::sc_time time;
    76 class Out1 : 
public sc_core::sc_module {
    78     sc_core::sc_out<O1> o1;
    80     Out1(
const sc_core::sc_module_name & name, 
const sc_core::sc_time & delay1) : sc_core::sc_module(name) , delay1(delay1) {
    81         SC_METHOD(delay1_method);
    87     void delayOutput(
const O1 & o1) {
    88         this->f1.push_back(
tuple<O1>(sc_core::sc_time_stamp() + this->delay1,o1));
    93     std::deque<tuple<O1> > f1;
    94     sc_core::sc_event action1;
    95     sc_core::sc_time delay1;
    99     void delay1_method() {
   101             o1 = f1.front().value;
   109             const sc_core::sc_time t1 = f1.front().time;
   110             this->action1.notify(t1 - sc_core::sc_time_stamp());
   115 template <
class O1,
class O2>
   116 class Out2 : 
public sc_core::sc_module {
   118     sc_core::sc_out<O1> o1;
   119     sc_core::sc_out<O2> o2;
   121     Out2(
const sc_core::sc_module_name & name, 
const sc_core::sc_time & delay1, 
const sc_core::sc_time & delay2) : sc_core::sc_module(name) , delay1(delay1) , delay2(delay2) {
   122         SC_METHOD(delay1_method);
   124         sensitive << action1;
   125         SC_METHOD(delay2_method);
   127         sensitive << action2;
   131     void delayOutput(
const O1 & o1, 
const O2 & o2) {
   132         this->f1.push_back(
tuple<O1>(sc_core::sc_time_stamp() + this->delay1,o1));
   134         this->f2.push_back(
tuple<O2>(sc_core::sc_time_stamp() + this->delay2,o2));
   139     std::deque<tuple<O1> > f1;
   140     std::deque<tuple<O2> > f2;
   141     sc_core::sc_event action1, action2;
   142     sc_core::sc_time delay1, delay2;
   144     SC_HAS_PROCESS(
Out2);
   146     void delay1_method() {
   148             o1 = f1.front().value;
   154     void delay2_method() {
   156             o2 = f2.front().value;
   164             const sc_core::sc_time t1 = f1.front().time;
   165             this->action1.notify(t1 - sc_core::sc_time_stamp());
   171             const sc_core::sc_time t2 = f2.front().time;
   172             this->action2.notify(t2 - sc_core::sc_time_stamp());
   177 template <
class O1,
class O2, 
class O3>
   178 class Out3 : 
public sc_core::sc_module {
   180     sc_core::sc_out<O1> o1;
   181     sc_core::sc_out<O2> o2;
   182     sc_core::sc_out<O3> o3;
   184     Out3(
const sc_core::sc_module_name & name, 
const sc_core::sc_time & delay1, 
const sc_core::sc_time & delay2, 
const sc_core::sc_time & delay3) : sc_core::sc_module(name) , delay1(delay1) , delay2(delay2) , delay3(delay3) {
   185         SC_METHOD(delay1_method);
   187         sensitive << action1;
   188         SC_METHOD(delay2_method);
   190         sensitive << action2;
   191         SC_METHOD(delay3_method);
   193         sensitive << action3;
   197     void delayOutput(
const O1 & o1, 
const O2 & o2, 
const O3 & o3) {
   198         this->f1.push_back(
tuple<O1>(sc_core::sc_time_stamp() + this->delay1,o1));
   200         this->f2.push_back(
tuple<O2>(sc_core::sc_time_stamp() + this->delay2,o2));
   202         this->f3.push_back(
tuple<O3>(sc_core::sc_time_stamp() + this->delay3,o3));
   207     std::deque<tuple<O1> > f1;
   208     std::deque<tuple<O2> > f2;
   209     std::deque<tuple<O3> > f3;
   210     sc_core::sc_event action1, action2, action3;
   211     sc_core::sc_time delay1, delay2, delay3;
   213     SC_HAS_PROCESS(
Out3);
   215     void delay1_method() {
   217             o1 = f1.front().value;
   223     void delay2_method() {
   225             o2 = f2.front().value;
   231     void delay3_method() {
   233             o3 = f3.front().value;
   241             const sc_core::sc_time t1 = f1.front().time;
   242             this->action1.notify(t1 - sc_core::sc_time_stamp());
   248             const sc_core::sc_time t2 = f2.front().time;
   249             this->action2.notify(t2 - sc_core::sc_time_stamp());
   255             const sc_core::sc_time t3 = f3.front().time;
   256             this->action3.notify(t3 - sc_core::sc_time_stamp());
   261 template <
class I1,
class O1>
   264     sc_core::sc_in<I1> i1;
   266     Map(
const sc_core::sc_module_name & name, 
const sc_core::sc_time & delay) : 
Out1<O1>::Out1(name,delay) {
   268         sc_core::sc_module::dont_initialize();
   269         sc_core::sc_module::sensitive << i1 << start;
   270         this->start.notify(SC_ZERO_TIME);
   274     sc_core::sc_event start;
   279         this->delayOutput(this->func(i1));
   282     virtual O1 func(
const I1) 
const = 0;
   285 template <
class I1,
class I2,
class O1>
   288     sc_core::sc_in<I1> i1;
   289     sc_core::sc_in<I2> i2;
   291     Zip(
const sc_core::sc_module_name & name, 
const sc_core::sc_time & delay) : 
Out1<O1>::Out1(name,delay) {
   293         sc_core::sc_module::dont_initialize();
   294         sc_core::sc_module::sensitive << i1 << i2 << start;
   295         this->start.notify(SC_ZERO_TIME);
   299     sc_core::sc_event start;
   304         this->delayOutput(this->func(i1,i2));
   307     virtual O1 func(
const I1, 
const I2) 
const = 0;
   310 template <
class I1,
class I2,
class I3,
class O1>
   313     sc_core::sc_in<I1> i1;
   314     sc_core::sc_in<I2> i2;
   315     sc_core::sc_in<I3> i3;
   317     Zip3(
const sc_core::sc_module_name & name, 
const sc_core::sc_time & delay) : 
Out1<O1>::Out1(name,delay) {
   319         sc_core::sc_module::dont_initialize();
   320         sc_core::sc_module::sensitive << i1 << i2 << i3 << start;
   321         this->start.notify(SC_ZERO_TIME);
   325     sc_core::sc_event start;
   327     SC_HAS_PROCESS(
Zip3);
   330         this->delayOutput(this->func(i1,i2,i3));
   333     virtual O1 func(
const I1, 
const I2, 
const I3) 
const = 0;
   336 template <
class I1,
class I2,
class I3,
class I4,
class O1>
   339     sc_core::sc_in<I1> i1;
   340     sc_core::sc_in<I2> i2;
   341     sc_core::sc_in<I3> i3;
   342     sc_core::sc_in<I4> i4;
   344     Zip4(
const sc_core::sc_module_name & name, 
const sc_core::sc_time & delay) : 
Out1<O1>::Out1(name,delay) {
   346         sc_core::sc_module::dont_initialize();
   347         sc_core::sc_module::sensitive << i1 << i2 << i3 << i4 << start;
   348         this->start.notify(SC_ZERO_TIME);
   352     sc_core::sc_event start;
   354     SC_HAS_PROCESS(
Zip4);
   357         this->delayOutput(this->func(i1,i2,i3,i4));
   360     virtual O1 func(
const I1, 
const I2, 
const I3, 
const I4) 
const = 0;
   365     sc_core::sc_in<T1> i1;
   369         sc_core::sc_module::dont_initialize();
   370         sc_core::sc_module::sensitive << i1 << start;
   371         this->start.notify(SC_ZERO_TIME);
   375     sc_core::sc_event start;
   381         this->delayOutput(tmp,tmp);
   387     sc_core::sc_in<T1> i1;
   391         sc_core::sc_module::dont_initialize();
   392         sc_core::sc_module::sensitive << i1 << start;
   393         this->start.notify(SC_ZERO_TIME);
   397     sc_core::sc_event start;
   403         this->delayOutput(tmp,tmp,tmp);
   415 namespace DiscreteEvent {
   420     Event() : time(sc_core::sc_time(0,SC_SEC)) , value() {};
   421     Event(
const sc_core::sc_time & time, 
const T & value) : time(time), value(value) {}
   423     sc_core::sc_time time;
   429     friend std::string toString<T>(
Signal<T> &);
   431     typedef std::vector<Event<T> > EventList_t;
   433     Signal() : events(), now(0,SC_SEC), last(), index(0) {}
   435     Signal(
const EventList_t & events) : events(events), now(0,SC_SEC), last(), index(0) {}
   437     void append(
const sc_core::sc_time & time, 
const T & value) {
   438         this->events.push_back(
Event<T>(time,value));
   442         if (this->index != this->events.size()) {
   443             Event<T> head = this->events[this->index];
   445             Event<T> result(head.time - now,head.value);
   454     bool has_next()
 const {
   455         return (this->index != this->events.size());
   459     sc_core::sc_time now;
   461     typename EventList_t::size_type index;
   470 namespace DiscreteEvent {
   473 class Driver : 
public sc_core::sc_module {
   475     sc_core::sc_out<T> out;
   486         while (this->signal.has_next()) {
   487             Event<T> event = this->signal.next();
 
Definition: democ.hpp:473
Definition: democ.hpp:386
Definition: democ.hpp:364
The namespace for ForSyDe. 
Definition: abssemantics.hpp:30
Definition: democ.hpp:286
CT2CT signal
The CT::signal is an alias for CT::CT2CT. 
Definition: ct_process.hpp:50
Definition: democ.hpp:178
Definition: democ.hpp:337
Definition: democ.hpp:116
Definition: democ.hpp:262
Definition: democ.hpp:311
A ForSyDe signal is used to inter-connect processes. 
Definition: abssemantics.hpp:70