ut_process_constructors.hpp
Go to the documentation of this file.
1 /**********************************************************************
2  * ut_process_constructors.hpp -- Process constructors in the *
3  * untimed MOC. *
4  * *
5  * Author: Hosein Attarzadeh (shan2@kth.se) *
6  * *
7  * Purpose: Providing basic process constructors for modeling *
8  * UT systems in ForSyDe-SystemC *
9  * *
10  * Usage: This file is included automatically *
11  * *
12  * License: BSD3 *
13  *******************************************************************/
14 
15 #ifndef UT_PROCESS_CONSTRUCTORS_HPP
16 #define UT_PROCESS_CONSTRUCTORS_HPP
17 
25 #include <functional>
26 #include <tuple>
27 #include <vector>
28 
29 #include "ut_process.hpp"
30 
31 namespace ForSyDe
32 {
33 
34 namespace UT
35 {
36 
37 using namespace sc_core;
38 
40 
44 template <typename T0, typename T1>
45 class comb : public ut_process
46 {
47 public:
50 
52  typedef std::function<void(std::vector<T0>&,
53  const std::vector<T1>&
55 
57 
61  comb(const sc_module_name& _name,
62  const functype& _func,
63  const unsigned int& i1toks
64  ) : ut_process(_name), iport1("iport1"), oport1("oport1"),
65  i1toks(i1toks), _func(_func)
66  {
67 #ifdef FORSYDE_INTROSPECTION
68  std::string func_name = std::string(basename());
69  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
70  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
71  arg_vec.push_back(std::make_tuple("i1toks",std::to_string(i1toks)));
72 #endif
73  }
74 
76  std::string forsyde_kind() const {return "UT::comb";}
77 
78 private:
79  // consumption rates
80  unsigned int i1toks;
81 
82  // Inputs and output variables
83  std::vector<T0> o1vals;
84  std::vector<T1> i1vals;
85 
87  functype _func;
88 
89  //Implementing the abstract semantics
90  void init()
91  {
92  i1vals.resize(i1toks);
93  }
94 
95  void prep()
96  {
97  for (auto it=i1vals.begin();it!=i1vals.end();it++)
98  *it = iport1.read();
99  }
100 
101  void exec()
102  {
103  _func(o1vals, i1vals);
104  }
105 
106  void prod()
107  {
108  WRITE_VEC_MULTIPORT(oport1, o1vals)
109  o1vals.clear();
110  }
111 
112  void clean() {}
113 
114 #ifdef FORSYDE_INTROSPECTION
115  void bindInfo()
116  {
117  boundInChans.resize(1); // only one input port
118  boundInChans[0].port = &iport1;
119  boundOutChans.resize(1); // only one output port
120  boundOutChans[0].port = &oport1;
121  }
122 #endif
123 };
124 
126 
128 template <typename T0, typename T1, typename T2>
129 class comb2 : public ut_process
130 {
131 public:
135 
137  typedef std::function<void(std::vector<T0>&,
138  const std::vector<T1>&,
139  const std::vector<T2>&
141 
143 
147  comb2(const sc_module_name& _name,
148  const functype& _func,
149  const unsigned int& i1toks,
150  const unsigned int& i2toks
151  ) : ut_process(_name), iport1("iport1"), iport2("iport2"), oport1("oport1"),
152  i1toks(i1toks), i2toks(i2toks), _func(_func)
153  {
154 #ifdef FORSYDE_INTROSPECTION
155  std::string func_name = std::string(basename());
156  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
157  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
158  arg_vec.push_back(std::make_tuple("i1toks",std::to_string(i1toks)));
159  arg_vec.push_back(std::make_tuple("i2toks",std::to_string(i2toks)));
160 #endif
161  }
162 
164  std::string forsyde_kind() const {return "UT::comb2";}
165 private:
166  // consumption rates
167  unsigned int i1toks, i2toks;
168 
169  // Inputs and output variables
170  std::vector<T0> o1vals;
171  std::vector<T1> i1vals;
172  std::vector<T2> i2vals;
173 
175  functype _func;
176 
177  //Implementing the abstract semantics
178  void init()
179  {
180  i1vals.resize(i1toks);
181  i2vals.resize(i2toks);
182  }
183 
184  void prep()
185  {
186  for (auto it=i1vals.begin();it!=i1vals.end();it++)
187  *it = iport1.read();
188  for (auto it=i2vals.begin();it!=i2vals.end();it++)
189  *it = iport2.read();
190  }
191 
192  void exec()
193  {
194  _func(o1vals, i1vals, i2vals);
195  }
196 
197  void prod()
198  {
199  WRITE_VEC_MULTIPORT(oport1, o1vals)
200  o1vals.clear();
201  }
202 
203  void clean() {}
204 
205 #ifdef FORSYDE_INTROSPECTION
206  void bindInfo()
207  {
208  boundInChans.resize(2); // only one input port
209  boundInChans[0].port = &iport1;
210  boundInChans[1].port = &iport2;
211  boundOutChans.resize(1); // only one output port
212  boundOutChans[0].port = &oport1;
213  }
214 #endif
215 };
216 
218 
220 template <typename T0, typename T1, typename T2, typename T3>
221 class comb3 : public ut_process
222 {
223 public:
228 
230  typedef std::function<void(std::vector<T0>&,
231  const std::vector<T1>&,
232  const std::vector<T2>&,
233  const std::vector<T3>&
235 
237 
241  comb3(const sc_module_name& _name,
242  const functype& _func,
243  const unsigned int& i1toks,
244  const unsigned int& i2toks,
245  const unsigned int& i3toks
246  ) : ut_process(_name), iport1("iport1"), iport2("iport2"), iport3("iport3"),
247  oport1("oport1"),
248  i1toks(i1toks), i2toks(i2toks), i3toks(i3toks), _func(_func)
249  {
250 #ifdef FORSYDE_INTROSPECTION
251  std::string func_name = std::string(basename());
252  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
253  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
254  arg_vec.push_back(std::make_tuple("i1toks",std::to_string(i1toks)));
255  arg_vec.push_back(std::make_tuple("i2toks",std::to_string(i2toks)));
256  arg_vec.push_back(std::make_tuple("i3toks",std::to_string(i3toks)));
257 #endif
258  }
259 
261  std::string forsyde_kind() const {return "UT::comb3";}
262 private:
263  // consumption rates
264  unsigned int i1toks, i2toks, i3toks;
265 
266  // Inputs and output variables
267  std::vector<T0> o1vals;
268  std::vector<T1> i1vals;
269  std::vector<T2> i2vals;
270  std::vector<T3> i3vals;
271 
273  functype _func;
274 
275  //Implementing the abstract semantics
276  void init()
277  {
278  i1vals.resize(i1toks);
279  i2vals.resize(i2toks);
280  i3vals.resize(i3toks);
281  }
282 
283  void prep()
284  {
285  for (auto it=i1vals.begin();it!=i1vals.end();it++)
286  *it = iport1.read();
287  for (auto it=i2vals.begin();it!=i2vals.end();it++)
288  *it = iport2.read();
289  for (auto it=i3vals.begin();it!=i3vals.end();it++)
290  *it = iport3.read();
291  }
292 
293  void exec()
294  {
295  _func(o1vals, i1vals, i2vals, i3vals);
296  }
297 
298  void prod()
299  {
300  WRITE_VEC_MULTIPORT(oport1, o1vals)
301  o1vals.clear();
302  }
303 
304  void clean() {}
305 
306 #ifdef FORSYDE_INTROSPECTION
307  void bindInfo()
308  {
309  boundInChans.resize(3); // only one input port
310  boundInChans[0].port = &iport1;
311  boundInChans[1].port = &iport2;
312  boundInChans[2].port = &iport3;
313  boundOutChans.resize(1); // only one output port
314  boundOutChans[0].port = &oport1;
315  }
316 #endif
317 };
318 
320 
322 template <typename T0, typename T1, typename T2, typename T3, typename T4>
323 class comb4 : public ut_process
324 {
325 public:
331 
333  typedef std::function<void(std::vector<T0>&,
334  const std::vector<T1>&,
335  const std::vector<T2>&,
336  const std::vector<T3>&,
337  const std::vector<T4>&
339 
341 
345  comb4(const sc_module_name& _name,
346  const functype& _func,
347  const unsigned int& i1toks,
348  const unsigned int& i2toks,
349  const unsigned int& i3toks,
350  const unsigned int& i4toks
351  ) : ut_process(_name), iport1("iport1"), iport2("iport2"), iport3("iport3"),
352  iport4("iport4"), oport1("oport1"),
353  i1toks(i1toks), i2toks(i2toks), i3toks(i3toks),
354  i4toks(i4toks), _func(_func)
355  {
356 #ifdef FORSYDE_INTROSPECTION
357  std::string func_name = std::string(basename());
358  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
359  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
360  arg_vec.push_back(std::make_tuple("i1toks",std::to_string(i1toks)));
361  arg_vec.push_back(std::make_tuple("i2toks",std::to_string(i2toks)));
362  arg_vec.push_back(std::make_tuple("i3toks",std::to_string(i3toks)));
363  arg_vec.push_back(std::make_tuple("i4toks",std::to_string(i4toks)));
364 #endif
365  }
366 
368  std::string forsyde_kind() const {return "UT::comb4";}
369 private:
370  // consumption rates
371  unsigned int i1toks, i2toks, i3toks, i4toks;
372 
373  // Inputs and output variables
374  std::vector<T0> o1vals;
375  std::vector<T1> i1vals;
376  std::vector<T2> i2vals;
377  std::vector<T3> i3vals;
378  std::vector<T4> i4vals;
379 
381  functype _func;
382 
383  //Implementing the abstract semantics
384  void init()
385  {
386  i1vals.resize(i1toks);
387  i2vals.resize(i2toks);
388  i3vals.resize(i3toks);
389  i4vals.resize(i4toks);
390  }
391 
392  void prep()
393  {
394  for (auto it=i1vals.begin();it!=i1vals.end();it++)
395  *it = iport1.read();
396  for (auto it=i2vals.begin();it!=i2vals.end();it++)
397  *it = iport2.read();
398  for (auto it=i3vals.begin();it!=i3vals.end();it++)
399  *it = iport3.read();
400  for (auto it=i4vals.begin();it!=i4vals.end();it++)
401  *it = iport4.read();
402  }
403 
404  void exec()
405  {
406  _func(o1vals, i1vals, i2vals, i3vals, i4vals);
407  }
408 
409  void prod()
410  {
411  WRITE_VEC_MULTIPORT(oport1, o1vals)
412  o1vals.clear();
413  }
414 
415  void clean() {}
416 
417 #ifdef FORSYDE_INTROSPECTION
418  void bindInfo()
419  {
420  boundInChans.resize(4); // only one input port
421  boundInChans[0].port = &iport1;
422  boundInChans[1].port = &iport2;
423  boundInChans[2].port = &iport3;
424  boundInChans[3].port = &iport4;
425  boundOutChans.resize(1); // only one output port
426  boundOutChans[0].port = &oport1;
427  }
428 #endif
429 };
430 
432 
441 template <class T>
442 class delay : public ut_process
443 {
444 public:
447 
449 
453  delay(const sc_module_name& _name,
454  const T& init_val
455  ) : ut_process(_name), iport1("iport1"), oport1("oport1"),
456  init_val(init_val)
457  {
458 #ifdef FORSYDE_INTROSPECTION
459  std::stringstream ss;
460  ss << init_val;
461  arg_vec.push_back(std::make_tuple("init_val", ss.str()));
462 #endif
463  }
464 
466  std::string forsyde_kind() const {return "UT::delay";}
467 
468 private:
469  // Initial value
470  T init_val;
471 
472  // Inputs and output variables
473  T* val;
474 
475  //Implementing the abstract semantics
476  void init()
477  {
478  val = new T;
479  WRITE_MULTIPORT(oport1, init_val)
480  }
481 
482  void prep()
483  {
484  *val = iport1.read();
485  }
486 
487  void exec() {}
488 
489  void prod()
490  {
491  WRITE_MULTIPORT(oport1, *val)
492  }
493 
494  void clean()
495  {
496  delete val;
497  }
498 #ifdef FORSYDE_INTROSPECTION
499  void bindInfo()
500  {
501  boundInChans.resize(1); // only one input port
502  boundInChans[0].port = &iport1;
503  boundOutChans.resize(1); // only one output port
504  boundOutChans[0].port = &oport1;
505  }
506 #endif
507 };
508 
510 
517 template <class T>
518 class delayn : public ut_process
519 {
520 public:
523 
525 
529  delayn(const sc_module_name& _name,
530  const T& init_val,
531  const unsigned int& n
532  ) : ut_process(_name), iport1("iport1"), oport1("oport1"),
533  init_val(init_val), ns(n)
534  {
535 #ifdef FORSYDE_INTROSPECTION
536  std::stringstream ss;
537  ss << init_val;
538  arg_vec.push_back(std::make_tuple("init_val", ss.str()));
539  arg_vec.push_back(std::make_tuple("n", std::to_string(n)));
540 #endif
541  }
542 
544  std::string forsyde_kind() const {return "UT::delayn";}
545 
546 private:
547  // Initial value
548  T init_val;
549  unsigned int ns;
550 
551  // Inputs and output variables
552  T* val;
553 
554  //Implementing the abstract semantics
555  void init()
556  {
557  val = new T;
558  for (unsigned int i=0; i<ns; i++)
559  WRITE_MULTIPORT(oport1, init_val)
560  }
561 
562  void prep()
563  {
564  *val = iport1.read();
565  }
566 
567  void exec() {}
568 
569  void prod()
570  {
571  WRITE_MULTIPORT(oport1, *val)
572  }
573 
574  void clean()
575  {
576  delete val;
577  }
578 #ifdef FORSYDE_INTROSPECTION
579  void bindInfo()
580  {
581  boundInChans.resize(1); // only one input port
582  boundInChans[0].port = &iport1;
583  boundOutChans.resize(1); // only one output port
584  boundOutChans[0].port = &oport1;
585  }
586 #endif
587 };
588 
589 
591 
596 template <class IT, class ST>
597 class scan : public ut_process
598 {
599 public:
602 
604  typedef std::function<void(unsigned int&, const ST&)> gamma_functype;
605 
607  typedef std::function<void(ST&, const ST&, const std::vector<IT>&)> ns_functype;
608 
610 
614  scan(const sc_module_name& _name,
615  const gamma_functype& _gamma_func,
616  const ns_functype& _ns_func,
617  const ST& init_st
618  ) : ut_process(_name), _gamma_func(_gamma_func), _ns_func(_ns_func),
619  init_st(init_st)
620  {
621 #ifdef FORSYDE_INTROSPECTION
622  std::string func_name = std::string(basename());
623  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
624  arg_vec.push_back(std::make_tuple("_gamma_func",func_name+std::string("_gamma_func")));
625  arg_vec.push_back(std::make_tuple("_ns_func",func_name+std::string("_ns_func")));
626  std::stringstream ss;
627  ss << init_st;
628  arg_vec.push_back(std::make_tuple("init_st",ss.str()));
629 #endif
630  }
631 
633  std::string forsyde_kind() const{return "UT::scan";}
634 
635 private:
637  gamma_functype _gamma_func;
638  ns_functype _ns_func;
639  // Initial state
640  ST init_st;
641 
642  // Input, output, current state, and next state variables
643  std::vector<IT> ivals;
644  ST* stval;
645  ST* nsval;
646 
647  //Implementing the abstract semantics
648  void init()
649  {
650  stval = new ST;
651  *stval = init_st;
652  nsval = new ST;
653  }
654 
655  void prep()
656  {
657  unsigned int itoks;
658  _gamma_func(itoks, *stval); // determine how many tokens to read
659  ivals.resize(itoks);
660  for (auto it=ivals.begin();it!=ivals.end();it++)
661  *it = iport1.read();
662  }
663 
664  void exec()
665  {
666  _ns_func(*nsval, *stval, ivals);
667  *stval = *nsval;
668  }
669 
670  void prod()
671  {
672  WRITE_MULTIPORT(oport1, *stval)
673  }
674 
675  void clean()
676  {
677  delete stval;
678  delete nsval;
679  }
680 #ifdef FORSYDE_INTROSPECTION
681  void bindInfo()
682  {
683  boundInChans.resize(1); // only one input port
684  boundInChans[0].port = &iport1;
685  boundOutChans.resize(1); // only one output port
686  boundOutChans[0].port = &oport1;
687  }
688 #endif
689 };
690 
692 
697 template <class IT, class ST>
698 class scand : public ut_process
699 {
700 public:
703 
705  typedef std::function<void(unsigned int&, const ST&)> gamma_functype;
706 
708  typedef std::function<void(ST&, const ST&, const std::vector<IT>&)> ns_functype;
709 
711 
715  scand(const sc_module_name& _name,
716  const gamma_functype& _gamma_func,
717  const ns_functype& _ns_func,
718  const ST& init_st
719  ) : ut_process(_name), _gamma_func(_gamma_func), _ns_func(_ns_func),
720  init_st(init_st)
721  {
722 #ifdef FORSYDE_INTROSPECTION
723  std::string func_name = std::string(basename());
724  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
725  arg_vec.push_back(std::make_tuple("_gamma_func",func_name+std::string("_gamma_func")));
726  arg_vec.push_back(std::make_tuple("_ns_func",func_name+std::string("_ns_func")));
727  std::stringstream ss;
728  ss << init_st;
729  arg_vec.push_back(std::make_tuple("init_st",ss.str()));
730 #endif
731  }
732 
734  std::string forsyde_kind() const{return "UT::scan";}
735 
736 private:
738  gamma_functype _gamma_func;
739  ns_functype _ns_func;
740  // Initial state
741  ST init_st;
742 
743  bool first_run;
744 
745  // Input, output, current state, and next state variables
746  std::vector<IT> ivals;
747  ST* stval;
748  ST* nsval;
749 
750  //Implementing the abstract semantics
751  void init()
752  {
753  stval = new ST;
754  *stval = init_st;
755  nsval = new ST;
756  // First evaluation cycle
757  first_run = true;
758  }
759 
760  void prep()
761  {
762  // We do not read anything in the first cycle since we can produce the output.
763  if (!first_run)
764  {
765  unsigned int itoks;
766  _gamma_func(itoks, *stval); // determine how many tokens to read
767  ivals.resize(itoks);
768  for (auto it=ivals.begin();it!=ivals.end();it++)
769  *it = iport1.read();
770  }
771  }
772 
773  void exec()
774  {
775  // Compute only the output in the first iteration.
776  if (!first_run)
777  {
778  _ns_func(*nsval, *stval, ivals);
779  *stval = *nsval;
780  }
781  else
782  {
783  first_run = false;
784  }
785  }
786 
787  void prod()
788  {
789  WRITE_MULTIPORT(oport1, *stval)
790  }
791 
792  void clean()
793  {
794  delete stval;
795  delete nsval;
796  }
797 #ifdef FORSYDE_INTROSPECTION
798  void bindInfo()
799  {
800  boundInChans.resize(1); // only one input port
801  boundInChans[0].port = &iport1;
802  boundOutChans.resize(1); // only one output port
803  boundOutChans[0].port = &oport1;
804  }
805 #endif
806 };
807 
809 
813 template <class IT, class ST, class OT>
814 class moore : public ut_process
815 {
816 public:
819 
821  typedef std::function<void(unsigned int&, const ST&)> gamma_functype;
822 
824  typedef std::function<void(ST&, const ST&, const std::vector<IT>&)> ns_functype;
825 
827  typedef std::function<void(std::vector<OT>&, const ST&)> od_functype;
828 
830 
834  moore(const sc_module_name& _name,
835  const gamma_functype& _gamma_func,
836  const ns_functype& _ns_func,
837  const od_functype& _od_func,
838  const ST& init_st
839  ) : ut_process(_name), _gamma_func(_gamma_func), _ns_func(_ns_func),
840  _od_func(_od_func), init_st(init_st)
841  {
842 #ifdef FORSYDE_INTROSPECTION
843  std::string func_name = std::string(basename());
844  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
845  arg_vec.push_back(std::make_tuple("_gamma_func",func_name+std::string("_gamma_func")));
846  arg_vec.push_back(std::make_tuple("_ns_func",func_name+std::string("_ns_func")));
847  arg_vec.push_back(std::make_tuple("_od_func",func_name+std::string("_od_func")));
848  std::stringstream ss;
849  ss << init_st;
850  arg_vec.push_back(std::make_tuple("init_st",ss.str()));
851 #endif
852  }
853 
855  std::string forsyde_kind() const{return "UT::moore";}
856 
857 private:
859  gamma_functype _gamma_func;
860  ns_functype _ns_func;
861  od_functype _od_func;
862  // Initial state
863  ST init_st;
864 
865  bool first_run;
866 
867  // Input, output, current state, and next state variables
868  std::vector<IT> ivals;
869  ST* stval;
870  ST* nsval;
871  std::vector<OT> ovals;
872 
873  //Implementing the abstract semantics
874  void init()
875  {
876  stval = new ST;
877  *stval = init_st;
878  nsval = new ST;
879  // First evaluation cycle
880  first_run = true;
881  }
882 
883  void prep()
884  {
885  // We do not read anything in the first cycle since we can produce the output.
886  if (!first_run)
887  {
888  unsigned int itoks;
889  _gamma_func(itoks, *stval); // determine how many tokens to read
890  ivals.resize(itoks);
891  for (auto it=ivals.begin();it!=ivals.end();it++)
892  *it = iport1.read();
893  }
894  }
895 
896  void exec()
897  {
898  // Compute only the output in the first iteration.
899  if (!first_run)
900  {
901  _ns_func(*nsval, *stval, ivals);
902  _od_func(ovals, *stval);
903  *stval = *nsval;
904  }
905  else
906  {
907  first_run = false;
908  _od_func(ovals, *stval);
909  }
910  }
911 
912  void prod()
913  {
914  WRITE_VEC_MULTIPORT(oport1, ovals)
915  ovals.clear();
916  }
917 
918  void clean()
919  {
920  delete stval;
921  delete nsval;
922  }
923 #ifdef FORSYDE_INTROSPECTION
924  void bindInfo()
925  {
926  boundInChans.resize(1); // only one input port
927  boundInChans[0].port = &iport1;
928  boundOutChans.resize(1); // only one output port
929  boundOutChans[0].port = &oport1;
930  }
931 #endif
932 };
933 
935 
939 template <class IT, class ST, class OT>
940 class mealy : public ut_process
941 {
942 public:
945 
947  typedef std::function<void(unsigned int&, const ST&)> gamma_functype;
948 
950  typedef std::function<void(ST&, const ST&, const std::vector<IT>&)> ns_functype;
951 
953  typedef std::function<void(std::vector<OT>&, const ST&,
954  const std::vector<IT>&)> od_functype;
955 
957 
961  mealy(const sc_module_name& _name,
962  const gamma_functype& _gamma_func,
963  const ns_functype& _ns_func,
964  const od_functype& _od_func,
965  const ST& init_st
966  ) : ut_process(_name), _gamma_func(_gamma_func), _ns_func(_ns_func),
967  _od_func(_od_func), init_st(init_st)
968  {
969 #ifdef FORSYDE_INTROSPECTION
970  std::string func_name = std::string(basename());
971  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
972  arg_vec.push_back(std::make_tuple("_gamma_func",func_name+std::string("_gamma_func")));
973  arg_vec.push_back(std::make_tuple("_ns_func",func_name+std::string("_ns_func")));
974  arg_vec.push_back(std::make_tuple("_od_func",func_name+std::string("_od_func")));
975  std::stringstream ss;
976  ss << init_st;
977  arg_vec.push_back(std::make_tuple("init_st",ss.str()));
978 #endif
979  }
980 
982  std::string forsyde_kind() const{return "UT::mealy";}
983 
984 private:
986  gamma_functype _gamma_func;
987  ns_functype _ns_func;
988  od_functype _od_func;
989  // Initial value
990  ST init_st;
991 
992  // Input, output, current state, and next state variables
993  std::vector<IT> ivals;
994  ST* stval;
995  ST* nsval;
996  std::vector<OT> ovals;
997 
998  //Implementing the abstract semantics
999  void init()
1000  {
1001  stval = new ST;
1002  *stval = init_st;
1003  nsval = new ST;
1004  }
1005 
1006  void prep()
1007  {
1008  unsigned int itoks;
1009  _gamma_func(itoks, *stval); // determine how many tokens to read
1010  ivals.resize(itoks);
1011  for (auto it=ivals.begin();it!=ivals.end();it++)
1012  *it = iport1.read();
1013  }
1014 
1015  void exec()
1016  {
1017  _ns_func(*nsval, *stval, ivals);
1018  _od_func(ovals, *stval, ivals);
1019  *stval = *nsval;
1020  }
1021 
1022  void prod()
1023  {
1024  WRITE_VEC_MULTIPORT(oport1, ovals)
1025  ovals.clear();
1026  }
1027 
1028  void clean()
1029  {
1030  delete stval;
1031  delete nsval;
1032  }
1033 #ifdef FORSYDE_INTROSPECTION
1034  void bindInfo()
1035  {
1036  boundInChans.resize(1); // only one input port
1037  boundInChans[0].port = &iport1;
1038  boundOutChans.resize(1); // only one output port
1039  boundOutChans[0].port = &oport1;
1040  }
1041 #endif
1042 };
1043 
1045 
1050 template <class T>
1051 class constant : public ut_process
1052 {
1053 public:
1055 
1057 
1060  constant(const sc_module_name& _name,
1061  const T& init_val,
1062  const unsigned long long& take=0
1063  ) : ut_process(_name), oport1("oport1"),
1064  init_val(init_val), take(take)
1065 
1066  {
1067 #ifdef FORSYDE_INTROSPECTION
1068  std::stringstream ss;
1069  ss << init_val;
1070  arg_vec.push_back(std::make_tuple("init_val", ss.str()));
1071  arg_vec.push_back(std::make_tuple("take", std::to_string(take)));
1072 #endif
1073  }
1074 
1076  std::string forsyde_kind() const {return "UT::constant";}
1077 
1078 private:
1079  T init_val;
1080  unsigned long long take; // Number of tokens produced
1081 
1082  unsigned long long tok_cnt;
1083  bool infinite;
1084 
1085  //Implementing the abstract semantics
1086  void init()
1087  {
1088  if (take==0) infinite = true;
1089  tok_cnt = 0;
1090  }
1091 
1092  void prep() {}
1093 
1094  void exec() {}
1095 
1096  void prod()
1097  {
1098  if (tok_cnt++ < take || infinite)
1099  WRITE_MULTIPORT(oport1, init_val)
1100  else wait();
1101  }
1102 
1103  void clean() {}
1104 
1105 #ifdef FORSYDE_INTROSPECTION
1106  void bindInfo()
1107  {
1108  boundOutChans.resize(1); // only one output port
1109  boundOutChans[0].port = &oport1;
1110  }
1111 #endif
1112 };
1113 
1115 
1120 template <class T>
1121 class source : public ut_process
1122 {
1123 public:
1125 
1127  typedef std::function<void(T&, const T&)> functype;
1128 
1130 
1133  source(const sc_module_name& _name,
1134  const functype& _func,
1135  const T& init_val,
1136  const unsigned long long& take=0
1137  ) : ut_process(_name), oport1("oport1"),
1138  init_st(init_val), take(take), _func(_func)
1139  {
1140 #ifdef FORSYDE_INTROSPECTION
1141  std::string func_name = std::string(basename());
1142  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
1143  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
1144  std::stringstream ss;
1145  ss << init_val;
1146  arg_vec.push_back(std::make_tuple("init_val", ss.str()));
1147  arg_vec.push_back(std::make_tuple("take", std::to_string(take)));
1148 #endif
1149  }
1150 
1152  std::string forsyde_kind() const {return "UT::source";}
1153 
1154 private:
1155  T init_st; // The current state
1156  unsigned long long take; // Number of tokens produced
1157 
1158  T* cur_st; // The current state of the process
1159  unsigned long long tok_cnt;
1160  bool infinite;
1161 
1163  functype _func;
1164 
1165  //Implementing the abstract semantics
1166  void init()
1167  {
1168  cur_st = new T;
1169  *cur_st = init_st;
1170  WRITE_MULTIPORT(oport1, *cur_st)
1171  if (take==0) infinite = true;
1172  tok_cnt = 1;
1173  }
1174 
1175  void prep() {}
1176 
1177  void exec()
1178  {
1179  _func(*cur_st, *cur_st);
1180  }
1181 
1182  void prod()
1183  {
1184  if (tok_cnt++ < take || infinite)
1185  WRITE_MULTIPORT(oport1, *cur_st)
1186  else wait();
1187  }
1188 
1189  void clean()
1190  {
1191  delete cur_st;
1192  }
1193 
1194 #ifdef FORSYDE_INTROSPECTION
1195  void bindInfo()
1196  {
1197  boundOutChans.resize(1); // only one output port
1198  boundOutChans[0].port = &oport1;
1199  }
1200 #endif
1201 };
1202 
1204 
1208 template <class OTYP>
1209 class vsource : public sc_module
1210 {
1211 public:
1212  sc_fifo_out<OTYP> oport1;
1213 
1215 
1218  vsource(const sc_module_name& _name,
1219  const std::vector<OTYP>& invec
1220  )
1221  :sc_module(_name), in_vec(invec)
1222  {
1223  SC_THREAD(worker);
1224  }
1225 private:
1226  std::vector<OTYP> in_vec;
1227  SC_HAS_PROCESS(vsource);
1228 
1230  void worker()
1231  {
1232  typename std::vector<OTYP>::iterator itr;
1233  for (itr=in_vec.begin();itr!=in_vec.end();itr++)
1234  {
1235  OTYP out_val = *itr;
1236  WRITE_MULTIPORT(oport1,out_val) // write to the output
1237  }
1238  }
1239 };
1240 
1242 
1246 template <class T>
1247 class sink : public ut_process
1248 {
1249 public:
1251 
1253  typedef std::function<void(const T&)> functype;
1254 
1256 
1259  sink(const sc_module_name& _name,
1260  const functype& _func
1261  ) : ut_process(_name), iport1("iport1"), _func(_func)
1262 
1263  {
1264 #ifdef FORSYDE_INTROSPECTION
1265  std::string func_name = std::string(basename());
1266  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
1267  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
1268 #endif
1269  }
1270 
1272  std::string forsyde_kind() const {return "UT::sink";}
1273 
1274 private:
1275  T* val; // The current state of the process
1276 
1278  functype _func;
1279 
1280  //Implementing the abstract semantics
1281  void init()
1282  {
1283  val = new T;
1284  }
1285 
1286  void prep()
1287  {
1288  *val = iport1.read();
1289  }
1290 
1291  void exec()
1292  {
1293  _func(*val);
1294  }
1295 
1296  void prod() {}
1297 
1298  void clean()
1299  {
1300  delete val;
1301  }
1302 
1303 #ifdef FORSYDE_INTROSPECTION
1304  void bindInfo()
1305  {
1306  boundInChans.resize(1); // only one output port
1307  boundInChans[0].port = &iport1;
1308  }
1309 #endif
1310 };
1311 
1313 
1315 template <class T1, class T2>
1316 class zip : public ut_process
1317 {
1318 public:
1322 
1324 
1327  zip(const sc_module_name& _name,
1328  const unsigned int& i1toks,
1329  const unsigned int& i2toks
1330  ) : ut_process(_name), iport1("iport1"), iport2("iport2"), oport1("oport1"),
1331  i1toks(i1toks), i2toks(i2toks)
1332  { }
1333 
1335  std::string forsyde_kind() const {return "UT::zip";}
1336 
1337 private:
1338  unsigned int i1toks, i2toks;
1339  // intermediate values
1340  std::vector<T1> i1vals;
1341  std::vector<T2> i2vals;
1342 
1343  void init()
1344  {
1345  i1vals.resize(i1toks);
1346  i2vals.resize(i2toks);
1347  }
1348 
1349  void prep()
1350  {
1351  for (auto it=i1vals.begin();it!=i1vals.end();it++)
1352  *it = iport1.read();
1353  for (auto it=i2vals.begin();it!=i2vals.end();it++)
1354  *it = iport2.read();
1355  }
1356 
1357  void exec() {}
1358 
1359  void prod()
1360  {
1361  WRITE_MULTIPORT(oport1,std::make_tuple(i1vals,i2vals)) // write to the output
1362  }
1363 
1364  void clean() {}
1365 
1366 #ifdef FORSYDE_INTROSPECTION
1367  void bindInfo()
1368  {
1369  boundInChans.resize(2); // two input ports
1370  boundInChans[0].port = &iport1;
1371  boundInChans[1].port = &iport2;
1372  boundOutChans.resize(1); // only one output port
1373  boundOutChans[0].port = &oport1;
1374  }
1375 #endif
1376 };
1377 
1379 
1381 template <class... Ts>
1382 class zipN : public ut_process
1383 {
1384 public:
1385  std::tuple <UT_in<Ts>...> iport;
1387 
1389 
1392  zipN(const sc_module_name& _name,
1393  const std::vector<unsigned>& in_toks)
1394  :ut_process(_name), in_toks(in_toks), oport1("iport1")
1395  {
1396  if (in_toks.size()!=sizeof...(Ts))
1397  SC_REPORT_ERROR(name(),"Wrong number of production rates provided");
1398 #ifdef FORSYDE_INTROSPECTION
1399  std::stringstream ss;
1400  ss << in_toks;
1401  arg_vec.push_back(std::make_tuple("itoks",ss.str()));
1402 #endif
1403  }
1404 
1406  std::string forsyde_kind() const {return "UT::zipN";}
1407 private:
1408  std::vector<unsigned> in_toks;
1409  // intermediate values
1410  std::tuple<std::vector<Ts>...>* in_val;
1411 
1412  void init()
1413  {
1414  in_val = new std::tuple<std::vector<Ts>...>;
1415  }
1416 
1417  void prep()
1418  {
1419  *in_val = sc_fifo_tuple_read<Ts...>(iport, in_toks);
1420  }
1421 
1422  void exec() {}
1423 
1424  void prod()
1425  {
1426  WRITE_MULTIPORT(oport1,*in_val); // write to the output
1427  }
1428 
1429  void clean()
1430  {
1431  delete in_val;
1432  }
1433 
1434  template<size_t N,class R, class T>
1435  struct fifo_read_helper
1436  {
1437  static void read(R& ret, T& t, const std::vector<unsigned int>& itoks)
1438  {
1439  fifo_read_helper<N-1,R,T>::read(ret,t,itoks);
1440  for (unsigned int i=0;i<itoks[N];i++)
1441  std::get<N>(ret).push_back(std::get<N>(t).read());
1442  }
1443  };
1444 
1445  template<class R, class T>
1446  struct fifo_read_helper<0,R,T>
1447  {
1448  static void read(R& ret, T& t, const std::vector<unsigned int>& itoks)
1449  {
1450  for (unsigned int i=0;i<itoks[0];i++)
1451  std::get<0>(ret).push_back(std::get<0>(t).read());
1452  }
1453  };
1454 
1455  template<class... T>
1456  std::tuple<std::vector<T>...> sc_fifo_tuple_read(std::tuple<UT_in<T>...>& ports,
1457  const std::vector<unsigned int>& itoks)
1458  {
1459  std::tuple<std::vector<T>...> ret;
1460  fifo_read_helper<sizeof...(T)-1,
1461  std::tuple<std::vector<T>...>,
1462  std::tuple<UT_in<T>...>>::read(ret,ports,itoks);
1463  return ret;
1464  }
1465 
1466 #ifdef FORSYDE_INTROSPECTION
1467  void bindInfo()
1468  {
1469  boundInChans.resize(sizeof...(Ts)); // two output ports
1470  register_ports(boundInChans, iport);
1471  boundOutChans.resize(1); // only one input port
1472  boundInChans[0].port = &oport1;
1473  }
1474 
1475  template<size_t N, class T>
1476  struct register_ports_helper
1477  {
1478  static void reg_port(std::vector<PortInfo>& boundChans, T& t)
1479  {
1480  register_ports_helper<N-1,T>::reg_port(boundChans,t);
1481  boundChans[N].port = &std::get<N>(t);
1482  }
1483  };
1484 
1485  template<class T>
1486  struct register_ports_helper<0,T>
1487  {
1488  static void reg_port(std::vector<PortInfo>& boundChans, T& t)
1489  {
1490  boundChans[0].port = &std::get<0>(t);
1491  }
1492  };
1493 
1494  template<class... T>
1495  void register_ports(std::vector<PortInfo>& boundChans,
1496  std::tuple<UT_in<T>...>& ports)
1497  {
1498  register_ports_helper<sizeof...(T)-1,
1499  std::tuple<UT_in<T>...>&>::reg_port(boundChans,ports);
1500  }
1501 #endif
1502 
1503 };
1504 
1506 
1508 template <class T1, class T2>
1509 class unzip : public ut_process
1510 {
1511 public:
1515 
1517 
1520  unzip(const sc_module_name& _name
1521  ) : ut_process(_name),
1522  iport1("iport1"), oport1("oport1"), oport2("oport2") {}
1523 
1525  std::string forsyde_kind() const {return "UT::unzip";}
1526 private:
1527  // intermediate values
1528  std::tuple<std::vector<T1>,std::vector<T2>>* in_val;
1529 
1530  void init()
1531  {
1532  in_val = new std::tuple<std::vector<T1>,std::vector<T2>>;
1533  }
1534 
1535  void prep()
1536  {
1537  *in_val = iport1.read();
1538  }
1539 
1540  void exec() {}
1541 
1542  void prod()
1543  {
1544 
1545  WRITE_VEC_MULTIPORT(oport1,std::get<0>(*in_val)) // write to the output 1
1546  WRITE_VEC_MULTIPORT(oport2,std::get<1>(*in_val)) // write to the output 2
1547  }
1548 
1549  void clean()
1550  {
1551  delete in_val;
1552  }
1553 
1554 #ifdef FORSYDE_INTROSPECTION
1555  void bindInfo()
1556  {
1557  boundInChans.resize(1); // only one input port
1558  boundInChans[0].port = &iport1;
1559  boundOutChans.resize(2); // two output ports
1560  boundOutChans[0].port = &oport1;
1561  boundOutChans[1].port = &oport2;
1562  }
1563 #endif
1564 };
1565 
1567 
1569 template <class... Ts>
1570 class unzipN : public ut_process
1571 {
1572 public:
1574  std::tuple<UT_out<Ts>...> oport;
1575 
1577 
1580  unzipN(const sc_module_name& _name
1581  ) : ut_process(_name), iport1("iport1") {}
1582 
1584  std::string forsyde_kind() const {return "UT::unzipN";}
1585 private:
1586  // intermediate values
1587  std::tuple<std::vector<Ts>...>* in_val;
1588 
1589  void init()
1590  {
1591  in_val = new std::tuple<std::vector<Ts>...>;
1592  }
1593 
1594  void prep()
1595  {
1596  *in_val = iport1.read();
1597  }
1598 
1599  void exec() {}
1600 
1601  void prod()
1602  {
1603  fifo_tuple_write<Ts...>(*in_val, oport);
1604  }
1605 
1606  void clean()
1607  {
1608  delete in_val;
1609  }
1610 
1611  template<size_t N,class R, class T>
1612  struct fifo_write_helper
1613  {
1614  static void write(const R& vals, T& t)
1615  {
1616  fifo_write_helper<N-1,R,T>::write(vals,t);
1617  for (unsigned int i=0;i<(std::get<N>(vals)).size();i++)
1618  std::get<N>(t).write(std::get<N>(vals)[i]);
1619  }
1620  };
1621 
1622  template<class R, class T>
1623  struct fifo_write_helper<0,R,T>
1624  {
1625  static void write(const R& vals, T& t)
1626  {
1627  for (unsigned int i=0;i<(std::get<0>(vals)).size();i++)
1628  std::get<0>(t).write(std::get<0>(vals)[i]);
1629  }
1630  };
1631 
1632  template<class... T>
1633  void fifo_tuple_write(const std::tuple<std::vector<T>...>& vals,
1634  std::tuple<UT_out<T>...>& ports)
1635  {
1636  fifo_write_helper<sizeof...(T)-1,
1637  std::tuple<std::vector<T>...>,
1638  std::tuple<UT_out<T>...>>::write(vals,ports);
1639  }
1640 
1641 #ifdef FORSYDE_INTROSPECTION
1642  void bindInfo()
1643  {
1644  boundInChans.resize(1); // only one input port
1645  boundInChans[0].port = &iport1;
1646  boundOutChans.resize(sizeof...(Ts)); // two output ports
1647  register_ports(boundOutChans, oport);
1648  }
1649 
1650  template<size_t N, class T>
1651  struct register_ports_helper
1652  {
1653  static void reg_port(std::vector<PortInfo>& boundChans, T& t)
1654  {
1655  register_ports_helper<N-1,T>::reg_port(boundChans,t);
1656  boundChans[N].port = &std::get<N>(t);
1657  }
1658  };
1659 
1660  template<class T>
1661  struct register_ports_helper<0,T>
1662  {
1663  static void reg_port(std::vector<PortInfo>& boundChans, T& t)
1664  {
1665  boundChans[0].port = &std::get<0>(t);
1666  }
1667  };
1668 
1669  template<class... T>
1670  void register_ports(std::vector<PortInfo>& boundChans,
1671  std::tuple<UT_out<T>...>& ports)
1672  {
1673  register_ports_helper<sizeof...(T)-1,
1674  std::tuple<UT_out<T>...>&>::reg_port(boundChans,ports);
1675  }
1676 #endif
1677 
1678 };
1679 
1681 
1690 template <class T>
1691 class fanout : public ut_process
1692 {
1693 public:
1696 
1698 
1701  fanout(const sc_module_name& _name) // module name
1702  : ut_process(_name) { }
1703 
1705  std::string forsyde_kind() const {return "UT::fanout";}
1706 
1707 private:
1708  // Inputs and output variables
1709  T* val;
1710 
1711  //Implementing the abstract semantics
1712  void init()
1713  {
1714  val = new T;
1715  }
1716 
1717  void prep()
1718  {
1719  *val = iport1.read();
1720  }
1721 
1722  void exec() {}
1723 
1724  void prod()
1725  {
1726  WRITE_MULTIPORT(oport1, *val)
1727  }
1728 
1729  void clean()
1730  {
1731  delete val;
1732  }
1733 #ifdef FORSYDE_INTROSPECTION
1734  void bindInfo()
1735  {
1736  boundInChans.resize(1); // only one input port
1737  boundInChans[0].port = &iport1;
1738  boundOutChans.resize(1); // only one output port
1739  boundOutChans[0].port = &oport1;
1740  }
1741 #endif
1742 };
1743 
1744 }
1745 }
1746 
1747 #endif
UT_out< std::tuple< std::vector< Ts >... > > oport1
port for the output channel
Definition: ut_process_constructors.hpp:1386
UT_in< T > iport1
port for the input channel
Definition: ut_process_constructors.hpp:521
UT_out< std::tuple< std::vector< T1 >, std::vector< T2 > > > oport1
port for the output channel
Definition: ut_process_constructors.hpp:1321
UT_in< T1 > iport1
port for the input channel
Definition: ut_process_constructors.hpp:48
UT_in< T1 > iport1
port for the input channel 1
Definition: ut_process_constructors.hpp:1319
comb3(const sc_module_name &_name, const functype &_func, const unsigned int &i1toks, const unsigned int &i2toks, const unsigned int &i3toks)
The constructor requires the module name.
Definition: ut_process_constructors.hpp:241
UT_in< IT > iport1
port for the input channel
Definition: ut_process_constructors.hpp:817
vsource(const sc_module_name &_name, const std::vector< OTYP > &invec)
The constructor requires the module name.
Definition: ut_process_constructors.hpp:1218
UT_in< T > iport1
port for the input channel
Definition: ut_process_constructors.hpp:1694
The zip process with two inputs and one output.
Definition: ut_process_constructors.hpp:1316
UT_in< T2 > iport2
port for the input channel 2
Definition: ut_process_constructors.hpp:1320
std::function< void(unsigned int &, const ST &)> gamma_functype
Type of the partitioning function to be passed to the process constructor.
Definition: ut_process_constructors.hpp:947
The unzip process with one input and variable number of outputs.
Definition: ut_process_constructors.hpp:1570
std::tuple< UT_out< Ts >... > oport
tuple of ports for the output channels
Definition: ut_process_constructors.hpp:1574
UT_in< IT > iport1
port for the input channel
Definition: ut_process_constructors.hpp:600
std::function< void(std::vector< T0 > &, const std::vector< T1 > &)> functype
Type of the function to be passed to the process constructor.
Definition: ut_process_constructors.hpp:54
UT_out< T0 > oport1
port for the output channel
Definition: ut_process_constructors.hpp:134
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: ut_process_constructors.hpp:1406
UT_in< std::tuple< std::vector< T1 >, std::vector< T2 > > > iport1
port for the input channel
Definition: ut_process_constructors.hpp:1512
std::function< void(ST &, const ST &, const std::vector< IT > &)> ns_functype
Type of the next-state function to be passed to the process constructor.
Definition: ut_process_constructors.hpp:708
The namespace for ForSyDe.
Definition: abssemantics.hpp:30
Process constructor for a Mealy machine.
Definition: ut_process_constructors.hpp:940
std::function< void(unsigned int &, const ST &)> gamma_functype
Type of the partitioning function to be passed to the process constructor.
Definition: ut_process_constructors.hpp:821
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: ut_process_constructors.hpp:982
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: ut_process_constructors.hpp:140
UT_out< ST > oport1
port for the output channel
Definition: ut_process_constructors.hpp:601
Process constructor for a fan-out process with one input and one output.
Definition: ut_process_constructors.hpp:1691
UT_in< T > iport1
port for the input channel
Definition: ut_process_constructors.hpp:445
std::function< void(std::vector< OT > &, const ST &)> od_functype
Type of the output-decoding function to be passed to the process constructor.
Definition: ut_process_constructors.hpp:827
UT_out< T > oport1
port for the output channel
Definition: ut_process_constructors.hpp:522
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: ut_process_constructors.hpp:1272
UT_in< T2 > iport2
port for the input channel 2
Definition: ut_process_constructors.hpp:133
UT_out< T1 > oport1
port for the output channel 1
Definition: ut_process_constructors.hpp:1513
UT_in< T1 > iport1
port for the input channel 1
Definition: ut_process_constructors.hpp:132
UT_in< IT > iport1
port for the input channel
Definition: ut_process_constructors.hpp:943
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: ut_process_constructors.hpp:261
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: ut_process_constructors.hpp:1705
Process constructor for a Moore machine.
Definition: ut_process_constructors.hpp:814
UT_out< T > oport1
port for the output channel
Definition: ut_process_constructors.hpp:1695
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: ut_process_constructors.hpp:234
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: ut_process_constructors.hpp:368
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: ut_process_constructors.hpp:1152
source(const sc_module_name &_name, const functype &_func, const T &init_val, const unsigned long long &take=0)
The constructor requires the module name.
Definition: ut_process_constructors.hpp:1133
zipN(const sc_module_name &_name, const std::vector< unsigned > &in_toks)
The constructor requires the module name.
Definition: ut_process_constructors.hpp:1392
The unzip process with one input and two outputs.
Definition: ut_process_constructors.hpp:1509
UT_out< T0 > oport1
port for the output channel
Definition: ut_process_constructors.hpp:330
mealy(const sc_module_name &_name, const gamma_functype &_gamma_func, const ns_functype &_ns_func, const od_functype &_od_func, const ST &init_st)
The constructor requires the module name.
Definition: ut_process_constructors.hpp:961
UT_in< T3 > iport3
port for the input channel 3
Definition: ut_process_constructors.hpp:328
Process constructor for a combinational process with two inputs and one output.
Definition: ut_process_constructors.hpp:323
UT_out< OT > oport1
port for the output channel
Definition: ut_process_constructors.hpp:818
UT_in< T1 > iport1
port for the input channel 1
Definition: ut_process_constructors.hpp:224
sink(const sc_module_name &_name, const functype &_func)
The constructor requires the module name.
Definition: ut_process_constructors.hpp:1259
Implements the abstract process in the UT Model of Computation.
UT_out< ST > oport1
port for the output channel
Definition: ut_process_constructors.hpp:702
UT_out< T2 > oport2
port for the output channel 2
Definition: ut_process_constructors.hpp:1514
scand(const sc_module_name &_name, const gamma_functype &_gamma_func, const ns_functype &_ns_func, const ST &init_st)
The constructor requires the module name.
Definition: ut_process_constructors.hpp:715
scan(const sc_module_name &_name, const gamma_functype &_gamma_func, const ns_functype &_ns_func, const ST &init_st)
The constructor requires the module name.
Definition: ut_process_constructors.hpp:614
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: ut_process_constructors.hpp:1076
std::function< void(unsigned int &, const ST &)> gamma_functype
Type of the partitioning function to be passed to the process constructor.
Definition: ut_process_constructors.hpp:705
UT_out< T0 > oport1
port for the output channel
Definition: ut_process_constructors.hpp:227
UT_out< T0 > oport1
port for the output channel
Definition: ut_process_constructors.hpp:49
Process constructor for a sink process.
Definition: ut_process_constructors.hpp:1247
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: ut_process_constructors.hpp:633
UT_out< OT > oport1
port for the output channel
Definition: ut_process_constructors.hpp:944
std::function< void(const T &)> functype
Type of the function to be passed to the process constructor.
Definition: ut_process_constructors.hpp:1253
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: ut_process_constructors.hpp:734
UT_in< T4 > iport4
port for the input channel 4
Definition: ut_process_constructors.hpp:329
UT_in< IT > iport1
port for the input channel
Definition: ut_process_constructors.hpp:701
fanout(const sc_module_name &_name)
The constructor requires the module name.
Definition: ut_process_constructors.hpp:1701
comb(const sc_module_name &_name, const functype &_func, const unsigned int &i1toks)
The constructor requires the module name ad the number of tokens to be produced.
Definition: ut_process_constructors.hpp:61
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: ut_process_constructors.hpp:164
Process constructor for a combinational process with two inputs and one output.
Definition: ut_process_constructors.hpp:221
moore(const sc_module_name &_name, const gamma_functype &_gamma_func, const ns_functype &_ns_func, const od_functype &_od_func, const ST &init_st)
The constructor requires the module name.
Definition: ut_process_constructors.hpp:834
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: ut_process_constructors.hpp:1335
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: ut_process_constructors.hpp:544
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: ut_process_constructors.hpp:338
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: ut_process_constructors.hpp:466
UT_in< T3 > iport3
port for the input channel 3
Definition: ut_process_constructors.hpp:226
std::function< void(std::vector< OT > &, const ST &, const std::vector< IT > &)> od_functype
Type of the output-decoding function to be passed to the process constructor.
Definition: ut_process_constructors.hpp:954
The process constructor which defines the abstract semantics of execution.
Definition: abssemantics.hpp:212
Process constructor for a source process with vector input.
Definition: ut_process_constructors.hpp:1209
UT_in< T1 > iport1
port for the input channel 1
Definition: ut_process_constructors.hpp:326
UT_in< T2 > iport2
port for the input channel 2
Definition: ut_process_constructors.hpp:327
Process constructor for a scand process.
Definition: ut_process_constructors.hpp:698
Process constructor for a combinational process with two inputs and one output.
Definition: ut_process_constructors.hpp:129
sc_fifo_out< OTYP > oport1
port for the output channel
Definition: ut_process_constructors.hpp:1212
The zip process with variable number of inputs and one output.
Definition: ut_process_constructors.hpp:1382
UT_in< std::tuple< std::vector< Ts >... > > iport1
port for the input channel
Definition: ut_process_constructors.hpp:1573
constant(const sc_module_name &_name, const T &init_val, const unsigned long long &take=0)
The constructor requires the module name.
Definition: ut_process_constructors.hpp:1060
Process constructor for a constant source process.
Definition: ut_process_constructors.hpp:1051
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: ut_process_constructors.hpp:855
std::function< void(ST &, const ST &, const std::vector< IT > &)> ns_functype
Type of the next-state function to be passed to the process constructor.
Definition: ut_process_constructors.hpp:607
comb2(const sc_module_name &_name, const functype &_func, const unsigned int &i1toks, const unsigned int &i2toks)
The constructor requires the module name.
Definition: ut_process_constructors.hpp:147
Process constructor for a n-delay element.
Definition: ut_process_constructors.hpp:518
comb4(const sc_module_name &_name, const functype &_func, const unsigned int &i1toks, const unsigned int &i2toks, const unsigned int &i3toks, const unsigned int &i4toks)
The constructor requires the module name.
Definition: ut_process_constructors.hpp:345
delay(const sc_module_name &_name, const T &init_val)
The constructor requires the module name.
Definition: ut_process_constructors.hpp:453
Process constructor for a delay element.
Definition: ut_process_constructors.hpp:442
Process constructor for a scan process.
Definition: ut_process_constructors.hpp:597
UT_in< T > iport1
port for the input channel
Definition: ut_process_constructors.hpp:1250
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: ut_process_constructors.hpp:76
std::function< void(T &, const T &)> functype
Type of the function to be passed to the process constructor.
Definition: ut_process_constructors.hpp:1127
Process constructor for a combinational process (actor) with one input and one output.
Definition: ut_process_constructors.hpp:45
zip(const sc_module_name &_name, const unsigned int &i1toks, const unsigned int &i2toks)
The constructor requires the module name.
Definition: ut_process_constructors.hpp:1327
std::function< void(unsigned int &, const ST &)> gamma_functype
Type of the partitioning function to be passed to the process constructor.
Definition: ut_process_constructors.hpp:604
UT_in< T2 > iport2
port for the input channel 2
Definition: ut_process_constructors.hpp:225
delayn(const sc_module_name &_name, const T &init_val, const unsigned int &n)
The constructor requires the module name.
Definition: ut_process_constructors.hpp:529
UT_out< T > oport1
port for the output channel
Definition: ut_process_constructors.hpp:1124
std::function< void(ST &, const ST &, const std::vector< IT > &)> ns_functype
Type of the next-state function to be passed to the process constructor.
Definition: ut_process_constructors.hpp:950
std::function< void(ST &, const ST &, const std::vector< IT > &)> ns_functype
Type of the next-state function to be passed to the process constructor.
Definition: ut_process_constructors.hpp:824
UT_out< T > oport1
port for the output channel
Definition: ut_process_constructors.hpp:1054
unzip(const sc_module_name &_name)
The constructor requires the module name.
Definition: ut_process_constructors.hpp:1520
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: ut_process_constructors.hpp:1525
unzipN(const sc_module_name &_name)
The constructor requires the module name.
Definition: ut_process_constructors.hpp:1580
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: ut_process_constructors.hpp:1584
std::tuple< UT_in< Ts >... > iport
tuple of ports for the input channels
Definition: ut_process_constructors.hpp:1385
UT_out< T > oport1
port for the output channel
Definition: ut_process_constructors.hpp:446
Process constructor for a source process.
Definition: ut_process_constructors.hpp:1121