sdf_process_constructors.hpp
Go to the documentation of this file.
1 /**********************************************************************
2  * sdf_process_constructors.hpp -- Process constructors in the SDF *
3  * MOC *
4  * *
5  * Author: Hosein Attarzadeh (shan2@kth.se) *
6  * *
7  * Purpose: Providing basic process constructors for modeling *
8  * SDF systems in ForSyDe-SystemC *
9  * *
10  * Usage: This file is included automatically *
11  * *
12  * License: BSD3 *
13  *******************************************************************/
14 
15 #ifndef SDF_PROCESS_CONSTRUCTORS_HPP
16 #define SDF_PROCESS_CONSTRUCTORS_HPP
17 
25 #include <functional>
26 #include <tuple>
27 #include <vector>
28 
29 #include "sdf_process.hpp"
30 
31 namespace ForSyDe
32 {
33 
34 namespace SDF
35 {
36 
37 using namespace sc_core;
38 
40 
44 template <typename T0, typename T1>
45 class comb : public sdf_process
46 {
47 public:
50 
52  typedef std::function<void(std::vector<T0>&,
53  const std::vector<T1>&
55 
57 
61  comb(sc_module_name _name,
62  functype _func,
63  unsigned int o1toks,
64  unsigned int i1toks
65  ) : sdf_process(_name), iport1("iport1"), oport1("oport1"),
66  o1toks(o1toks), i1toks(i1toks), _func(_func)
67  {
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")));
72  arg_vec.push_back(std::make_tuple("o1toks",std::to_string(o1toks)));
73  arg_vec.push_back(std::make_tuple("i1toks",std::to_string(i1toks)));
74 #endif
75  }
76 
78  std::string forsyde_kind() const {return "SDF::comb";}
79 
80 private:
81  // consumption rates
82  unsigned int o1toks, i1toks;
83 
84  // Inputs and output variables
85  std::vector<T0> o1vals;
86  std::vector<T1> i1vals;
87 
89  functype _func;
90 
91  //Implementing the abstract semantics
92  void init()
93  {
94  o1vals.resize(o1toks);
95  i1vals.resize(i1toks);
96  }
97 
98  void prep()
99  {
100  for (auto it=i1vals.begin();it!=i1vals.end();it++)
101  *it = iport1.read();
102  }
103 
104  void exec()
105  {
106  _func(o1vals, i1vals);
107  }
108 
109  void prod()
110  {
111  WRITE_VEC_MULTIPORT(oport1, o1vals)
112  }
113 
114  void clean() {}
115 
116 #ifdef FORSYDE_INTROSPECTION
117  void bindInfo()
118  {
119  boundInChans.resize(1); // only one input port
120  boundInChans[0].port = &iport1;
121  boundOutChans.resize(1); // only one output port
122  boundOutChans[0].port = &oport1;
123  }
124 #endif
125 };
126 
128 
130 template <typename T0, typename T1, typename T2>
131 class comb2 : public sdf_process
132 {
133 public:
137 
139  typedef std::function<void(std::vector<T0>&,
140  const std::vector<T1>&,
141  const std::vector<T2>&
143 
145 
149  comb2(sc_module_name _name,
150  functype _func,
151  unsigned int o1toks,
152  unsigned int i1toks,
153  unsigned int i2toks
154  ) : sdf_process(_name), iport1("iport1"), iport2("iport2"), oport1("oport1"),
155  o1toks(o1toks), i1toks(i1toks), i2toks(i2toks), _func(_func)
156  {
157 #ifdef FORSYDE_INTROSPECTION
158  std::string func_name = std::string(basename());
159  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
160  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
161  arg_vec.push_back(std::make_tuple("o1toks",std::to_string(o1toks)));
162  arg_vec.push_back(std::make_tuple("i1toks",std::to_string(i1toks)));
163  arg_vec.push_back(std::make_tuple("i2toks",std::to_string(i2toks)));
164 #endif
165  }
166 
168  std::string forsyde_kind() const {return "SDF::comb2";}
169 private:
170  // consumption rates
171  unsigned int o1toks, i1toks, i2toks;
172 
173  // Inputs and output variables
174  std::vector<T0> o1vals;
175  std::vector<T1> i1vals;
176  std::vector<T2> i2vals;
177 
179  functype _func;
180 
181  //Implementing the abstract semantics
182  void init()
183  {
184  o1vals.resize(o1toks);
185  i1vals.resize(i1toks);
186  i2vals.resize(i2toks);
187  }
188 
189  void prep()
190  {
191  for (auto it=i1vals.begin();it!=i1vals.end();it++)
192  *it = iport1.read();
193  for (auto it=i2vals.begin();it!=i2vals.end();it++)
194  *it = iport2.read();
195  }
196 
197  void exec()
198  {
199  _func(o1vals, i1vals, i2vals);
200  }
201 
202  void prod()
203  {
204  WRITE_VEC_MULTIPORT(oport1, o1vals)
205  }
206 
207  void clean() {}
208 
209 #ifdef FORSYDE_INTROSPECTION
210  void bindInfo()
211  {
212  boundInChans.resize(2); // only one input port
213  boundInChans[0].port = &iport1;
214  boundInChans[1].port = &iport2;
215  boundOutChans.resize(1); // only one output port
216  boundOutChans[0].port = &oport1;
217  }
218 #endif
219 };
220 
222 
224 template <typename T0, typename T1, typename T2, typename T3>
225 class comb3 : public sdf_process
226 {
227 public:
232 
234  typedef std::function<void(std::vector<T0>&,
235  const std::vector<T1>&,
236  const std::vector<T2>&,
237  const std::vector<T3>&
239 
241 
245  comb3(sc_module_name _name,
246  functype _func,
247  unsigned int o1toks,
248  unsigned int i1toks,
249  unsigned int i2toks,
250  unsigned int i3toks
251  ) : sdf_process(_name), iport1("iport1"), iport2("iport2"), iport3("iport3"),
252  oport1("oport1"),
253  o1toks(o1toks), i1toks(i1toks), i2toks(i2toks), i3toks(i3toks), _func(_func)
254  {
255 #ifdef FORSYDE_INTROSPECTION
256  std::string func_name = std::string(basename());
257  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
258  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
259  arg_vec.push_back(std::make_tuple("o1toks",std::to_string(o1toks)));
260  arg_vec.push_back(std::make_tuple("i1toks",std::to_string(i1toks)));
261  arg_vec.push_back(std::make_tuple("i2toks",std::to_string(i2toks)));
262  arg_vec.push_back(std::make_tuple("i3toks",std::to_string(i3toks)));
263 #endif
264  }
265 
267  std::string forsyde_kind() const {return "SDF::comb3";}
268 private:
269  // consumption rates
270  unsigned int o1toks, i1toks, i2toks, i3toks;
271 
272  // Inputs and output variables
273  std::vector<T0> o1vals;
274  std::vector<T1> i1vals;
275  std::vector<T2> i2vals;
276  std::vector<T3> i3vals;
277 
279  functype _func;
280 
281  //Implementing the abstract semantics
282  void init()
283  {
284  o1vals.resize(o1toks);
285  i1vals.resize(i1toks);
286  i2vals.resize(i2toks);
287  i3vals.resize(i3toks);
288  }
289 
290  void prep()
291  {
292  for (auto it=i1vals.begin();it!=i1vals.end();it++)
293  *it = iport1.read();
294  for (auto it=i2vals.begin();it!=i2vals.end();it++)
295  *it = iport2.read();
296  for (auto it=i3vals.begin();it!=i3vals.end();it++)
297  *it = iport3.read();
298  }
299 
300  void exec()
301  {
302  _func(o1vals, i1vals, i2vals, i3vals);
303  }
304 
305  void prod()
306  {
307  WRITE_VEC_MULTIPORT(oport1, o1vals)
308  }
309 
310  void clean() {}
311 
312 #ifdef FORSYDE_INTROSPECTION
313  void bindInfo()
314  {
315  boundInChans.resize(3); // only one input port
316  boundInChans[0].port = &iport1;
317  boundInChans[1].port = &iport2;
318  boundInChans[2].port = &iport3;
319  boundOutChans.resize(1); // only one output port
320  boundOutChans[0].port = &oport1;
321  }
322 #endif
323 };
324 
326 
328 template <typename T0, typename T1, typename T2, typename T3, typename T4>
329 class comb4 : public sdf_process
330 {
331 public:
337 
339  typedef std::function<void(std::vector<T0>&,
340  const std::vector<T1>&,
341  const std::vector<T2>&,
342  const std::vector<T3>&,
343  const std::vector<T4>&
345 
347 
351  comb4(sc_module_name _name,
352  functype _func,
353  unsigned int o1toks,
354  unsigned int i1toks,
355  unsigned int i2toks,
356  unsigned int i3toks,
357  unsigned int i4toks
358  ) : sdf_process(_name), iport1("iport1"), iport2("iport2"), iport3("iport3"),
359  iport4("iport4"), oport1("oport1"),
360  o1toks(o1toks), i1toks(i1toks), i2toks(i2toks), i3toks(i3toks),
361  i4toks(i4toks), _func(_func)
362  {
363 #ifdef FORSYDE_INTROSPECTION
364  std::string func_name = std::string(basename());
365  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
366  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
367  arg_vec.push_back(std::make_tuple("o1toks",std::to_string(o1toks)));
368  arg_vec.push_back(std::make_tuple("i1toks",std::to_string(i1toks)));
369  arg_vec.push_back(std::make_tuple("i2toks",std::to_string(i2toks)));
370  arg_vec.push_back(std::make_tuple("i3toks",std::to_string(i3toks)));
371  arg_vec.push_back(std::make_tuple("i4toks",std::to_string(i4toks)));
372 #endif
373  }
374 
376  std::string forsyde_kind() const {return "SDF::comb4";}
377 private:
378  // consumption rates
379  unsigned int o1toks, i1toks, i2toks, i3toks, i4toks;
380 
381  // Inputs and output variables
382  std::vector<T0> o1vals;
383  std::vector<T1> i1vals;
384  std::vector<T2> i2vals;
385  std::vector<T3> i3vals;
386  std::vector<T4> i4vals;
387 
389  functype _func;
390 
391  //Implementing the abstract semantics
392  void init()
393  {
394  o1vals.resize(o1toks);
395  i1vals.resize(i1toks);
396  i2vals.resize(i2toks);
397  i3vals.resize(i3toks);
398  i4vals.resize(i4toks);
399  }
400 
401  void prep()
402  {
403  for (auto it=i1vals.begin();it!=i1vals.end();it++)
404  *it = iport1.read();
405  for (auto it=i2vals.begin();it!=i2vals.end();it++)
406  *it = iport2.read();
407  for (auto it=i3vals.begin();it!=i3vals.end();it++)
408  *it = iport3.read();
409  for (auto it=i4vals.begin();it!=i4vals.end();it++)
410  *it = iport4.read();
411  }
412 
413  void exec()
414  {
415  _func(o1vals, i1vals, i2vals, i3vals, i4vals);
416  }
417 
418  void prod()
419  {
420  WRITE_VEC_MULTIPORT(oport1, o1vals)
421  }
422 
423  void clean() {}
424 
425 #ifdef FORSYDE_INTROSPECTION
426  void bindInfo()
427  {
428  boundInChans.resize(4); // only one input port
429  boundInChans[0].port = &iport1;
430  boundInChans[1].port = &iport2;
431  boundInChans[2].port = &iport3;
432  boundInChans[3].port = &iport4;
433  boundOutChans.resize(1); // only one output port
434  boundOutChans[0].port = &oport1;
435  }
436 #endif
437 };
438 
440 
449 template <class T>
450 class delay : public sdf_process
451 {
452 public:
455 
457 
461  delay(sc_module_name _name,
462  T init_val
463  ) : sdf_process(_name), iport1("iport1"), oport1("oport1"),
464  init_val(init_val)
465  {
466 #ifdef FORSYDE_INTROSPECTION
467  std::stringstream ss;
468  ss << init_val;
469  arg_vec.push_back(std::make_tuple("init_val", ss.str()));
470 #endif
471  }
472 
474  std::string forsyde_kind() const {return "SDF::delay";}
475 
476 private:
477  // Initial value
478  T init_val;
479 
480  // Inputs and output variables
481  T* val;
482 
483  //Implementing the abstract semantics
484  void init()
485  {
486  val = new T;
487  WRITE_MULTIPORT(oport1, init_val)
488  }
489 
490  void prep()
491  {
492  *val = iport1.read();
493  }
494 
495  void exec() {}
496 
497  void prod()
498  {
499  WRITE_MULTIPORT(oport1, *val)
500  }
501 
502  void clean()
503  {
504  delete val;
505  }
506 #ifdef FORSYDE_INTROSPECTION
507  void bindInfo()
508  {
509  boundInChans.resize(1); // only one input port
510  boundInChans[0].port = &iport1;
511  boundOutChans.resize(1); // only one output port
512  boundOutChans[0].port = &oport1;
513  }
514 #endif
515 };
516 
518 
525 template <class T>
526 class delayn : public sdf_process
527 {
528 public:
531 
533 
537  delayn(sc_module_name _name,
538  T init_val,
539  unsigned int n
540  ) : sdf_process(_name), iport1("iport1"), oport1("oport1"),
541  init_val(init_val), ns(n)
542  {
543 #ifdef FORSYDE_INTROSPECTION
544  std::stringstream ss;
545  ss << init_val;
546  arg_vec.push_back(std::make_tuple("init_val", ss.str()));
547  arg_vec.push_back(std::make_tuple("n", std::to_string(n)));
548 #endif
549  }
550 
552  std::string forsyde_kind() const {return "SDF::delayn";}
553 
554 private:
555  // Initial value
556  T init_val;
557  unsigned int ns;
558 
559  // Inputs and output variables
560  T* val;
561 
562  //Implementing the abstract semantics
563  void init()
564  {
565  val = new T;
566  for (unsigned int i=0; i<ns; i++)
567  WRITE_MULTIPORT(oport1, init_val)
568  }
569 
570  void prep()
571  {
572  *val = iport1.read();
573  }
574 
575  void exec() {}
576 
577  void prod()
578  {
579  WRITE_MULTIPORT(oport1, *val)
580  }
581 
582  void clean()
583  {
584  delete val;
585  }
586 #ifdef FORSYDE_INTROSPECTION
587  void bindInfo()
588  {
589  boundInChans.resize(1); // only one input port
590  boundInChans[0].port = &iport1;
591  boundOutChans.resize(1); // only one output port
592  boundOutChans[0].port = &oport1;
593  }
594 #endif
595 };
596 
598 
603 template <class T>
604 class constant : public sdf_process
605 {
606 public:
608 
610 
613  constant(sc_module_name _name,
614  T init_val,
615  unsigned long long take=0
616  ) : sdf_process(_name), oport1("oport1"),
617  init_val(init_val), take(take)
618 
619  {
620 #ifdef FORSYDE_INTROSPECTION
621  std::stringstream ss;
622  ss << init_val;
623  arg_vec.push_back(std::make_tuple("init_val", ss.str()));
624  arg_vec.push_back(std::make_tuple("take", std::to_string(take)));
625 #endif
626  }
627 
629  std::string forsyde_kind() const {return "SDF::constant";}
630 
631 private:
632  T init_val;
633  unsigned long long take; // Number of tokens produced
634 
635  unsigned long long tok_cnt;
636  bool infinite;
637 
638  //Implementing the abstract semantics
639  void init()
640  {
641  if (take==0) infinite = true;
642  tok_cnt = 0;
643  }
644 
645  void prep() {}
646 
647  void exec() {}
648 
649  void prod()
650  {
651  if (tok_cnt++ < take || infinite)
652  WRITE_MULTIPORT(oport1, init_val)
653  else wait();
654  }
655 
656  void clean() {}
657 
658 #ifdef FORSYDE_INTROSPECTION
659  void bindInfo()
660  {
661  boundOutChans.resize(1); // only one output port
662  boundOutChans[0].port = &oport1;
663  }
664 #endif
665 };
666 
668 
673 template <class T>
674 class source : public sdf_process
675 {
676 public:
678 
680  typedef std::function<void(T&, const T&)> functype;
681 
683 
686  source(sc_module_name _name,
687  functype _func,
688  T init_val,
689  unsigned long long take=0
690  ) : sdf_process(_name), oport1("oport1"),
691  init_st(init_val), take(take), _func(_func)
692  {
693 #ifdef FORSYDE_INTROSPECTION
694  std::string func_name = std::string(basename());
695  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
696  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
697  std::stringstream ss;
698  ss << init_val;
699  arg_vec.push_back(std::make_tuple("init_val", ss.str()));
700  arg_vec.push_back(std::make_tuple("take", std::to_string(take)));
701 #endif
702  }
703 
705  std::string forsyde_kind() const {return "SDF::source";}
706 
707 private:
708  T init_st; // The current state
709  unsigned long long take; // Number of tokens produced
710 
711  T* cur_st; // The current state of the process
712  unsigned long long tok_cnt;
713  bool infinite;
714 
716  functype _func;
717 
718  //Implementing the abstract semantics
719  void init()
720  {
721  cur_st = new T;
722  *cur_st = init_st;
723  WRITE_MULTIPORT(oport1, *cur_st)
724  if (take==0) infinite = true;
725  tok_cnt = 1;
726  }
727 
728  void prep() {}
729 
730  void exec()
731  {
732  _func(*cur_st, *cur_st);
733  }
734 
735  void prod()
736  {
737  if (tok_cnt++ < take || infinite)
738  WRITE_MULTIPORT(oport1, *cur_st)
739  else wait();
740  }
741 
742  void clean()
743  {
744  delete cur_st;
745  }
746 
747 #ifdef FORSYDE_INTROSPECTION
748  void bindInfo()
749  {
750  boundOutChans.resize(1); // only one output port
751  boundOutChans[0].port = &oport1;
752  }
753 #endif
754 };
755 
757 
763 template <class T>
764 class file_source : public sdf_process
765 {
766 public:
768 
770  typedef std::function<void(T&, const std::string&)> functype;
771 
773 
776  file_source(sc_module_name _name,
777  functype _func,
778  std::string file_name
779  ) : sdf_process(_name), oport1("oport1"),
780  file_name(file_name), _func(_func)
781  {
782 #ifdef FORSYDE_INTROSPECTION
783  std::string func_name = std::string(basename());
784  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
785  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
786  arg_vec.push_back(std::make_tuple("file_name", file_name));
787  arg_vec.push_back(std::make_tuple("o1toks", std::to_string(1)));
788 #endif
789  }
790 
792  std::string forsyde_kind() const {return "SDF::file_source";}
793 
794 private:
795  std::string file_name;
796 
797  std::string cur_str; // The current string read from the input
798  std::ifstream ifs;
799  T* cur_val;
800 
802  functype _func;
803 
804  //Implementing the abstract semantics
805  void init()
806  {
807  cur_val = new T;
808  ifs.open(file_name);
809  if (!ifs.is_open())
810  {
811  SC_REPORT_ERROR(name(),"cannot open the file.");
812  }
813  }
814 
815  void prep()
816  {
817  if (!getline(ifs,cur_str))
818  {
819  wait();
820  }
821  }
822 
823  void exec()
824  {
825  _func(*cur_val, cur_str);
826  }
827 
828  void prod()
829  {
830  WRITE_MULTIPORT(oport1, *cur_val)
831  }
832 
833  void clean()
834  {
835  ifs.close();
836  delete cur_val;
837  }
838 
839 #ifdef FORSYDE_INTROSPECTION
840  void bindInfo()
841  {
842  boundOutChans.resize(1); // only one output port
843  boundOutChans[0].port = &oport1;
844  }
845 #endif
846 };
847 
849 
853 template <class T>
854 class vsource : public sdf_process
855 {
856 public:
858 
860 
863  vsource(const sc_module_name& _name,
864  const std::vector<T>& in_vec
865  ) : sdf_process(_name), in_vec(in_vec)
866  {
867 #ifdef FORSYDE_INTROSPECTION
868  std::stringstream ss;
869  ss << in_vec;
870  arg_vec.push_back(std::make_tuple("in_vec", ss.str()));
871 #endif
872  }
873 
875  std::string forsyde_kind() const {return "SDF::vsource";}
876 
877 private:
878  std::vector<T> in_vec;
879 
880  typename std::vector<T>::iterator itr;
881 
882  //Implementing the abstract semantics
883  void init()
884  {
885  itr = in_vec.begin();
886  }
887 
888  void prep() {}
889 
890  void exec() {}
891 
892  void prod()
893  {
894  if (itr != in_vec.end())
895  {
896  WRITE_MULTIPORT(oport1, *itr)
897  ++itr;
898  }
899  else
900  wait();
901  }
902 
903  void clean() {}
904 
905 #ifdef FORSYDE_INTROSPECTION
906  void bindInfo()
907  {
908  boundOutChans.resize(1); // only one output port
909  boundOutChans[0].port = &oport1;
910  }
911 #endif
912 };
913 
915 
919 template <class T>
920 class sink : public sdf_process
921 {
922 public:
924 
926  typedef std::function<void(const T&)> functype;
927 
929 
932  sink(sc_module_name _name,
933  functype _func
934  ) : sdf_process(_name), iport1("iport1"), _func(_func)
935 
936  {
937 #ifdef FORSYDE_INTROSPECTION
938  std::string func_name = std::string(basename());
939  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
940  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
941  arg_vec.push_back(std::make_tuple("i1toks", std::to_string(1)));
942 #endif
943  }
944 
946  std::string forsyde_kind() const {return "SDF::sink";}
947 
948 private:
949  T* val; // The current state of the process
950 
952  functype _func;
953 
954  //Implementing the abstract semantics
955  void init()
956  {
957  val = new T;
958  }
959 
960  void prep()
961  {
962  *val = iport1.read();
963  }
964 
965  void exec()
966  {
967  _func(*val);
968  }
969 
970  void prod() {}
971 
972  void clean()
973  {
974  delete val;
975  }
976 
977 #ifdef FORSYDE_INTROSPECTION
978  void bindInfo()
979  {
980  boundInChans.resize(1); // only one output port
981  boundInChans[0].port = &iport1;
982  }
983 #endif
984 };
985 
987 
992 template <class T>
993 class file_sink : public sdf_process
994 {
995 public:
997 
999  typedef std::function<void(std::string&, const T&)> functype;
1000 
1002 
1005  file_sink(sc_module_name _name,
1006  functype _func,
1007  std::string file_name
1008  ) : sdf_process(_name), iport1("iport1"), file_name(file_name),
1009  _func(_func)
1010 
1011  {
1012 #ifdef FORSYDE_INTROSPECTION
1013  std::string func_name = std::string(basename());
1014  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
1015  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
1016  arg_vec.push_back(std::make_tuple("file_name", file_name));
1017  arg_vec.push_back(std::make_tuple("i1toks", std::to_string(1)));
1018 #endif
1019  }
1020 
1022  std::string forsyde_kind() const {return "SDF::file_sink";}
1023 
1024 private:
1025  std::string file_name;
1026 
1027  std::string ostr; // The current string to be written to the output
1028  std::ofstream ofs;
1029  T* cur_val; // The current state of the process
1030 
1032  functype _func;
1033 
1034  //Implementing the abstract semantics
1035  void init()
1036  {
1037  cur_val = new T;
1038  ofs.open(file_name);
1039  if (!ofs.is_open())
1040  {
1041  SC_REPORT_ERROR(name(),"cannot open the file.");
1042  }
1043  }
1044 
1045  void prep()
1046  {
1047  *cur_val = iport1.read();
1048  }
1049 
1050  void exec()
1051  {
1052  _func(ostr, *cur_val);
1053  }
1054 
1055  void prod()
1056  {
1057  ofs << ostr << std::endl;
1058  }
1059 
1060  void clean()
1061  {
1062  ofs.close();
1063  delete cur_val;
1064  }
1065 
1066 #ifdef FORSYDE_INTROSPECTION
1067  void bindInfo()
1068  {
1069  boundInChans.resize(1); // only one output port
1070  boundInChans[0].port = &iport1;
1071  }
1072 #endif
1073 };
1074 
1076 
1082 template <class ITYP>
1083 class printSigs : public sc_module
1084 {
1085 public:
1086  sc_fifo_in<ITYP> iport;
1087 
1089 
1092  printSigs(sc_module_name _name
1093  ):sc_module(_name)
1094  {
1095  SC_THREAD(worker);
1096  }
1097 
1098 private:
1099  SC_HAS_PROCESS(printSigs);
1100 
1102  void worker()
1103  {
1104  // write the header
1105  for (int i=0;i<iport.size();i++)
1106  std::cout << " " << name() << "(" << i << ")";
1107  std::cout << std::endl;
1108  // start reading from the ports
1109  ITYP in_val[iport.size()];
1110  while (1)
1111  {
1112  for (int i=0;i<iport.size();i++)
1113  in_val[i] = iport[i]->read();
1114  // print one line
1115  for (int i=0;i<iport.size();i++)
1116  std::cout << " " << in_val[i];
1117  std::cout << std::endl;
1118  }
1119  }
1120 };
1121 
1123 
1125 template <class T1, class T2>
1126 class zip : public sdf_process
1127 {
1128 public:
1132 
1134 
1137  zip(sc_module_name _name,
1138  unsigned int i1toks,
1139  unsigned int i2toks
1140  ) : sdf_process(_name), iport1("iport1"), iport2("iport2"), oport1("oport1"),
1141  i1toks(i1toks), i2toks(i2toks)
1142  {
1143 #ifdef FORSYDE_INTROSPECTION
1144  arg_vec.push_back(std::make_tuple("i1toks",std::to_string(i1toks)));
1145  arg_vec.push_back(std::make_tuple("i2toks",std::to_string(i2toks)));
1146 #endif
1147  }
1148 
1150  std::string forsyde_kind() const {return "SDF::zip";}
1151 
1152 private:
1153  unsigned i1toks;
1154  unsigned i2toks;
1155 
1156  // intermediate values
1157  std::vector<T1> ival1;
1158  std::vector<T2> ival2;
1159 
1160  void init()
1161  {
1162  ival1.resize(i1toks);
1163  ival2.resize(i2toks);
1164  }
1165 
1166  void prep()
1167  {
1168  for (auto i=0; i<i1toks; i++)
1169  ival1[i] = iport1.read();
1170  for (auto i=0; i<i2toks; i++)
1171  ival2[i] = iport2.read();
1172  }
1173 
1174  void exec() {}
1175 
1176  void prod()
1177  {
1178  WRITE_MULTIPORT(oport1,std::make_tuple(ival1,ival2)) // write to the output
1179  }
1180 
1181  void clean() {}
1182 
1183 #ifdef FORSYDE_INTROSPECTION
1184  void bindInfo()
1185  {
1186  boundInChans.resize(2); // two input ports
1187  boundInChans[0].port = &iport1;
1188  boundInChans[1].port = &iport2;
1189  boundOutChans.resize(1); // only one output port
1190  boundOutChans[0].port = &oport1;
1191  }
1192 #endif
1193 };
1194 
1196 
1198 template <class... Ts>
1199 class zipN : public sdf_process
1200 {
1201 public:
1202  std::tuple <SDF_in<Ts>...> iport;
1204 
1206 
1209  zipN(sc_module_name _name,
1210  std::vector<unsigned> in_toks)
1211  :sdf_process(_name), oport1("oport1"), in_toks(in_toks)
1212  {
1213  if (in_toks.size()!=sizeof...(Ts))
1214  SC_REPORT_ERROR(name(),"Wrong number of production rates provided");
1215 #ifdef FORSYDE_INTROSPECTION
1216  std::stringstream ss;
1217  ss << in_toks;
1218  arg_vec.push_back(std::make_tuple("itoks",ss.str()));
1219 #endif
1220  }
1221 
1223  std::string forsyde_kind() const {return "SDF::zipN";}
1224 private:
1225  std::vector<unsigned> in_toks;
1226  // intermediate values
1227  std::tuple<std::vector<Ts>...>* in_val;
1228 
1229  void init()
1230  {
1231  in_val = new std::tuple<std::vector<Ts>...>;
1232  }
1233 
1234  void prep()
1235  {
1236  *in_val = sc_fifo_tuple_read<Ts...>(iport, in_toks);
1237  }
1238 
1239  void exec() {}
1240 
1241  void prod()
1242  {
1243  WRITE_MULTIPORT(oport1,*in_val); // write to the output
1244  }
1245 
1246  void clean()
1247  {
1248  delete in_val;
1249  }
1250 
1251  template<size_t N,class R, class T>
1252  struct fifo_read_helper
1253  {
1254  static void read(R& ret, T& t, const std::vector<unsigned int>& itoks)
1255  {
1256  fifo_read_helper<N-1,R,T>::read(ret,t,itoks);
1257  for (unsigned int i=0;i<itoks[N];i++)
1258  std::get<N>(ret).push_back(std::get<N>(t).read());
1259  }
1260  };
1261 
1262  template<class R, class T>
1263  struct fifo_read_helper<0,R,T>
1264  {
1265  static void read(R& ret, T& t, const std::vector<unsigned int>& itoks)
1266  {
1267  for (unsigned int i=0;i<itoks[0];i++)
1268  std::get<0>(ret).push_back(std::get<0>(t).read());
1269  }
1270  };
1271 
1272  template<class... T>
1273  std::tuple<std::vector<T>...> sc_fifo_tuple_read(std::tuple<SDF_in<T>...>& ports,
1274  const std::vector<unsigned int>& itoks)
1275  {
1276  std::tuple<std::vector<T>...> ret;
1277  fifo_read_helper<sizeof...(T)-1,
1278  std::tuple<std::vector<T>...>,
1279  std::tuple<SDF_in<T>...>>::read(ret,ports,itoks);
1280  return ret;
1281  }
1282 
1283 #ifdef FORSYDE_INTROSPECTION
1284  void bindInfo()
1285  {
1286  boundInChans.resize(sizeof...(Ts)); // two output ports
1287  register_ports(boundInChans, iport);
1288  boundOutChans.resize(1); // only one input port
1289  boundOutChans[0].port = &oport1;
1290  }
1291 
1292  template<size_t N, class T>
1293  struct register_ports_helper
1294  {
1295  static void reg_port(std::vector<PortInfo>& boundChans, T& t)
1296  {
1297  register_ports_helper<N-1,T>::reg_port(boundChans,t);
1298  boundChans[N].port = &std::get<N>(t);
1299  }
1300  };
1301 
1302  template<class T>
1303  struct register_ports_helper<0,T>
1304  {
1305  static void reg_port(std::vector<PortInfo>& boundChans, T& t)
1306  {
1307  boundChans[0].port = &std::get<0>(t);
1308  }
1309  };
1310 
1311  template<class... T>
1312  void register_ports(std::vector<PortInfo>& boundChans,
1313  std::tuple<SDF_in<T>...>& ports)
1314  {
1315  register_ports_helper<sizeof...(T)-1,
1316  std::tuple<SDF_in<T>...>&>::reg_port(boundChans,ports);
1317  }
1318 #endif
1319 
1320 };
1321 
1323 
1325 template <class T1, class T2>
1326 class unzip : public sdf_process
1327 {
1328 public:
1332 
1334 
1337  unzip(sc_module_name _name,
1338  unsigned int o1toks,
1339  unsigned int o2toks
1340  )
1341  :sdf_process(_name), iport1("iport1"), oport1("oport1"), oport2("oport2"),
1342  o1toks(o1toks), o2toks(o2toks)
1343  {
1344 #ifdef FORSYDE_INTROSPECTION
1345  arg_vec.push_back(std::make_tuple("o1toks",std::to_string(o1toks)));
1346  arg_vec.push_back(std::make_tuple("o2toks",std::to_string(o2toks)));
1347 #endif
1348  }
1349 
1351  std::string forsyde_kind() const {return "SDF::unzip";}
1352 private:
1353  // consumption rates
1354  unsigned int o1toks, o2toks;
1355 
1356  // intermediate values
1357  std::tuple<std::vector<T1>,std::vector<T2>>* in_val;
1358 
1359  void init()
1360  {
1361  in_val = new std::tuple<std::vector<T1>,std::vector<T2>>;
1362  }
1363 
1364  void prep()
1365  {
1366  *in_val = iport1.read();
1367  }
1368 
1369  void exec() {}
1370 
1371  void prod()
1372  {
1373 
1374  WRITE_VEC_MULTIPORT(oport1,std::get<0>(*in_val)) // write to the output 1
1375  WRITE_VEC_MULTIPORT(oport2,std::get<1>(*in_val)) // write to the output 2
1376  }
1377 
1378  void clean()
1379  {
1380  delete in_val;
1381  }
1382 
1383 #ifdef FORSYDE_INTROSPECTION
1384  void bindInfo()
1385  {
1386  boundInChans.resize(1); // only one input port
1387  boundInChans[0].port = &iport1;
1388  boundOutChans.resize(2); // two output ports
1389  boundOutChans[0].port = &oport1;
1390  boundOutChans[1].port = &oport2;
1391  }
1392 #endif
1393 };
1394 
1396 
1398 template <class... Ts>
1399 class unzipN : public sdf_process
1400 {
1401 public:
1403  std::tuple<SDF_out<Ts>...> oport;
1404 
1406 
1409  unzipN(sc_module_name _name,
1410  std::vector<unsigned> out_toks)
1411  :sdf_process(_name), iport1("iport1"), out_toks(out_toks)
1412  {
1413  if (out_toks.size()!=sizeof...(Ts))
1414  SC_REPORT_ERROR(name(),"Wrong number of production rates provided");
1415 #ifdef FORSYDE_INTROSPECTION
1416  std::stringstream ss;
1417  ss << out_toks;
1418  arg_vec.push_back(std::make_tuple("otoks",ss.str()));
1419 #endif
1420  }
1421 
1423  std::string forsyde_kind() const {return "SDF::unzipN";}
1424 private:
1425  std::vector<unsigned> out_toks;
1426  // intermediate values
1427  std::tuple<std::vector<Ts>...>* in_val;
1428 
1429  void init()
1430  {
1431  in_val = new std::tuple<std::vector<Ts>...>;
1432  }
1433 
1434  void prep()
1435  {
1436  *in_val = iport1.read();
1437  }
1438 
1439  void exec() {}
1440 
1441  void prod()
1442  {
1443  fifo_tuple_write<Ts...>(*in_val, oport);
1444  }
1445 
1446  void clean()
1447  {
1448  delete in_val;
1449  }
1450 
1451  template<size_t N,class R, class T>
1452  struct fifo_write_helper
1453  {
1454  static void write(const R& vals, T& t)
1455  {
1456  fifo_write_helper<N-1,R,T>::write(vals,t);
1457  for (unsigned int i=0;i<(std::get<N>(vals)).size();i++)
1458  std::get<N>(t).write(std::get<N>(vals)[i]);
1459  }
1460  };
1461 
1462  template<class R, class T>
1463  struct fifo_write_helper<0,R,T>
1464  {
1465  static void write(const R& vals, T& t)
1466  {
1467  for (unsigned int i=0;i<(std::get<0>(vals)).size();i++)
1468  std::get<0>(t).write(std::get<0>(vals)[i]);
1469  }
1470  };
1471 
1472  template<class... T>
1473  void fifo_tuple_write(const std::tuple<std::vector<T>...>& vals,
1474  std::tuple<SDF_out<T>...>& ports)
1475  {
1476  fifo_write_helper<sizeof...(T)-1,
1477  std::tuple<std::vector<T>...>,
1478  std::tuple<SDF_out<T>...>>::write(vals,ports);
1479  }
1480 
1481 #ifdef FORSYDE_INTROSPECTION
1482  void bindInfo()
1483  {
1484  boundInChans.resize(1); // only one input port
1485  boundInChans[0].port = &iport1;
1486  boundOutChans.resize(sizeof...(Ts)); // two output ports
1487  register_ports(boundOutChans, oport);
1488  }
1489 
1490  template<size_t N, class T>
1491  struct register_ports_helper
1492  {
1493  static void reg_port(std::vector<PortInfo>& boundChans, T& t)
1494  {
1495  register_ports_helper<N-1,T>::reg_port(boundChans,t);
1496  boundChans[N].port = &std::get<N>(t);
1497  }
1498  };
1499 
1500  template<class T>
1501  struct register_ports_helper<0,T>
1502  {
1503  static void reg_port(std::vector<PortInfo>& boundChans, T& t)
1504  {
1505  boundChans[0].port = &std::get<0>(t);
1506  }
1507  };
1508 
1509  template<class... T>
1510  void register_ports(std::vector<PortInfo>& boundChans,
1511  std::tuple<SDF_out<T>...>& ports)
1512  {
1513  register_ports_helper<sizeof...(T)-1,
1514  std::tuple<SDF_out<T>...>&>::reg_port(boundChans,ports);
1515  }
1516 #endif
1517 
1518 };
1519 
1521 
1530 template <class T>
1531 class fanout : public sdf_process
1532 {
1533 public:
1536 
1538 
1541  fanout(sc_module_name _name) // module name
1542  : sdf_process(_name) { }
1543 
1545  std::string forsyde_kind() const {return "SDF::fanout";}
1546 
1547 private:
1548  // Inputs and output variables
1549  T* val;
1550 
1551  //Implementing the abstract semantics
1552  void init()
1553  {
1554  val = new T;
1555  }
1556 
1557  void prep()
1558  {
1559  *val = iport1.read();
1560  }
1561 
1562  void exec() {}
1563 
1564  void prod()
1565  {
1566  WRITE_MULTIPORT(oport1, *val)
1567  }
1568 
1569  void clean()
1570  {
1571  delete val;
1572  }
1573 #ifdef FORSYDE_INTROSPECTION
1574  void bindInfo()
1575  {
1576  boundInChans.resize(1); // only one input port
1577  boundInChans[0].port = &iport1;
1578  boundOutChans.resize(1); // only one output port
1579  boundOutChans[0].port = &oport1;
1580  }
1581 #endif
1582 };
1583 
1584 }
1585 }
1586 
1587 #endif
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sdf_process_constructors.hpp:376
Process constructor for a combinational process with two inputs and one output.
Definition: sdf_process_constructors.hpp:329
SDF_out< T > oport1
port for the output channel
Definition: sdf_process_constructors.hpp:454
Process constructor for a combinational process (actor) with one input and one output.
Definition: sdf_process_constructors.hpp:45
SDF_in< std::tuple< std::vector< Ts >... > > iport1
port for the input channel
Definition: sdf_process_constructors.hpp:1402
delay(sc_module_name _name, T init_val)
The constructor requires the module name.
Definition: sdf_process_constructors.hpp:461
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sdf_process_constructors.hpp:629
Process constructor for a file_source process.
Definition: sdf_process_constructors.hpp:764
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sdf_process_constructors.hpp:792
sink(sc_module_name _name, functype _func)
The constructor requires the module name.
Definition: sdf_process_constructors.hpp:932
SDF_in< T > iport1
port for the input channel
Definition: sdf_process_constructors.hpp:453
SDF_out< std::tuple< std::vector< Ts >... > > oport1
port for the output channel
Definition: sdf_process_constructors.hpp:1203
The namespace for ForSyDe.
Definition: abssemantics.hpp:30
SDF_out< T > oport1
port for the output channel
Definition: sdf_process_constructors.hpp:607
zip(sc_module_name _name, unsigned int i1toks, unsigned int i2toks)
The constructor requires the module name.
Definition: sdf_process_constructors.hpp:1137
SDF_in< T1 > iport1
port for the input channel 1
Definition: sdf_process_constructors.hpp:134
file_sink(sc_module_name _name, functype _func, std::string file_name)
The constructor requires the module name.
Definition: sdf_process_constructors.hpp:1005
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sdf_process_constructors.hpp:875
unzipN(sc_module_name _name, std::vector< unsigned > out_toks)
The constructor requires the module name.
Definition: sdf_process_constructors.hpp:1409
SDF_out< T > oport1
port for the output channel
Definition: sdf_process_constructors.hpp:767
Process constructor for a file_sink process.
Definition: sdf_process_constructors.hpp:993
std::function< void(T &, const std::string &)> functype
Type of the function to be passed to the process constructor.
Definition: sdf_process_constructors.hpp:770
SDF_in< std::tuple< std::vector< T1 >, std::vector< T2 > > > iport1
port for the input channel
Definition: sdf_process_constructors.hpp:1329
comb(sc_module_name _name, functype _func, unsigned int o1toks, unsigned int i1toks)
The constructor requires the module name ad the number of tokens to be produced.
Definition: sdf_process_constructors.hpp:61
Process constructor for a source process.
Definition: sdf_process_constructors.hpp:674
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sdf_process_constructors.hpp:946
SDF_out< T0 > oport1
port for the output channel
Definition: sdf_process_constructors.hpp:231
constant(sc_module_name _name, T init_val, unsigned long long take=0)
The constructor requires the module name.
Definition: sdf_process_constructors.hpp:613
Process constructor for a multi-input print process.
Definition: sdf_process_constructors.hpp:1083
Process constructor for a combinational process with two inputs and one output.
Definition: sdf_process_constructors.hpp:131
Process constructor for a source process with vector input.
Definition: sdf_process_constructors.hpp:854
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sdf_process_constructors.hpp:1223
comb3(sc_module_name _name, functype _func, unsigned int o1toks, unsigned int i1toks, unsigned int i2toks, unsigned int i3toks)
The constructor requires the module name.
Definition: sdf_process_constructors.hpp:245
std::function< void(std::vector< T0 > &, const std::vector< T1 > &, const std::vector< T2 > &, const std::vector< T3 > &, const std::vector< T4 > &)> functype
Type of the function to be passed to the process constructor.
Definition: sdf_process_constructors.hpp:344
Process constructor for a fan-out process with one input and one output.
Definition: sdf_process_constructors.hpp:1531
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sdf_process_constructors.hpp:1022
SDF_out< std::tuple< std::vector< T1 >, std::vector< T2 > > > oport1
port for the output channel
Definition: sdf_process_constructors.hpp:1131
The UT_out port is used for output ports of UT processes.
Definition: ut_process.hpp:68
Process constructor for a n-delay element.
Definition: sdf_process_constructors.hpp:526
SDF_out< T0 > oport1
port for the output channel
Definition: sdf_process_constructors.hpp:49
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sdf_process_constructors.hpp:1545
zipN(sc_module_name _name, std::vector< unsigned > in_toks)
The constructor requires the module name.
Definition: sdf_process_constructors.hpp:1209
SDF_in< T3 > iport3
port for the input channel 3
Definition: sdf_process_constructors.hpp:334
SDF_in< T > iport1
port for the input channel
Definition: sdf_process_constructors.hpp:923
SDF_out< T2 > oport2
port for the output channel 2
Definition: sdf_process_constructors.hpp:1331
vsource(const sc_module_name &_name, const std::vector< T > &in_vec)
The constructor requires the module name.
Definition: sdf_process_constructors.hpp:863
fanout(sc_module_name _name)
The constructor requires the module name.
Definition: sdf_process_constructors.hpp:1541
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sdf_process_constructors.hpp:1351
SDF_out< T > oport1
port for the output channel
Definition: sdf_process_constructors.hpp:677
std::function< void(T &, const T &)> functype
Type of the function to be passed to the process constructor.
Definition: sdf_process_constructors.hpp:680
SDF_in< T1 > iport1
port for the input channel 1
Definition: sdf_process_constructors.hpp:228
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sdf_process_constructors.hpp:705
std::function< void(std::vector< T0 > &, const std::vector< T1 > &, const std::vector< T2 > &)> functype
Type of the function to be passed to the process constructor.
Definition: sdf_process_constructors.hpp:142
SDF_in< T > iport1
port for the input channel
Definition: sdf_process_constructors.hpp:529
SDF_in< T3 > iport3
port for the input channel 3
Definition: sdf_process_constructors.hpp:230
SDF_out< T1 > oport1
port for the output channel 1
Definition: sdf_process_constructors.hpp:1330
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sdf_process_constructors.hpp:267
SDF_in< T1 > iport1
port for the input channel 1
Definition: sdf_process_constructors.hpp:332
Implements the abstract process in the SDF Model of Computation.
unzip(sc_module_name _name, unsigned int o1toks, unsigned int o2toks)
The constructor requires the module name.
Definition: sdf_process_constructors.hpp:1337
delayn(sc_module_name _name, T init_val, unsigned int n)
The constructor requires the module name.
Definition: sdf_process_constructors.hpp:537
printSigs(sc_module_name _name)
The constructor requires the module name.
Definition: sdf_process_constructors.hpp:1092
SDF_in< T1 > iport1
port for the input channel
Definition: sdf_process_constructors.hpp:48
std::function< void(std::vector< T0 > &, const std::vector< T1 > &)> functype
Type of the function to be passed to the process constructor.
Definition: sdf_process_constructors.hpp:54
std::function< void(const T &)> functype
Type of the function to be passed to the process constructor.
Definition: sdf_process_constructors.hpp:926
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sdf_process_constructors.hpp:168
comb2(sc_module_name _name, functype _func, unsigned int o1toks, unsigned int i1toks, unsigned int i2toks)
The constructor requires the module name.
Definition: sdf_process_constructors.hpp:149
The process constructor which defines the abstract semantics of execution.
Definition: abssemantics.hpp:212
The unzip process with one input and variable number of outputs.
Definition: sdf_process_constructors.hpp:1399
SDF_in< T2 > iport2
port for the input channel 2
Definition: sdf_process_constructors.hpp:1130
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sdf_process_constructors.hpp:1150
SDF_in< T1 > iport1
port for the input channel 1
Definition: sdf_process_constructors.hpp:1129
sc_fifo_in< ITYP > iport
multi-port for the input channel
Definition: sdf_process_constructors.hpp:1086
std::function< void(std::vector< T0 > &, const std::vector< T1 > &, const std::vector< T2 > &, const std::vector< T3 > &)> functype
Type of the function to be passed to the process constructor.
Definition: sdf_process_constructors.hpp:238
The zip process with two inputs and one output.
Definition: sdf_process_constructors.hpp:1126
Process constructor for a constant source process.
Definition: sdf_process_constructors.hpp:604
SDF_out< T0 > oport1
port for the output channel
Definition: sdf_process_constructors.hpp:336
SDF_out< T0 > oport1
port for the output channel
Definition: sdf_process_constructors.hpp:136
comb4(sc_module_name _name, functype _func, unsigned int o1toks, unsigned int i1toks, unsigned int i2toks, unsigned int i3toks, unsigned int i4toks)
The constructor requires the module name.
Definition: sdf_process_constructors.hpp:351
The UT_in port is used for input ports of UT processes.
Definition: ut_process.hpp:55
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sdf_process_constructors.hpp:474
Process constructor for a combinational process with two inputs and one output.
Definition: sdf_process_constructors.hpp:225
Process constructor for a sink process.
Definition: sdf_process_constructors.hpp:920
SDF_out< T > oport1
port for the output channel
Definition: sdf_process_constructors.hpp:857
The zip process with variable number of inputs and one output.
Definition: sdf_process_constructors.hpp:1199
SDF_in< T2 > iport2
port for the input channel 2
Definition: sdf_process_constructors.hpp:229
SDF_out< T > oport1
port for the output channel
Definition: sdf_process_constructors.hpp:530
SDF_in< T > iport1
port for the input channel
Definition: sdf_process_constructors.hpp:1534
Process constructor for a delay element.
Definition: sdf_process_constructors.hpp:450
SDF_in< T2 > iport2
port for the input channel 2
Definition: sdf_process_constructors.hpp:333
The unzip process with one input and two outputs.
Definition: sdf_process_constructors.hpp:1326
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sdf_process_constructors.hpp:552
source(sc_module_name _name, functype _func, T init_val, unsigned long long take=0)
The constructor requires the module name.
Definition: sdf_process_constructors.hpp:686
SDF_in< T > iport1
port for the input channel
Definition: sdf_process_constructors.hpp:996
file_source(sc_module_name _name, functype _func, std::string file_name)
The constructor requires the module name.
Definition: sdf_process_constructors.hpp:776
std::tuple< SDF_out< Ts >... > oport
tuple of ports for the output channels
Definition: sdf_process_constructors.hpp:1403
SDF_out< T > oport1
port for the output channel
Definition: sdf_process_constructors.hpp:1535
std::tuple< SDF_in< Ts >... > iport
tuple of ports for the input channels
Definition: sdf_process_constructors.hpp:1202
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sdf_process_constructors.hpp:78
SDF_in< T4 > iport4
port for the input channel 4
Definition: sdf_process_constructors.hpp:335
std::function< void(std::string &, const T &)> functype
Type of the function to be passed to the process constructor.
Definition: sdf_process_constructors.hpp:999
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sdf_process_constructors.hpp:1423
SDF_in< T2 > iport2
port for the input channel 2
Definition: sdf_process_constructors.hpp:135