15 #ifndef DDE_PROCESS_CONSTRUCTORS_HPP 16 #define DDE_PROCESS_CONSTRUCTORS_HPP 29 #include <boost/numeric/ublas/matrix.hpp> 48 template <
typename T0,
typename T1>
56 typedef std::function<void(abst_ext<T0>&,
const T1&)>
functype;
65 ) :
dde_process(_name), iport1(
"iport1"), oport1(
"oport1"),
68 #ifdef FORSYDE_INTROSPECTION 69 std::string func_name = std::string(basename());
70 func_name = func_name.substr(0, func_name.find_last_not_of(
"0123456789")+1);
71 arg_vec.push_back(std::make_tuple(
"_func",func_name+std::string(
"_func")));
95 *iev1 = iport1.read();
100 if (is_present(get_value(*iev1)))
101 _func(*oval, unsafe_from_abst_ext(get_value(*iev1)));
109 WRITE_MULTIPORT(oport1, oev)
111 wait(get_time(oev) - sc_time_stamp());
120 #ifdef FORSYDE_INTROSPECTION 123 boundInChans.resize(1);
124 boundInChans[0].port = &iport1;
125 boundOutChans.resize(1);
126 boundOutChans[0].port = &oport1;
134 template <
typename T0,
typename T1,
typename T2>
152 ) :
dde_process(_name), iport1(
"iport1"), iport2(
"iport2"), oport1(
"oport1"),
155 #ifdef FORSYDE_INTROSPECTION 156 std::string func_name = std::string(basename());
157 func_name = func_name.substr(0, func_name.find_last_not_of(
"0123456789")+1);
158 arg_vec.push_back(std::make_tuple(
"_func",func_name+std::string(
"_func")));
169 abst_ext<T1> *cur_ival1;
187 cur_ival1 =
new abst_ext<T1>;
189 in1T = in2T = tl = SC_ZERO_TIME;
196 *next_iev1 = iport1.read();
197 in1T = get_time(*next_iev1);
201 *next_iev2 = iport2.read();
202 in2T = get_time(*next_iev2);
206 tl = std::min(in1T, in2T);
209 if (get_time(*next_iev1) == tl)
210 *cur_ival1 = get_value(*next_iev1);
212 *cur_ival1 = abst_ext<T1>();
213 if (get_time(*next_iev2) == tl)
214 *cur_ival2 = get_value(*next_iev2);
221 if (is_absent(*cur_ival1) && is_absent(*cur_ival2))
224 _func(*oval, *cur_ival1, *cur_ival2);
230 wait(tl - sc_time_stamp());
242 #ifdef FORSYDE_INTROSPECTION 245 boundInChans.resize(2);
246 boundInChans[0].port = &iport1;
247 boundInChans[1].port = &iport2;
248 boundOutChans.resize(1);
249 boundOutChans[0].port = &oport1;
278 ) :
dde_process(_name), iport1(
"iport1"), oport1(
"oport1"),
279 init_val(init_val), delay_time(delay_time)
281 #ifdef FORSYDE_INTROSPECTION 282 std::stringstream ss;
284 arg_vec.push_back(std::make_tuple(
"init_val", ss.str()));
287 arg_vec.push_back(std::make_tuple(
"delay_time", ss.str()));
307 WRITE_MULTIPORT(oport1, oev)
318 set_time(*ev, get_time(*ev)+delay_time);
323 WRITE_MULTIPORT(oport1, *ev)
324 wait(get_time(*ev) - sc_time_stamp());
331 #ifdef FORSYDE_INTROSPECTION 334 boundInChans.resize(1);
335 boundInChans[0].port = &iport1;
336 boundOutChans.resize(1);
337 boundOutChans[0].port = &oport1;
347 template <
typename IT,
typename ST,
typename OT>
355 typedef std::function<void(ST&, const ST&, const ttn_event<IT>&)>
ns_functype;
369 const sc_time& delay_time
370 ) :
dde_process(_name), _ns_func(_ns_func), _od_func(_od_func),
371 init_st(init_st), delay_time(delay_time)
373 #ifdef FORSYDE_INTROSPECTION 374 std::string func_name = std::string(basename());
375 func_name = func_name.substr(0, func_name.find_last_not_of(
"0123456789")+1);
376 arg_vec.push_back(std::make_tuple(
"_ns_func",func_name+std::string(
"_ns_func")));
377 arg_vec.push_back(std::make_tuple(
"_od_func",func_name+std::string(
"_od_func")));
378 std::stringstream ss;
380 arg_vec.push_back(std::make_tuple(
"init_st",ss.str()));
383 arg_vec.push_back(std::make_tuple(
"delay_time",ss.str()));
418 *itok = iport1.read();
423 _ns_func(*nsval, *stval, *itok);
424 _od_func(*oval, *stval, *itok);
430 WRITE_MULTIPORT(oport1,
ttn_event<OT>(*oval,get_time(*itok)+delay_time))
440 #ifdef FORSYDE_INTROSPECTION 443 boundInChans.resize(1);
444 boundInChans[0].port = &iport1;
445 boundOutChans.resize(1);
446 boundOutChans[0].port = &oport1;
456 template <
typename IT1,
typename IT2,
typename ST,
typename OT>
479 const sc_time& delay_time
480 ) :
dde_process(_name), _ns_func(_ns_func), _od_func(_od_func),
481 init_st(init_st), delay_time(delay_time)
483 #ifdef FORSYDE_INTROSPECTION 484 std::string func_name = std::string(basename());
485 func_name = func_name.substr(0, func_name.find_last_not_of(
"0123456789")+1);
486 arg_vec.push_back(std::make_tuple(
"_ns_func",func_name+std::string(
"_ns_func")));
487 arg_vec.push_back(std::make_tuple(
"_od_func",func_name+std::string(
"_od_func")));
488 std::stringstream ss;
490 arg_vec.push_back(std::make_tuple(
"init_st",ss.str()));
493 arg_vec.push_back(std::make_tuple(
"delay_time",ss.str()));
511 ttn_event<IT1> *next_iev1;
528 next_iev1 =
new ttn_event<IT1>;
536 in1T = in2T = tl = SC_ZERO_TIME;
543 *next_iev1 = iport1.read();
544 in1T = get_time(*next_iev1);
548 *next_iev2 = iport2.read();
549 in2T = get_time(*next_iev2);
553 tl = std::min(in1T, in2T);
556 if (get_time(*next_iev1) == tl)
557 *cur_ival1 = get_value(*next_iev1);
560 if (get_time(*next_iev2) == tl)
561 *cur_ival2 = get_value(*next_iev2);
568 if (is_absent(*cur_ival1) && is_absent(*cur_ival2))
572 _ns_func(*nsval, *stval, ttn_event<IT1>(*cur_ival1,tl),
ttn_event<IT2>(*cur_ival2,tl));
573 _od_func(*oval, *stval, ttn_event<IT1>(*cur_ival1,tl),
ttn_event<IT2>(*cur_ival2,tl));
581 wait(tl - sc_time_stamp());
594 #ifdef FORSYDE_INTROSPECTION 597 boundInChans.resize(2);
598 boundInChans[0].port = &iport1;
599 boundInChans[1].port = &iport2;
600 boundOutChans.resize(1);
601 boundOutChans[0].port = &oport1;
618 typedef matrix<T> MatrixDouble;
626 std::vector<T> numerators,
627 std::vector<T> denominators,
629 sc_time min_step=sc_time(0.05,SC_NS),
631 ) :
dde_process(_name), iport1(
"iport1"), oport1(
"oport1"),
632 numerators(numerators), denominators(denominators),
633 max_step(max_step), min_step(min_step), tol_error(tol_error)
635 #ifdef FORSYDE_INTROSPECTION 636 std::stringstream ss;
638 arg_vec.push_back(std::make_tuple(
"numerators", ss.str()));
641 arg_vec.push_back(std::make_tuple(
"denominators", ss.str()));
644 arg_vec.push_back(std::make_tuple(
"max_step", ss.str()));
647 arg_vec.push_back(std::make_tuple(
"min_step", ss.str()));
650 arg_vec.push_back(std::make_tuple(
"tol_error", ss.str()));
659 std::vector<T> numerators, denominators;
660 sc_time max_step, min_step;
665 sc_time samplingTimeTag;
666 MatrixDouble a, b, c, d;
668 MatrixDouble x, x0, x1, x2;
670 MatrixDouble u, u0, u1, u_1;
671 sc_time t, t_1, t2, h;
673 MatrixDouble y0, y1, y2;
675 MatrixDouble k1,k2,k3,k4;
677 double roundingFactor;
688 int nd = denominators.size();
689 a = MatrixDouble(nd-1,nd-1);
690 b = MatrixDouble(nd-1,1);
691 c = MatrixDouble(1,nd-1);
692 d = MatrixDouble(1,1);
694 tf2ss(numerators,denominators,a,b,c,d);
697 int numState = a.size1();
698 assert(a.size1() == a.size2());
699 samplingTimeTag = SC_ZERO_TIME;
700 x = zero_matrix<T>(numState,1);
701 u = MatrixDouble(1,1), u_1 = MatrixDouble(1,1);
702 u0 = u1 = MatrixDouble(1,1);
703 y1 = MatrixDouble(1,1);
704 k1 = MatrixDouble(numState,1);
705 k2 = MatrixDouble(numState,1);
706 k3 = MatrixDouble(numState,1);
707 k4 = MatrixDouble(numState,1);
712 auto in_ev = iport1.read();
713 u(0,0) = unsafe_from_abst_ext(get_value(in_ev));
716 y1 = boost::numeric::ublas::prod(c,x) + boost::numeric::ublas::prod(d,u);
718 WRITE_MULTIPORT(oport1, *out_ev)
724 roundingFactor = 1.0001;
729 auto in_ev = iport1.read();
730 u1(0,0) = unsafe_from_abst_ext(get_value(in_ev));
733 in_ev = iport1.read();
734 u0(0,0) = unsafe_from_abst_ext(get_value(in_ev));
735 t2 = get_time(in_ev);
742 rkSolver(a, b, c, d, u1, u_1, x, h.to_seconds(), x1, y1);
746 rkSolver(a, b, c, d, u0, u_1, x, h.to_seconds(), x0, y0);
749 rkSolver(a, b, c, d, u0, u1, x1, (h/2).to_seconds(), x2, y2);
752 double err_est = (double) std::abs(y2(0,0)-y0(0,0))/(h.to_seconds());
753 if( (err_est < tol_error) || (h<=roundingFactor*min_step)) {
759 WRITE_MULTIPORT(oport1, *out_ev)
764 std::cout <<
"Step accepted due to minimum step size. " 765 <<
"However, err_tol is not met." << std::endl;
782 int tf2ss(std::vector<T> & num_, std::vector<T> & den_, MatrixDouble & a,
783 MatrixDouble & b, MatrixDouble & c, MatrixDouble & d)
785 std::vector<T> num, den;
787 int nn = num_.size(), nd = den_.size();
790 std::cerr <<
"ERROR: " <<
"degree(num) = " << nn
791 <<
" >= degree(denom) = " << nd << std::endl;
794 T dCoef1 = den_.at(0);
798 d = MatrixDouble(1,1);
799 d(0,0) = num_.at(0)/dCoef1;
806 for(
int i=0; i<nd; i++)
811 num.push_back(num_.at(i-nd+nn));
816 for(
unsigned int i=0; i<num.size(); i++)
818 for(
unsigned int i=0; i<den_.size(); i++)
819 den_.at(i) /= dCoef1;
820 for(
unsigned int i=0; i<(den_.size()-1); i++)
821 den.push_back(den_.at(i+1));
824 a = zero_matrix<T> (a.size1(), a.size2());
828 for(
int i=0; i<(nd-2); i++)
829 for(
int j=0; j<(nd-1); j++)
830 if((j-i)==1) a(i,j) = 1.0;
832 for(
int j=0; j<(nd-1); j++)
833 a(nd-2,j) = 0-den.at(nd-2-j);
836 a(0,0) = 0-den.at(0);
839 b = zero_matrix<T> (b.size1(), b.size2());
843 for(
int j=0; j< nd-1; j++)
844 c(0,nd-2-j) = num.at(j+1) - num.at(0)*den.at(j);
853 void rkSolver(MatrixDouble a, MatrixDouble b, MatrixDouble c,
854 MatrixDouble d, MatrixDouble u_k, MatrixDouble u_k_1,
855 MatrixDouble x, T h, MatrixDouble &x_, MatrixDouble &y)
858 MatrixDouble k1,k2,k3,k4;
859 k1 = boost::numeric::ublas::prod(a,x) + boost::numeric::ublas::prod(b,u_k_1);
860 k2 = boost::numeric::ublas::prod(a,(x+k1*(h/2.0))) + boost::numeric::ublas::prod(b,(u_k_1 + u_k)) * 0.5;
861 k3 = boost::numeric::ublas::prod(a,(x+k2*(h/2.0))) + boost::numeric::ublas::prod(b,(u_k_1 + u_k)) * 0.5;
862 k4 = boost::numeric::ublas::prod(a,(x+k3*h)) + boost::numeric::ublas::prod(b,u_k);
863 x_ = x + (k1 + 2.0*k2 + 2.0*k3 + k4) * (h/6.0);
864 y = boost::numeric::ublas::prod(c,x_) + boost::numeric::ublas::prod(d,u_k);
867 #ifdef FORSYDE_INTROSPECTION 870 boundInChans.resize(1);
871 boundInChans[0].port = &iport1;
872 boundOutChans.resize(2);
873 boundOutChans[0].port = &oport1;
874 boundOutChans[1].port = &oport2;
890 typedef matrix<T> MatrixDouble;
898 std::vector<T> numerators,
899 std::vector<T> denominators
900 ) :
dde_process(_name), iport1(
"iport1"), oport1(
"oport1"),
901 numerators(numerators), denominators(denominators)
903 #ifdef FORSYDE_INTROSPECTION 904 std::stringstream ss;
906 arg_vec.push_back(std::make_tuple(
"numerators", ss.str()));
909 arg_vec.push_back(std::make_tuple(
"denominators", ss.str()));
918 std::vector<T> numerators, denominators;
921 MatrixDouble a, b, c, d;
930 MatrixDouble k1,k2,k3,k4;
940 int nd = denominators.size();
941 a = MatrixDouble(nd-1,nd-1);
942 b = MatrixDouble(nd-1,1);
943 c = MatrixDouble(1,nd-1);
944 d = MatrixDouble(1,1);
946 tf2ss(numerators,denominators,a,b,c,d);
949 int numState = a.size1();
950 assert(a.size1() == a.size2());
951 x = zero_matrix<T>(numState,1), x_1 = zero_matrix<T>(numState,1);
952 u = MatrixDouble(1,1), u_1 = MatrixDouble(1,1);
953 y = MatrixDouble(1,1);
954 k1 = MatrixDouble(numState,1);
955 k2 = MatrixDouble(numState,1);
956 k3 = MatrixDouble(numState,1);
957 k4 = MatrixDouble(numState,1);
960 auto in_ev = iport1.read();
961 u(0,0) = unsafe_from_abst_ext(get_value(in_ev));
964 y = boost::numeric::ublas::prod(c,x) + boost::numeric::ublas::prod(d,u);
966 WRITE_MULTIPORT(oport1, *out_ev)
967 wait(t - sc_time_stamp());
974 auto in_ev = iport1.read();
975 u(0,0) = unsafe_from_abst_ext(get_value(in_ev));
983 rkSolver(a, b, c, d, u, u_1, x_1, h.to_seconds(), x, y);
989 WRITE_MULTIPORT(oport1, *out_ev)
990 wait(t - sc_time_stamp());
1003 int tf2ss(std::vector<T> & num_, std::vector<T> & den_, MatrixDouble & a,
1004 MatrixDouble & b, MatrixDouble & c, MatrixDouble & d)
1006 std::vector<T> num, den;
1008 int nn = num_.size(), nd = den_.size();
1011 std::cerr <<
"ERROR: " <<
"degree(num) = " << nn
1012 <<
" >= degree(denom) = " << nd << std::endl;
1015 T dCoef1 = den_.at(0);
1019 d = MatrixDouble(1,1);
1020 d(0,0) = num_.at(0)/dCoef1;
1027 for(
int i=0; i<nd; i++)
1032 num.push_back(num_.at(i-nd+nn));
1037 for(
unsigned int i=0; i<num.size(); i++)
1038 num.at(i) /= dCoef1;
1039 for(
unsigned int i=0; i<den_.size(); i++)
1040 den_.at(i) /= dCoef1;
1041 for(
unsigned int i=0; i<(den_.size()-1); i++)
1042 den.push_back(den_.at(i+1));
1045 a = zero_matrix<T> (a.size1(), a.size2());
1049 for(
int i=0; i<(nd-2); i++)
1050 for(
int j=0; j<(nd-1); j++)
1051 if((j-i)==1) a(i,j) = 1.0;
1053 for(
int j=0; j<(nd-1); j++)
1054 a(nd-2,j) = 0-den.at(nd-2-j);
1057 a(0,0) = 0-den.at(0);
1060 b = zero_matrix<T> (b.size1(), b.size2());
1064 for(
int j=0; j< nd-1; j++)
1065 c(0,nd-2-j) = num.at(j+1) - num.at(0)*den.at(j);
1074 void rkSolver(MatrixDouble a, MatrixDouble b, MatrixDouble c,
1075 MatrixDouble d, MatrixDouble u_k, MatrixDouble u_k_1,
1076 MatrixDouble x, T h, MatrixDouble &x_, MatrixDouble &y)
1079 MatrixDouble k1,k2,k3,k4;
1080 k1 = boost::numeric::ublas::prod(a,x) + boost::numeric::ublas::prod(b,u_k_1);
1081 k2 = boost::numeric::ublas::prod(a,(x+k1*(h/2.0))) + boost::numeric::ublas::prod(b,(u_k_1 + u_k)) * 0.5;
1082 k3 = boost::numeric::ublas::prod(a,(x+k2*(h/2.0))) + boost::numeric::ublas::prod(b,(u_k_1 + u_k)) * 0.5;
1083 k4 = boost::numeric::ublas::prod(a,(x+k3*h)) + boost::numeric::ublas::prod(b,u_k);
1084 x_ = x + (k1 + 2.0*k2 + 2.0*k3 + k4) * (h/6.0);
1085 y = boost::numeric::ublas::prod(c,x_) + boost::numeric::ublas::prod(d,u_k);
1088 #ifdef FORSYDE_INTROSPECTION 1091 boundInChans.resize(1);
1092 boundInChans[0].port = &iport1;
1093 boundOutChans.resize(1);
1094 boundOutChans[0].port = &oport1;
1121 unsigned long long take=0
1123 init_st(init_st), take(take), _func(_func)
1125 #ifdef FORSYDE_INTROSPECTION 1126 std::string func_name = std::string(basename());
1127 func_name = func_name.substr(0, func_name.find_last_not_of(
"0123456789")+1);
1128 arg_vec.push_back(std::make_tuple(
"_func",func_name+std::string(
"_func")));
1129 std::stringstream ss;
1131 arg_vec.push_back(std::make_tuple(
"init_st", ss.str()));
1134 arg_vec.push_back(std::make_tuple(
"take", ss.str()));
1143 unsigned long long take;
1146 unsigned long long tok_cnt;
1157 WRITE_MULTIPORT(oport1, *cur_st)
1158 wait(get_time(*cur_st) - sc_time_stamp());
1159 if (take==0) infinite =
true;
1167 _func(*cur_st, *cur_st);
1172 if (tok_cnt++ < take || infinite)
1174 WRITE_MULTIPORT(oport1, *cur_st)
1175 wait(get_time(*cur_st) - sc_time_stamp());
1185 #ifdef FORSYDE_INTROSPECTION 1188 boundOutChans.resize(1);
1189 boundOutChans[0].port = &oport1;
1190 boundOutChans[0].portType =
typeid(T).name();
1211 const std::vector<T>& values,
1212 const std::vector<sc_time>& offsets
1214 values(values), offsets(offsets)
1216 if (values.size()<offsets.size())
1217 SC_REPORT_ERROR(name(),
"Error matching values and offsets vectors!");
1218 #ifdef FORSYDE_INTROSPECTION 1219 std::stringstream ss;
1221 arg_vec.push_back(std::make_tuple(
"values", ss.str()));
1224 arg_vec.push_back(std::make_tuple(
"offsets", ss.str()));
1231 std::vector<T> values;
1232 std::vector<sc_time> offsets;
1248 wait(offsets[iter] - sc_time_stamp());
1250 if (iter == values.size())
1260 #ifdef FORSYDE_INTROSPECTION 1263 boundOutChans.resize(1);
1264 boundOutChans[0].port = &oport1;
1265 boundOutChans[0].portType =
typeid(T).name();
1282 typedef std::function<void(const ttn_event<T>&)>
functype;
1290 ) :
dde_process(_name), iport1(
"iport1"), _func(_func)
1293 #ifdef FORSYDE_INTROSPECTION 1294 std::string func_name = std::string(basename());
1295 func_name = func_name.substr(0, func_name.find_last_not_of(
"0123456789")+1);
1296 arg_vec.push_back(std::make_tuple(
"_func",func_name+std::string(
"_func")));
1317 *val = iport1.read();
1332 #ifdef FORSYDE_INTROSPECTION 1335 boundInChans.resize(1);
1336 boundInChans[0].port = &iport1;
1344 template <
class T1,
class T2>
1357 :
dde_process(_name), iport1(
"iport1"), iport2(
"iport2"), oport1(
"oport1")
1383 in1T = in2T = tl = SC_ZERO_TIME;
1391 *next_iev1 = iport1.read();
1392 in1T = get_time(*next_iev1);
1396 *next_iev2 = iport2.read();
1397 in2T = get_time(*next_iev2);
1401 tl = std::min(in1T, in2T);
1404 if (get_time(*next_iev1) == tl)
1405 *cur_ival1 = get_value(*next_iev1);
1408 if (get_time(*next_iev2) == tl)
1409 *cur_ival2 = get_value(*next_iev2);
1416 if (is_absent(*cur_ival1) && is_absent(*cur_ival2))
1420 std::make_tuple(*cur_ival1,*cur_ival2)
1427 WRITE_MULTIPORT(oport1,temp_event)
1428 wait(tl - sc_time_stamp());
1440 #ifdef FORSYDE_INTROSPECTION 1443 boundInChans.resize(2);
1444 boundInChans[0].port = &iport1;
1445 boundInChans[0].portType =
typeid(T1).name();
1446 boundInChans[1].port = &iport2;
1447 boundInChans[1].portType =
typeid(T2).name();
1448 boundOutChans.resize(1);
1449 boundOutChans[0].port = &oport1;
1450 boundOutChans[0].portType =
typeid(std::tuple<T1,T2>).name();
1459 template <
class T1, std::
size_t N>
1479 std::array<ttn_event<T1>,N> next_ievs;
1480 std::array<abst_ext<T1>,N> cur_ivals;
1487 std::array<sc_time,N> insT;
1491 insT.fill(SC_ZERO_TIME);
1498 for (
size_t i=0;i<N;i++)
1501 next_ievs[i] = iport[i].read();
1502 insT[i] = get_time(next_ievs[i]);
1506 tl = *std::min_element(insT.begin(), insT.end());
1509 for (
size_t i=0;i<N;i++)
1510 if (get_time(next_ievs[i]) == tl)
1511 cur_ivals[i] = get_value(next_ievs[i]);
1518 if (std::all_of(cur_ivals.begin(), cur_ivals.end(), [](
abst_ext<T1> el){
1519 return is_absent(el);
1529 WRITE_MULTIPORT(oport1,temp_event)
1530 wait(tl - sc_time_stamp());
1538 #ifdef FORSYDE_INTROSPECTION 1541 boundInChans.resize(N);
1542 for (
size_t i=0;i<N;i++)
1543 boundInChans[i].port = &iport[i];
1544 boundOutChans.resize(1);
1545 boundOutChans[0].port = &oport1;
1553 template <
class T1,
class T2>
1566 :
dde_process(_name), iport1(
"iport1"), oport1(
"oport1"), oport2(
"oport2")
1581 out_val2 =
new abst_ext<T2>;
1586 *in_ev = iport1.read();
1591 if (is_absent(get_value(*in_ev)))
1598 *out_val1 = std::get<0>(unsafe_from_abst_ext(get_value(*in_ev)));
1599 *out_val2 = std::get<1>(unsafe_from_abst_ext(get_value(*in_ev)));
1605 sc_time te(get_time(*in_ev));
1617 #ifdef FORSYDE_INTROSPECTION 1620 boundInChans.resize(1);
1621 boundInChans[0].port = &iport1;
1622 boundInChans[0].portType =
typeid(std::tuple<T1,T2>).name();
1623 boundOutChans.resize(2);
1624 boundOutChans[0].port = &oport1;
1625 boundOutChans[0].portType =
typeid(T1).name();
1626 boundOutChans[1].port = &oport2;
1627 boundOutChans[1].portType =
typeid(T2).name();
1636 template <
class T1, std::
size_t N>
1659 std::array<ttn_event<T1>,N> oevs;
1671 *in_ev = iport1.read();
1676 if (is_absent(*in_ev))
1678 for (
size_t i=0; i<N; i++)
1683 for (
size_t i=0; i<N; i++)
1686 tl = get_time(*in_ev);
1691 for (
size_t i=0; i<N; i++)
1692 WRITE_MULTIPORT(oport[i],oevs[i])
1693 wait(tl - sc_time_stamp());
1701 #ifdef FORSYDE_INTROSPECTION 1704 boundInChans.resize(1);
1705 boundInChans[0].port = &iport1;
1706 boundOutChans.resize(N);
1707 for (
size_t i=0;i<N;i++)
1708 boundOutChans[i].port = &oport[i];
1753 *val = iport1.read();
1760 WRITE_MULTIPORT(oport1, *val)
1767 #ifdef FORSYDE_INTROSPECTION 1770 boundInChans.resize(1);
1771 boundInChans[0].port = &iport1;
1772 boundInChans[0].portType =
typeid(T).name();
1773 boundOutChans.resize(1);
1774 boundOutChans[0].port = &oport1;
1775 boundOutChans[0].portType =
typeid(T).name();
std::function< void(ST &, const ST &, const ttn_event< IT > &)> ns_functype
Type of the next-state function to be passed to the process constructor.
Definition: dde_process_constructors.hpp:355
delay(sc_module_name _name, abst_ext< T > init_val, sc_time delay_time)
The constructor requires the module name.
Definition: dde_process_constructors.hpp:275
Process constructor for a combinational process with two inputs and one output.
Definition: dde_process_constructors.hpp:135
Time-tagged data types.
Definition: tt_event.hpp:32
DDE_in< IT1 > iport1
port for the input channel
Definition: dde_process_constructors.hpp:460
DDE_out< OT > oport1
port for the output channel
Definition: dde_process_constructors.hpp:352
DDE_out< T0 > oport1
port for the output channel
Definition: dde_process_constructors.hpp:53
filterf(sc_module_name _name, std::vector< T > numerators, std::vector< T > denominators)
The constructor requires the module name.
Definition: dde_process_constructors.hpp:897
std::array< DDE_in< T1 >, N > iport
port array for the input channels
Definition: dde_process_constructors.hpp:1463
Process constructor for a delay element.
Definition: dde_process_constructors.hpp:264
std::function< void(ttn_event< T > &, const ttn_event< T > &)> functype
Type of the function to be passed to the process constructor.
Definition: dde_process_constructors.hpp:1112
DDE_in< T > iport1
port for the input channel
Definition: dde_process_constructors.hpp:887
std::function< void(abst_ext< OT > &, const ST &, const ttn_event< IT1 > &, const ttn_event< IT2 > &)> od_functype
Type of the output-decoding function to be passed to the process constructor.
Definition: dde_process_constructors.hpp:468
The namespace for ForSyDe.
Definition: abssemantics.hpp:30
DDE_in< std::array< abst_ext< T1 >, N > > iport1
port for the input channel
Definition: dde_process_constructors.hpp:1640
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: dde_process_constructors.hpp:1301
fanout(sc_module_name _name)
The constructor requires the module name.
Definition: dde_process_constructors.hpp:1735
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: dde_process_constructors.hpp:292
The zip process with two inputs and one output.
Definition: dde_process_constructors.hpp:1345
DDE_in< std::tuple< abst_ext< T1 >, abst_ext< T2 > > > iport1
port for the input channel
Definition: dde_process_constructors.hpp:1557
DDE_in< T > iport1
port for the input channel
Definition: dde_process_constructors.hpp:614
DDE_out< T > oport1
port for the output channel
Definition: dde_process_constructors.hpp:888
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: dde_process_constructors.hpp:1229
zip(sc_module_name _name)
The constructor requires the module name.
Definition: dde_process_constructors.hpp:1356
DDE_out< OT > oport1
port for the output channel
Definition: dde_process_constructors.hpp:462
DDE_in< T > iport1
port for the input channel
Definition: dde_process_constructors.hpp:1279
DDE_out< std::tuple< abst_ext< T1 >, abst_ext< T2 > > > oport1
port for the output channel
Definition: dde_process_constructors.hpp:1350
mealy2(const sc_module_name &_name, const ns_functype &_ns_func, const od_functype &_od_func, const ST &init_st, const sc_time &delay_time)
The constructor requires the module name.
Definition: dde_process_constructors.hpp:475
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: dde_process_constructors.hpp:1652
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: dde_process_constructors.hpp:388
std::function< void(abst_ext< T0 > &, const abst_ext< T1 > &, const abst_ext< T2 > &)> functype
Type of the function to be passed to the process constructor.
Definition: dde_process_constructors.hpp:143
DDE_in< T2 > iport2
port for the input channel 2
Definition: dde_process_constructors.hpp:139
The unzipX process with a vector of outputs and one input.
Definition: dde_process_constructors.hpp:1637
DDE_out< T > oport1
port for the output channel
Definition: dde_process_constructors.hpp:268
Process constructor for implementing a linear filter with fixed step size.
Definition: dde_process_constructors.hpp:884
filter(sc_module_name _name, std::vector< T > numerators, std::vector< T > denominators, sc_time max_step, sc_time min_step=sc_time(0.05, SC_NS), T tol_error=1e-5)
The constructor requires the module name.
Definition: dde_process_constructors.hpp:625
The zipX process with a vector of inputs and one output.
Definition: dde_process_constructors.hpp:1460
vsource(sc_module_name _name, const std::vector< T > &values, const std::vector< sc_time > &offsets)
The constructor requires the module name.
Definition: dde_process_constructors.hpp:1210
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: dde_process_constructors.hpp:1739
zipX(sc_module_name _name)
The constructor requires the module name.
Definition: dde_process_constructors.hpp:1470
DDE_out< T > oport1
port for the output channel
Definition: dde_process_constructors.hpp:1204
The unzip process with one input and two outputs.
Definition: dde_process_constructors.hpp:1554
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: dde_process_constructors.hpp:1139
mealy(const sc_module_name &_name, const ns_functype &_ns_func, const od_functype &_od_func, const ST &init_st, const sc_time &delay_time)
The constructor requires the module name.
Definition: dde_process_constructors.hpp:365
unzip(sc_module_name _name)
The constructor requires the module name.
Definition: dde_process_constructors.hpp:1565
DDE_out< T > oport1
port for the output channel
Definition: dde_process_constructors.hpp:1729
sink(sc_module_name _name, functype _func)
The constructor requires the module name.
Definition: dde_process_constructors.hpp:1288
std::function< void(const ttn_event< T > &)> functype
Type of the function to be passed to the process constructor.
Definition: dde_process_constructors.hpp:1282
comb2(sc_module_name _name, functype _func)
The constructor requires the module name.
Definition: dde_process_constructors.hpp:150
The process constructor which defines the abstract semantics of execution.
Definition: abssemantics.hpp:212
DDE_in< T > iport1
port for the input channel
Definition: dde_process_constructors.hpp:267
source(sc_module_name _name, functype _func, ttn_event< T > init_st, unsigned long long take=0)
The constructor requires the module name.
Definition: dde_process_constructors.hpp:1118
std::function< void(ST &, const ST &, const ttn_event< IT1 > &, const ttn_event< IT2 > &)> ns_functype
Type of the next-state function to be passed to the process constructor.
Definition: dde_process_constructors.hpp:465
DDE_in< T1 > iport1
port for the input channel 1
Definition: dde_process_constructors.hpp:1348
DDE_in< T > iport1
port for the input channel
Definition: dde_process_constructors.hpp:1728
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: dde_process_constructors.hpp:1361
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: dde_process_constructors.hpp:1570
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: dde_process_constructors.hpp:76
Process constructor for a source process.
Definition: dde_process_constructors.hpp:1106
DDE_in< T2 > iport2
port for the input channel 2
Definition: dde_process_constructors.hpp:1349
DDE_out< T > oport1
port for the output channel
Definition: dde_process_constructors.hpp:615
Process constructor for a Mealy machine with two inputs.
Definition: dde_process_constructors.hpp:457
Process constructor for a sink process.
Definition: dde_process_constructors.hpp:1276
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: dde_process_constructors.hpp:498
Process constructor for a source process with vector input.
Definition: dde_process_constructors.hpp:1201
std::function< void(abst_ext< T0 > &, const T1 &)> functype
Type of the function to be passed to the process constructor.
Definition: dde_process_constructors.hpp:56
std::function< void(abst_ext< OT > &, const ST &, const ttn_event< IT > &)> od_functype
Type of the output-decoding function to be passed to the process constructor.
Definition: dde_process_constructors.hpp:358
DDE_out< T2 > oport2
port for the output channel 2
Definition: dde_process_constructors.hpp:1559
DDE_out< T > oport1
port for the output channel
Definition: dde_process_constructors.hpp:1109
Process constructor for a fan-out process with one input and one output.
Definition: dde_process_constructors.hpp:1725
Implements the abstract process in the DDE Model of Computation.
Implements the time-tagged events.
Process constructor for a Mealy machine.
Definition: dde_process_constructors.hpp:348
unzipX(sc_module_name _name)
The constructor requires the module name.
Definition: dde_process_constructors.hpp:1647
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: dde_process_constructors.hpp:655
DDE_out< std::array< abst_ext< T1 >, N > > oport1
port for the output channel
Definition: dde_process_constructors.hpp:1464
DDE_out< T0 > oport1
port for the output channel
Definition: dde_process_constructors.hpp:140
DDE_in< T1 > iport1
port for the input channel 1
Definition: dde_process_constructors.hpp:138
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: dde_process_constructors.hpp:914
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: dde_process_constructors.hpp:163
comb(sc_module_name _name, functype _func)
The constructor requires the module name.
Definition: dde_process_constructors.hpp:63
DDE_in< IT > iport1
port for the input channel
Definition: dde_process_constructors.hpp:351
void set_abst()
Sets absent.
Definition: abst_ext.hpp:63
DDE_in< T1 > iport1
port for the input channel
Definition: dde_process_constructors.hpp:52
DDE_in< IT2 > iport2
port for the input channel
Definition: dde_process_constructors.hpp:461
DDE_out< T1 > oport1
port for the output channel 1
Definition: dde_process_constructors.hpp:1558
std::array< DDE_out< T1 >, N > oport
port array for the output channels
Definition: dde_process_constructors.hpp:1641
Process constructor for a combinational process with one input and one output.
Definition: dde_process_constructors.hpp:49
DDE_out< unsigned int > oport2
port for the sampling signal
Definition: dde_process_constructors.hpp:616
Process constructor for implementing a linear filter.
Definition: dde_process_constructors.hpp:611
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: dde_process_constructors.hpp:1475