sy_process_constructors_strict.hpp
Go to the documentation of this file.
1 /**********************************************************************
2  * sy_process_constructors_strict.hpp -- Strict process *
3  * constructors in the SY MOC*
4  * *
5  * Author: Hosein Attarzadeh (shan2@kth.se) *
6  * *
7  * Purpose: Providing basic process constructors for modeling *
8  * strict synchronous systems in ForSyDe-SystemC *
9  * *
10  * Usage: This file is included automatically *
11  * *
12  * License: BSD3 *
13  *******************************************************************/
14 
15 #ifndef SY_PROCESS_CONSTRUCTORS_STRICT_HPP
16 #define SY_PROCESS_CONSTRUCTORS_STRICT_HPP
17 
26 #include <functional>
27 #include <tuple>
28 #include <array>
29 #include <algorithm>
30 
31 #include "abst_ext.hpp"
32 #include "sy_process.hpp"
33 
34 namespace ForSyDe
35 {
36 
37 namespace SY
38 {
39 
40 using namespace sc_core;
41 
43 
47 template <typename T0, typename T1>
48 class scomb : public sy_process
49 {
50 public:
53 
55  typedef std::function<void(T0&,const T1&)> functype;
56 
58 
62  scomb(const sc_module_name& _name,
63  const functype& _func
64  ) : sy_process(_name), iport1("iport1"), oport1("oport1"),
65  _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 #endif
72  }
73 
75  std::string forsyde_kind() const {return "SY::scomb";}
76 
77 private:
78  // Inputs and output variables
79  T0* oval;
80  T1* ival1;
81 
83  functype _func;
84 
85  //Implementing the abstract semantics
86  void init()
87  {
88  oval = new T0;
89  ival1 = new T1;
90  }
91 
92  void prep()
93  {
94  auto ival1_temp = iport1.read();
95  CHECK_PRESENCE(ival1_temp);
96  *ival1 = unsafe_from_abst_ext(ival1_temp);
97  }
98 
99  void exec()
100  {
101  _func(*oval, *ival1);
102  }
103 
104  void prod()
105  {
106  WRITE_MULTIPORT(oport1, abst_ext<T0>(*oval))
107  }
108 
109  void clean()
110  {
111  delete ival1;
112  delete oval;
113  }
114 
115 #ifdef FORSYDE_INTROSPECTION
116  void bindInfo()
117  {
118  boundInChans.resize(1); // only one input port
119  boundInChans[0].port = &iport1;
120  boundOutChans.resize(1); // only one output port
121  boundOutChans[0].port = &oport1;
122  }
123 #endif
124 };
125 
127 
129 template <typename T0, typename T1, typename T2>
130 class scomb2 : public sy_process
131 {
132 public:
136 
138  typedef std::function<void(T0&, const T1&, const T2&)> functype;
139 
141 
145  scomb2(const sc_module_name& _name,
146  const functype& _func
147  ) : sy_process(_name), iport1("iport1"), iport2("iport2"), oport1("oport1"),
148  _func(_func)
149  {
150 #ifdef FORSYDE_INTROSPECTION
151  std::string func_name = std::string(basename());
152  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
153  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
154 #endif
155  }
156 
158  std::string forsyde_kind() const {return "SY::scomb2";}
159 private:
160  // Inputs and output variables
161  T0* oval;
162  T1* ival1;
163  T2* ival2;
164 
166  functype _func;
167 
168  //Implementing the abstract semantics
169  void init()
170  {
171  oval = new T0;
172  ival1 = new T1;
173  ival2 = new T2;
174  }
175 
176  void prep()
177  {
178  auto ival1_temp = iport1.read();
179  auto ival2_temp = iport2.read();
180  CHECK_PRESENCE(ival1_temp);
181  CHECK_PRESENCE(ival2_temp);
182  *ival1 = unsafe_from_abst_ext(ival1_temp);
183  *ival2 = unsafe_from_abst_ext(ival2_temp);
184  }
185 
186  void exec()
187  {
188  _func(*oval, *ival1, *ival2);
189  }
190 
191  void prod()
192  {
193  WRITE_MULTIPORT(oport1, abst_ext<T0>(*oval))
194  }
195 
196  void clean()
197  {
198  delete ival2;
199  delete ival1;
200  delete oval;
201  }
202 
203 #ifdef FORSYDE_INTROSPECTION
204  void bindInfo()
205  {
206  boundInChans.resize(2); // only one input port
207  boundInChans[0].port = &iport1;
208  boundInChans[1].port = &iport2;
209  boundOutChans.resize(1); // only one output port
210  boundOutChans[0].port = &oport1;
211  }
212 #endif
213 };
214 
216 
218 template <typename T0, typename T1, typename T2, typename T3>
219 class scomb3 : public sy_process
220 {
221 public:
226 
228  typedef std::function<void(T0&, const T1&, const T2&,
229  const T3&)> functype;
230 
232 
236  scomb3(const sc_module_name& _name,
237  const functype& _func
238  ) : sy_process(_name), iport1("iport1"), iport2("iport2"), iport3("iport3"),
239  oport1("oport1"), _func(_func)
240  {
241 #ifdef FORSYDE_INTROSPECTION
242  std::string func_name = std::string(basename());
243  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
244  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
245 #endif
246  }
247 
249  std::string forsyde_kind() const {return "SY::scomb3";}
250 
251 private:
252  // Inputs and output variables
253  T0* oval;
254  T1* ival1;
255  T2* ival2;
256  T3* ival3;
257 
259  functype _func;
260 
261  //Implementing the abstract semantics
262  void init()
263  {
264  oval = new T0;
265  ival1 = new T1;
266  ival2 = new T2;
267  ival3 = new T3;
268  }
269 
270  void prep()
271  {
272  auto ival1_temp = iport1.read();
273  auto ival2_temp = iport2.read();
274  auto ival3_temp = iport3.read();
275  CHECK_PRESENCE(ival1_temp);
276  CHECK_PRESENCE(ival2_temp);
277  CHECK_PRESENCE(ival3_temp);
278  *ival1 = unsafe_from_abst_ext(ival1_temp);
279  *ival2 = unsafe_from_abst_ext(ival2_temp);
280  *ival3 = unsafe_from_abst_ext(ival3_temp);
281  }
282 
283  void exec()
284  {
285  _func(*oval, *ival1, *ival2, *ival3);
286  }
287 
288  void prod()
289  {
290  WRITE_MULTIPORT(oport1, abst_ext<T0>(*oval))
291  }
292 
293  void clean()
294  {
295  delete ival3;
296  delete ival2;
297  delete ival1;
298  delete oval;
299  }
300 
301 #ifdef FORSYDE_INTROSPECTION
302  void bindInfo()
303  {
304  boundInChans.resize(3); // only one input port
305  boundInChans[0].port = &iport1;
306  boundInChans[1].port = &iport2;
307  boundInChans[2].port = &iport3;
308  boundOutChans.resize(1); // only one output port
309  boundOutChans[0].port = &oport1;
310  }
311 #endif
312 };
313 
315 
317 template <typename T0, typename T1, typename T2, typename T3, typename T4>
318 class scomb4 : public sy_process
319 {
320 public:
326 
328  typedef std::function<void(T0&, const T1&, const T2&,
329  const T3&, const T4&)> functype;
330 
332 
336  scomb4(const sc_module_name& _name,
337  const functype& _func
338  ) : sy_process(_name), iport1("iport1"), iport2("iport2"),
339  iport3("iport3"), iport4("iport4"), _func(_func)
340  {
341 #ifdef FORSYDE_INTROSPECTION
342  std::string func_name = std::string(basename());
343  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
344  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
345 #endif
346  }
347 
349  std::string forsyde_kind() const{return "SY::scomb4";}
350 
351 private:
352  // Inputs and output variables
353  T0* oval;
354  T1* ival1;
355  T2* ival2;
356  T3* ival3;
357  T4* ival4;
358 
360  functype _func;
361 
362  //Implementing the abstract semantics
363  void init()
364  {
365  oval = new T0;
366  ival1 = new T1;
367  ival2 = new T2;
368  ival3 = new T3;
369  ival4 = new T4;
370  }
371 
372  void prep()
373  {
374  auto ival1_temp = iport1.read();
375  auto ival2_temp = iport2.read();
376  auto ival3_temp = iport3.read();
377  auto ival4_temp = iport4.read();
378  CHECK_PRESENCE(ival1_temp);
379  CHECK_PRESENCE(ival2_temp);
380  CHECK_PRESENCE(ival3_temp);
381  CHECK_PRESENCE(ival4_temp);
382  *ival1 = unsafe_from_abst_ext(ival1_temp);
383  *ival2 = unsafe_from_abst_ext(ival2_temp);
384  *ival3 = unsafe_from_abst_ext(ival3_temp);
385  *ival4 = unsafe_from_abst_ext(ival4_temp);
386  }
387 
388  void exec()
389  {
390  _func(*oval, *ival1, *ival2, *ival3, *ival4);
391  }
392 
393  void prod()
394  {
395  WRITE_MULTIPORT(oport1, abst_ext<T0>(*oval))
396  }
397 
398  void clean()
399  {
400  delete ival4;
401  delete ival3;
402  delete ival2;
403  delete ival1;
404  delete oval;
405  }
406 
407 #ifdef FORSYDE_INTROSPECTION
408  void bindInfo()
409  {
410  boundInChans.resize(4); // only one input port
411  boundInChans[0].port = &iport1;
412  boundInChans[1].port = &iport2;
413  boundInChans[2].port = &iport3;
414  boundInChans[3].port = &iport4;
415  boundOutChans.resize(1); // only one output port
416  boundOutChans[0].port = &oport1;
417  }
418 #endif
419 };
420 
422 
424 template <typename T0, typename T1, std::size_t N>
425 class scombX : public sy_process
426 {
427 public:
428  std::array<SY_in<T1>,N> iport;
430 
432  typedef std::function<void(T0&, const std::array<T1,N>&)> functype;
433 
435 
439  scombX(const sc_module_name& _name,
440  const functype& _func
441  ) : sy_process(_name), _func(_func)
442  {
443 #ifdef FORSYDE_INTROSPECTION
444  std::string func_name = std::string(basename());
445  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
446  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
447 #endif
448  }
449 
451  std::string forsyde_kind() const{return "SY::scombX";}
452 
453 private:
454  // Inputs and output variables
455  T0* oval;
456  std::array<T1,N> ival;
457 
459  functype _func;
460 
461  //Implementing the abstract semantics
462  void init()
463  {
464  oval = new T0;
465  }
466 
467  void prep()
468  {
469  for (size_t i=0; i<N; i++)
470  {
471  auto ival_temp = iport.read();
472  CHECK_PRESENCE(ival_temp);
473  ival[i] = unsafe_from_abst_ext(ival_temp);
474  }
475  }
476 
477  void exec()
478  {
479  _func(*oval, ival);
480  }
481 
482  void prod()
483  {
484  WRITE_MULTIPORT(oport1, abst_ext<T0>(*oval))
485  }
486 
487  void clean()
488  {
489  delete oval;
490  }
491 
492 #ifdef FORSYDE_INTROSPECTION
493  void bindInfo()
494  {
495  boundInChans.resize(N); // only one input port
496  for (size_t i=0; i<N; i++)
497  boundInChans[i].port = &iport[i];
498  boundOutChans.resize(1); // only one output port
499  boundOutChans[0].port = &oport1;
500  }
501 #endif
502 };
503 
505 
507 template <typename T0, typename T1, std::size_t N>
508 class sdpmap : public sy_process
509 {
510 public:
513 
515  typedef std::function<void(T0&, const T1&)> functype;
516 
518 
522  sdpmap(const sc_module_name& _name,
523  const functype& _func
524  ) : sy_process(_name), _func(_func)
525  {
526 #ifdef FORSYDE_INTROSPECTION
527  std::string func_name = std::string(basename());
528  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
529  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
530 #endif
531  }
532 
534  std::string forsyde_kind() const{return "SY::sdpmap";}
535 
536 private:
537  // Inputs and output variables
538  std::array<T0,N> oval;
539  std::array<T1,N> ival;
540 
542  functype _func;
543 
544  //Implementing the abstract semantics
545  void init() {}
546 
547  void prep()
548  {
549  auto ival_temp = iport1.read();
550  CHECK_PRESENCE(ival_temp);
551  ival = unsafe_from_abst_ext(ival_temp);
552  }
553 
554  void exec()
555  {
556  #ifdef FORSYDE_OPENMP
557  #pragma omp parallel for
558  #endif
559  for (size_t i=0; i<N; i++)
560  {
561  _func(oval[i], ival[i]);
562  }
563  }
564 
565  void prod()
566  {
567  auto tempval = abst_ext<std::array<T0,N>>(oval);
568  WRITE_MULTIPORT(oport1, tempval)
569  }
570 
571  void clean() {}
572 
573 #ifdef FORSYDE_INTROSPECTION
574  void bindInfo()
575  {
576  boundInChans.resize(1); // only one input port
577  boundInChans[0].port = &iport1;
578  boundOutChans.resize(1); // only one output port
579  boundOutChans[0].port = &oport1;
580  }
581 #endif
582 };
583 
585 
588 template <typename T0, std::size_t N>
589 class sdpreduce : public sy_process
590 {
591 public:
594 
596  typedef std::function<void(T0&, const T0&, const T0&)> functype;
597 
599 
603  sdpreduce(const sc_module_name& _name,
604  const functype& _func
605  ) : sy_process(_name), _func(_func)
606  {
607 #ifdef FORSYDE_INTROSPECTION
608  std::string func_name = std::string(basename());
609  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
610  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
611 #endif
612  }
613 
615  std::string forsyde_kind() const{return "SY::sdpreduce";}
616 
617 private:
618  // Inputs and output variables
619  T0* oval;
620  std::array<T0,N> ival;
621 
623  functype _func;
624 
625  //Implementing the abstract semantics
626  void init()
627  {
628  oval = new T0;
629  }
630 
631  void prep()
632  {
633  auto ival1_temp = iport1.read();
634  CHECK_PRESENCE(ival1_temp);
635  ival = unsafe_from_abst_ext(ival1_temp);
636  }
637 
638  void exec()
639  {
640  T0 res = T0();
641  #ifdef FORSYDE_OPENMP // this can be enhanced with the new delare reduction clause in OpenMP 4.0
642 
643  #pragma omp parallel shared(res) // Create omp threads
644  {
645  T0 val = T0(); // val can be declared as local variable (for each thread)
646  #pragma omp for nowait
647  for (int i = 0; i < N; ++i)
648  {
649  _func(val, val, ival[i]);
650  }
651  #pragma omp critical
652  {
653  _func(res, res, val);
654  }
655  }
656 
657  #else
658 
659  res = ival[0];
660  for (size_t i=1;i<N;i++)
661  _func(res, res, ival[i]);
662 
663  #endif
664  *oval = res;
665  }
666 
667  void prod()
668  {
669  WRITE_MULTIPORT(oport1, abst_ext<T0>(*oval))
670  }
671 
672  void clean()
673  {
674  delete oval;
675  }
676 
677 #ifdef FORSYDE_INTROSPECTION
678  void bindInfo()
679  {
680  boundInChans.resize(1); // only one input port
681  boundInChans[0].port = &iport1;
682  boundOutChans.resize(1); // only one output port
683  boundOutChans[0].port = &oport1;
684  }
685 #endif
686 };
687 
689 
694 template <typename T0, typename T1, std::size_t N>
695 class sdpscan : public sy_process
696 {
697 public:
700 
702  typedef std::function<void(T0&, const T0&, const T1&)> functype;
703 
705 
709  sdpscan(const sc_module_name& _name,
710  const functype& _func,
711  const T0& init_res
712  ) : sy_process(_name), _func(_func), init_res(init_res)
713  {
714 #ifdef FORSYDE_INTROSPECTION
715  std::string func_name = std::string(basename());
716  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
717  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
718  std::stringstream ss;
719  ss << init_res;
720  arg_vec.push_back(std::make_tuple("init_res",ss.str()));
721 #endif
722  }
723 
725  std::string forsyde_kind() const{return "SY::sdpscan";}
726 
727 private:
728  // Inputs and output variables
729  std::array<T0,N> oval;
730  std::array<T0,N> ival;
731 
733  functype _func;
734 
735  T0 init_res;
736 
737  //Implementing the abstract semantics
738  void init() {}
739 
740  void prep()
741  {
742  auto ival1_temp = iport1.read();
743  CHECK_PRESENCE(ival1_temp);
744  ival = unsafe_from_abst_ext(ival1_temp);
745  }
746 
747  void exec()
748  {
749  _func(oval[0], init_res, ival[0]);
750  for (size_t i=1;i<N;i++)
751  _func(oval[i], oval[i-1], ival[i]);
752  }
753 
754  void prod()
755  {
756  auto tempval = abst_ext<std::array<T0,N>>(oval);
757  WRITE_MULTIPORT(oport1, tempval)
758  }
759 
760  void clean() {}
761 
762 #ifdef FORSYDE_INTROSPECTION
763  void bindInfo()
764  {
765  boundInChans.resize(1); // only one input port
766  boundInChans[0].port = &iport1;
767  boundOutChans.resize(1); // only one output port
768  boundOutChans[0].port = &oport1;
769  }
770 #endif
771 };
772 
774 
783 template <class T>
784 class sdelay : public sy_process
785 {
786 public:
789 
791 
795  sdelay(const sc_module_name& _name,
796  const T& init_val
797  ) : sy_process(_name), iport1("iport1"), oport1("oport1"),
798  init_val(init_val)
799  {
800 #ifdef FORSYDE_INTROSPECTION
801  std::stringstream ss;
802  ss << init_val;
803  arg_vec.push_back(std::make_tuple("init_val", ss.str()));
804 #endif
805  }
806 
808  std::string forsyde_kind() const {return "SY::sdelay";}
809 
810 private:
811  // Initial value
812  T init_val;
813 
814  // Inputs and output variables
815  T* val;
816 
817  //Implementing the abstract semantics
818  void init()
819  {
820  val = new T;
821  WRITE_MULTIPORT(oport1, abst_ext<T>(init_val))
822  }
823 
824  void prep()
825  {
826  auto ival1_temp = iport1.read();
827  CHECK_PRESENCE(ival1_temp);
828  *val = unsafe_from_abst_ext(ival1_temp);
829  }
830 
831  void exec() {}
832 
833  void prod()
834  {
835  WRITE_MULTIPORT(oport1, abst_ext<T>(*val))
836  }
837 
838  void clean()
839  {
840  delete val;
841  }
842 #ifdef FORSYDE_INTROSPECTION
843  void bindInfo()
844  {
845  boundInChans.resize(1); // only one input port
846  boundInChans[0].port = &iport1;
847  boundOutChans.resize(1); // only one output port
848  boundOutChans[0].port = &oport1;
849  }
850 #endif
851 };
852 
854 
861 template <class T>
862 class sdelayn : public sy_process
863 {
864 public:
867 
869 
873  sdelayn(const sc_module_name& _name,
874  const T& init_val,
875  const unsigned int& n
876  ) : sy_process(_name), iport1("iport1"), oport1("oport1"),
877  init_val(init_val), ns(n)
878  {
879 #ifdef FORSYDE_INTROSPECTION
880  std::stringstream ss;
881  ss << init_val;
882  arg_vec.push_back(std::make_tuple("init_val", ss.str()));
883  ss.str("");
884  ss << n;
885  arg_vec.push_back(std::make_tuple("n", ss.str()));
886 #endif
887  }
888 
890  std::string forsyde_kind() const {return "SY::sdelayn";}
891 
892 private:
893  // Initial value
894  T init_val;
895  unsigned int ns;
896 
897  // Inputs and output variables
898  T* val;
899 
900  //Implementing the abstract semantics
901  void init()
902  {
903  val = new T;
904  for (int i=0; i<ns; i++)
905  WRITE_MULTIPORT(oport1, abst_ext<T>(init_val))
906  }
907 
908  void prep()
909  {
910  auto ival1_temp = iport1.read();
911  CHECK_PRESENCE(ival1_temp);
912  *val = unsafe_from_abst_ext(ival1_temp);
913  }
914 
915  void exec() {}
916 
917  void prod()
918  {
919  WRITE_MULTIPORT(oport1, abst_ext<T>(*val))
920  }
921 
922  void clean()
923  {
924  delete val;
925  }
926 #ifdef FORSYDE_INTROSPECTION
927  void bindInfo()
928  {
929  boundInChans.resize(1); // only one input port
930  boundInChans[0].port = &iport1;
931  boundOutChans.resize(1); // only one output port
932  boundOutChans[0].port = &oport1;
933  }
934 #endif
935 };
936 
938 
942 template <class IT, class ST, class OT>
943 class smoore : public sy_process
944 {
945 public:
948 
950  typedef std::function<void(ST&, const ST&, const IT&)> ns_functype;
951 
953  typedef std::function<void(OT&, const ST&)> od_functype;
954 
956 
960  smoore(const sc_module_name& _name,
961  const ns_functype& _ns_func,
962  const od_functype& _od_func,
963  const ST& init_st
964  ) : sy_process(_name), _ns_func(_ns_func), _od_func(_od_func),
965  init_st(init_st)
966  {
967 #ifdef FORSYDE_INTROSPECTION
968  std::string func_name = std::string(basename());
969  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
970  arg_vec.push_back(std::make_tuple("_ns_func",func_name+std::string("_ns_func")));
971  arg_vec.push_back(std::make_tuple("_od_func",func_name+std::string("_od_func")));
972  std::stringstream ss;
973  ss << init_st;
974  arg_vec.push_back(std::make_tuple("init_st",ss.str()));
975 #endif
976  }
977 
979  std::string forsyde_kind() const{return "SY::smoore";}
980 
981 private:
983  ns_functype _ns_func;
984  od_functype _od_func;
985  // Initial value
986  ST init_st;
987 
988  bool first_run;
989 
990  // Input, output, current state, and next state variables
991  IT* ival;
992  ST* stval;
993  ST* nsval;
994  OT* oval;
995 
996  //Implementing the abstract semantics
997  void init()
998  {
999  ival = new IT;
1000  stval = new ST;
1001  *stval = init_st;
1002  nsval = new ST;
1003  oval = new OT;
1004  // First evaluation cycle
1005  first_run = true;
1006  }
1007 
1008  void prep()
1009  {
1010  if (!first_run)
1011  {
1012  auto ival_temp = iport1.read();
1013  CHECK_PRESENCE(ival_temp);
1014  *ival = unsafe_from_abst_ext(ival_temp);
1015  }
1016  }
1017 
1018  void exec()
1019  {
1020  if (first_run)
1021  first_run = false;
1022  else
1023  {
1024  _ns_func(*nsval, *stval, *ival);
1025  *stval = *nsval;
1026  }
1027  _od_func(*oval, *stval);
1028  }
1029 
1030  void prod()
1031  {
1032  WRITE_MULTIPORT(oport1, abst_ext<OT>(*oval))
1033  }
1034 
1035  void clean()
1036  {
1037  delete ival;
1038  delete stval;
1039  delete nsval;
1040  delete oval;
1041  }
1042 #ifdef FORSYDE_INTROSPECTION
1043  void bindInfo()
1044  {
1045  boundInChans.resize(1); // only one input port
1046  boundInChans[0].port = &iport1;
1047  boundOutChans.resize(1); // only one output port
1048  boundOutChans[0].port = &oport1;
1049  }
1050 #endif
1051 };
1052 
1054 
1058 template <class IT, class ST, class OT>
1059 class smealy : public sy_process
1060 {
1061 public:
1064 
1066  typedef std::function<void(ST&, const ST&, const IT&)> ns_functype;
1067 
1069  typedef std::function<void(OT&, const ST&, const IT&)> od_functype;
1070 
1072 
1076  smealy(const sc_module_name& _name,
1077  const ns_functype& _ns_func,
1078  const od_functype& _od_func,
1079  const ST& init_st
1080  ) : sy_process(_name), _ns_func(_ns_func), _od_func(_od_func),
1081  init_st(init_st)
1082  {
1083 #ifdef FORSYDE_INTROSPECTION
1084  std::string func_name = std::string(basename());
1085  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
1086  arg_vec.push_back(std::make_tuple("_ns_func",func_name+std::string("_ns_func")));
1087  arg_vec.push_back(std::make_tuple("_od_func",func_name+std::string("_od_func")));
1088  std::stringstream ss;
1089  ss << init_st;
1090  arg_vec.push_back(std::make_tuple("init_st",ss.str()));
1091 #endif
1092  }
1093 
1095  std::string forsyde_kind() const{return "SY::smealy";}
1096 
1097 private:
1099  ns_functype _ns_func;
1100  od_functype _od_func;
1101  // Initial value
1102  ST init_st;
1103 
1104  // Input, output, current state, and next state variables
1105  IT* ival;
1106  ST* stval;
1107  ST* nsval;
1108  OT* oval;
1109 
1110  //Implementing the abstract semantics
1111  void init()
1112  {
1113  ival = new IT;
1114  stval = new ST;
1115  *stval = init_st;
1116  nsval = new ST;
1117  oval = new OT;
1118  }
1119 
1120  void prep()
1121  {
1122  auto ival_temp = iport1.read();
1123  CHECK_PRESENCE(ival_temp);
1124  *ival = unsafe_from_abst_ext(ival_temp);
1125  }
1126 
1127  void exec()
1128  {
1129  _ns_func(*nsval, *stval, *ival);
1130  _od_func(*oval, *stval, *ival);
1131  *stval = *nsval;
1132  }
1133 
1134  void prod()
1135  {
1136  WRITE_MULTIPORT(oport1, abst_ext<OT>(*oval))
1137  }
1138 
1139  void clean()
1140  {
1141  delete ival;
1142  delete stval;
1143  delete nsval;
1144  delete oval;
1145  }
1146 #ifdef FORSYDE_INTROSPECTION
1147  void bindInfo()
1148  {
1149  boundInChans.resize(1); // only one input port
1150  boundInChans[0].port = &iport1;
1151  boundOutChans.resize(1); // only one output port
1152  boundOutChans[0].port = &oport1;
1153  }
1154 #endif
1155 };
1156 
1158 
1163 template <class T>
1164 class sconstant : public sy_process
1165 {
1166 public:
1168 
1170 
1173  sconstant(const sc_module_name& _name,
1174  const T& init_val,
1175  const unsigned long long& take=0
1176  ) : sy_process(_name), oport1("oport1"),
1177  init_val(init_val), take(take)
1178 
1179  {
1180 #ifdef FORSYDE_INTROSPECTION
1181  std::stringstream ss;
1182  ss << init_val;
1183  arg_vec.push_back(std::make_tuple("init_val", ss.str()));
1184  ss.str("");
1185  ss << take;
1186  arg_vec.push_back(std::make_tuple("take", ss.str()));
1187 #endif
1188  }
1189 
1191  std::string forsyde_kind() const {return "SY::sconstant";}
1192 
1193 private:
1194  T init_val;
1195  unsigned long long take; // Number of tokens produced
1196 
1197  unsigned long long tok_cnt;
1198  bool infinite;
1199 
1200  //Implementing the abstract semantics
1201  void init()
1202  {
1203  infinite = take==0 ? true : false;
1204  tok_cnt = 0;
1205  }
1206 
1207  void prep() {}
1208 
1209  void exec() {}
1210 
1211  void prod()
1212  {
1213  if (tok_cnt++ < take || infinite)
1214  WRITE_MULTIPORT(oport1, abst_ext<T>(init_val))
1215  else wait();
1216  }
1217 
1218  void clean() {}
1219 
1220 #ifdef FORSYDE_INTROSPECTION
1221  void bindInfo()
1222  {
1223  boundOutChans.resize(1); // only one output port
1224  boundOutChans[0].port = &oport1;
1225  }
1226 #endif
1227 };
1228 
1230 
1235 template <class T>
1236 class ssource : public sy_process
1237 {
1238 public:
1240 
1242  typedef std::function<void(T&, const T&)> functype;
1243 
1245 
1248  ssource(const sc_module_name& _name,
1249  const functype& _func,
1250  const T& init_val,
1251  const unsigned long long& take=0
1252  ) : sy_process(_name), oport1("oport1"),
1253  init_st(init_val), take(take), _func(_func)
1254  {
1255 #ifdef FORSYDE_INTROSPECTION
1256  std::string func_name = std::string(basename());
1257  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
1258  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
1259  std::stringstream ss;
1260  ss << init_val;
1261  arg_vec.push_back(std::make_tuple("init_val", ss.str()));
1262  ss.str("");
1263  ss << take;
1264  arg_vec.push_back(std::make_tuple("take", ss.str()));
1265 #endif
1266  }
1267 
1269  std::string forsyde_kind() const {return "SY::ssource";}
1270 
1271 private:
1272  T init_st; // The current state
1273  unsigned long long take; // Number of tokens produced
1274 
1275  T* cur_st; // The current state of the process
1276  unsigned long long tok_cnt;
1277  bool infinite;
1278 
1280  functype _func;
1281 
1282  //Implementing the abstract semantics
1283  void init()
1284  {
1285  cur_st = new T;
1286  *cur_st = init_st;
1287  WRITE_MULTIPORT(oport1, abst_ext<T>(*cur_st))
1288  infinite = take==0 ? true : false;
1289  tok_cnt = 1;
1290  }
1291 
1292  void prep() {}
1293 
1294  void exec()
1295  {
1296  _func(*cur_st, *cur_st);
1297  }
1298 
1299  void prod()
1300  {
1301  if (tok_cnt++ < take || infinite)
1302  WRITE_MULTIPORT(oport1, abst_ext<T>(*cur_st))
1303  else wait();
1304  }
1305 
1306  void clean()
1307  {
1308  delete cur_st;
1309  }
1310 
1311 #ifdef FORSYDE_INTROSPECTION
1312  void bindInfo()
1313  {
1314  boundOutChans.resize(1); // only one output port
1315  boundOutChans[0].port = &oport1;
1316  }
1317 #endif
1318 };
1319 
1321 
1325 template <class T>
1326 class svsource : public sy_process
1327 {
1328 public:
1330 
1332 
1335  svsource(const sc_module_name& _name,
1336  const std::vector<T>& in_vec
1337  ) : sy_process(_name), in_vec(in_vec)
1338  {
1339 #ifdef FORSYDE_INTROSPECTION
1340  std::stringstream ss;
1341  ss << in_vec;
1342  arg_vec.push_back(std::make_tuple("in_vec", ss.str()));
1343 #endif
1344  }
1345 
1347  std::string forsyde_kind() const {return "SY::svsource";}
1348 
1349 private:
1350  std::vector<T> in_vec;
1351 
1352  unsigned long tok_cnt;
1353 
1354  //Implementing the abstract semantics
1355  void init()
1356  {
1357  tok_cnt = 0;
1358  }
1359 
1360  void prep() {}
1361 
1362  void exec() {}
1363 
1364  void prod()
1365  {
1366  if (tok_cnt < in_vec.size())
1367  {
1368  WRITE_MULTIPORT(oport1, abst_ext<T>(in_vec[tok_cnt]))
1369  tok_cnt++;
1370  }
1371  else
1372  wait();
1373  }
1374 
1375  void clean() {}
1376 
1377 #ifdef FORSYDE_INTROSPECTION
1378  void bindInfo()
1379  {
1380  boundOutChans.resize(1); // only one output port
1381  boundOutChans[0].port = &oport1;
1382  }
1383 #endif
1384 };
1385 
1387 
1391 template <class T>
1392 class ssink : public sy_process
1393 {
1394 public:
1396 
1398  typedef std::function<void(const T&)> functype;
1399 
1401 
1404  ssink(const sc_module_name& _name,
1405  const functype& _func
1406  ) : sy_process(_name), iport1("iport1"), _func(_func)
1407 
1408  {
1409 #ifdef FORSYDE_INTROSPECTION
1410  std::string func_name = std::string(basename());
1411  func_name = func_name.substr(0, func_name.find_last_not_of("0123456789")+1);
1412  arg_vec.push_back(std::make_tuple("_func",func_name+std::string("_func")));
1413 #endif
1414  }
1415 
1417  std::string forsyde_kind() const {return "SY::ssink";}
1418 
1419 private:
1420  T* val; // The current state of the process
1421 
1423  functype _func;
1424 
1425  //Implementing the abstract semantics
1426  void init()
1427  {
1428  val = new T;
1429  }
1430 
1431  void prep()
1432  {
1433  auto val_temp = iport1.read();
1434  CHECK_PRESENCE(val_temp);
1435  *val = unsafe_from_abst_ext(val_temp);
1436  }
1437 
1438  void exec()
1439  {
1440  _func(*val);
1441  }
1442 
1443  void prod() {}
1444 
1445  void clean()
1446  {
1447  delete val;
1448  }
1449 
1450 #ifdef FORSYDE_INTROSPECTION
1451  void bindInfo()
1452  {
1453  boundInChans.resize(1); // only one output port
1454  boundInChans[0].port = &iport1;
1455  }
1456 #endif
1457 };
1458 
1460 
1462 template <class T1, class T2>
1463 class szip : public sy_process
1464 {
1465 public:
1469 
1471 
1474  szip(const sc_module_name& _name
1475  )
1476  :sy_process(_name), iport1("iport1"), iport2("iport2"), oport1("oport1")
1477  { }
1478 
1480  std::string forsyde_kind() const {return "SY::szip";}
1481 
1482 private:
1483  // intermediate values
1484  T1* ival1;
1485  T2* ival2;
1486 
1487  void init()
1488  {
1489  ival1 = new T1;
1490  ival2 = new T2;
1491  }
1492 
1493  void prep()
1494  {
1495  auto ival1_temp = iport1.read();
1496  auto ival2_temp = iport2.read();
1497  CHECK_PRESENCE(ival1_temp);
1498  CHECK_PRESENCE(ival2_temp);
1499  *ival1 = unsafe_from_abst_ext(ival1_temp);
1500  *ival2 = unsafe_from_abst_ext(ival2_temp);
1501  }
1502 
1503  void exec() {}
1504 
1505  void prod()
1506  {
1507  auto outval = abst_ext<std::tuple<T1,T2>>(std::make_tuple(*ival1,*ival2));
1508  WRITE_MULTIPORT(oport1, outval) // write to the output
1509  }
1510 
1511  void clean()
1512  {
1513  delete ival1;
1514  delete ival2;
1515  }
1516 
1517 #ifdef FORSYDE_INTROSPECTION
1518  void bindInfo()
1519  {
1520  boundInChans.resize(2); // two input ports
1521  boundInChans[0].port = &iport1;
1522  boundInChans[1].port = &iport2;
1523  boundOutChans.resize(1); // only one output port
1524  boundOutChans[0].port = &oport1;
1525  }
1526 #endif
1527 };
1528 
1530 
1532 template <class T1, std::size_t N>
1533 class szipX : public sy_process
1534 {
1535 public:
1536  std::array<SY_in<T1>,N> iport;
1538 
1540 
1543  szipX(const sc_module_name& _name
1544  )
1545  :sy_process(_name), oport1("oport1")
1546  { }
1547 
1549  std::string forsyde_kind() const {return "SY::szipX";}
1550 
1551 private:
1552  // intermediate values
1553  std::array<T1,N> ival;
1554 
1555  void init() {}
1556 
1557  void prep()
1558  {
1559  for (size_t i=0; i<N; i++)
1560  {
1561  auto ival_temp = iport[i].read();
1562  CHECK_PRESENCE(ival_temp);
1563  ival[i] = unsafe_from_abst_ext(ival_temp);
1564  }
1565  }
1566 
1567  void exec() {}
1568 
1569  void prod()
1570  {
1571  auto oval = abst_ext<std::array<T1,N>>(ival);
1572  WRITE_MULTIPORT(oport1,oval) // write to the output
1573  }
1574 
1575  void clean() {}
1576 
1577 #ifdef FORSYDE_INTROSPECTION
1578  void bindInfo()
1579  {
1580  boundInChans.resize(N); // N input ports
1581  for (size_t i=0;i<N;i++)
1582  boundInChans[i].port = &iport[i];
1583  boundOutChans.resize(1); // only one output port
1584  boundOutChans[0].port = &oport1;
1585  }
1586 #endif
1587 };
1588 
1590 
1592 template <class... Ts>
1593 class szipN : public sy_process
1594 {
1595 public:
1596  std::tuple<SY_in<Ts>...> iport;
1597  SY_out<std::tuple<Ts...> > oport1;
1598 
1600 
1603  szipN(const sc_module_name& _name
1604  )
1605  : sy_process(_name), oport1("oport1")
1606  { }
1607 
1609  std::string forsyde_kind() const {return "SY::szipN";}
1610 private:
1611  // intermediate values
1612  std::tuple<Ts...>* in_vals;
1613 
1614  void init()
1615  {
1616  in_vals = new std::tuple<Ts...>;
1617  }
1618 
1619  void prep()
1620  {
1621  *in_vals = sc_fifo_tuple_read<Ts...>(iport);
1622  }
1623 
1624  void exec() {}
1625 
1626  void prod()
1627  {
1628  WRITE_MULTIPORT(oport1,abst_ext<std::tuple<Ts...>>(*in_vals)) // write to the output
1629  }
1630 
1631  void clean()
1632  {
1633  delete in_vals;
1634  }
1635 
1636  template<size_t N,class R, class T>
1637  struct fifo_read_helper
1638  {
1639  static void read(R& ret, T& t)
1640  {
1641  fifo_read_helper<N-1,R,T>::read(ret,t);
1642  std::get<N>(ret) = std::get<N>(t).read();
1643  }
1644  };
1645 
1646  template<class R, class T>
1647  struct fifo_read_helper<0,R,T>
1648  {
1649  static void read(R& ret, T& t)
1650  {
1651  auto ival_temp = std::get<0>(t).read();
1652  //~ CHECK_PRESENCE(ival_temp);
1653  if (is_absent(ival_temp)) SC_REPORT_ERROR("szipN","Unexpected absent value received in");
1654  std::get<0>(ret) = unsafe_from_abst_ext(ival_temp);
1655  }
1656  };
1657 
1658  template<class... T>
1659  std::tuple<T...> sc_fifo_tuple_read(std::tuple<SY_in<T>...>& ports)
1660  {
1661  std::tuple<T...> ret;
1662  fifo_read_helper<sizeof...(T)-1,
1663  std::tuple<T...>,
1664  std::tuple<SY_in<T>...>>::read(ret,ports);
1665  return ret;
1666  }
1667 
1668 };
1669 
1671 
1673 template <class T1, class T2>
1674 class sunzip : public sy_process
1675 {
1676 public:
1680 
1682 
1685  sunzip(const sc_module_name& _name
1686  )
1687  :sy_process(_name), iport1("iport1"), oport1("oport1"), oport2("oport2")
1688  {}
1689 
1691  std::string forsyde_kind() const {return "SY::sunzip";}
1692 private:
1693  // intermediate values
1694  abst_ext<std::tuple<T1,T2>>* in_val;
1695 
1696  void init()
1697  {
1698  in_val = new abst_ext<std::tuple<T1,T2>>;
1699  }
1700 
1701  void prep()
1702  {
1703  *in_val = iport1.read();
1704  CHECK_PRESENCE(*in_val);
1705  }
1706 
1707  void exec() {}
1708 
1709  void prod()
1710  {
1711  WRITE_MULTIPORT(oport1,abst_ext<T1>(std::get<0>(*in_val))) // write to the output 1
1712  WRITE_MULTIPORT(oport2,abst_ext<T2>(std::get<1>(*in_val))) // write to the output 2
1713  }
1714 
1715  void clean()
1716  {
1717  delete in_val;
1718  }
1719 
1720 #ifdef FORSYDE_INTROSPECTION
1721  void bindInfo()
1722  {
1723  boundInChans.resize(1); // only one input port
1724  boundInChans[0].port = &iport1;
1725  boundOutChans.resize(2); // two output ports
1726  boundOutChans[0].port = &oport1;
1727  boundOutChans[1].port = &oport2;
1728  }
1729 #endif
1730 };
1731 
1733 
1735 template <class T1, std::size_t N>
1736 class sunzipX : public sy_process
1737 {
1738 public:
1740  std::array<SY_out<T1>,N> oport;
1741 
1743 
1746  sunzipX(const sc_module_name& _name
1747  )
1748  :sy_process(_name), iport1("iport1")
1749  {}
1750 
1752  std::string forsyde_kind() const {return "SY::sunzipX";}
1753 private:
1754  // intermediate values
1755  abst_ext<std::array<T1,N>>* in_val;
1756 
1757  void init()
1758  {
1759  in_val = new abst_ext<std::array<T1,N>>;
1760  }
1761 
1762  void prep()
1763  {
1764  *in_val = iport1.read();
1765  CHECK_PRESENCE(*in_val);
1766  }
1767 
1768  void exec() {}
1769 
1770  void prod()
1771  {
1772  for (size_t i=0; i<N; i++)
1773  WRITE_MULTIPORT(oport[i],abst_ext<T1>(in_val->unsafe_from_abst_ext()[i])) // write to the output i
1774  }
1775 
1776  void clean()
1777  {
1778  delete in_val;
1779  }
1780 
1781 #ifdef FORSYDE_INTROSPECTION
1782  void bindInfo()
1783  {
1784  boundInChans.resize(1); // only one input port
1785  boundInChans[0].port = &iport1;
1786  boundOutChans.resize(N); // output ports
1787  for (size_t i=0;i<N;i++)
1788  boundOutChans[i].port = &oport[i];
1789  }
1790 #endif
1791 };
1792 
1794 
1796 template <class... Ts>
1797 class sunzipN : public sy_process
1798 {
1799 public:
1800  SY_in<std::tuple<Ts...>> iport1;
1801  std::tuple<SY_out<Ts>...> oport;
1802 
1804 
1807  sunzipN(const sc_module_name& _name
1808  )
1809  :sy_process(_name), iport1("iport1")
1810  { }
1811 
1813  std::string forsyde_kind() const {return "SY::sunzipN";}
1814 private:
1815  // intermediate values
1816  abst_ext<std::tuple<Ts...>>* in_val;
1817 
1818  void init()
1819  {
1820  in_val = new abst_ext<std::tuple<Ts...>>;
1821  }
1822 
1823  void prep()
1824  {
1825  *in_val = iport1.read();
1826  CHECK_PRESENCE(*in_val);
1827  }
1828 
1829  void exec() {}
1830 
1831  void prod()
1832  {
1833  fifo_tuple_write<Ts...>(in_val->unsafe_from_abst_ext(), oport);
1834  }
1835 
1836  void clean()
1837  {
1838  delete in_val;
1839  }
1840 
1841  template<size_t N,class R, class T>
1842  struct fifo_write_helper
1843  {
1844  static void write(const R& vals, T& t)
1845  {
1846  fifo_write_helper<N-1,R,T>::write(vals,t);
1847  std::get<N>(t).write(std::get<N>(vals));
1848  }
1849  };
1850 
1851  template<class R, class T>
1852  struct fifo_write_helper<0,R,T>
1853  {
1854  static void write(const R& vals, T& t)
1855  {
1856  std::get<0>(t).write(std::get<0>(vals));
1857  }
1858  };
1859 
1860  template<class... T>
1861  void fifo_tuple_write(const std::tuple<T...>& vals,
1862  std::tuple<SY_out<T>...>& ports)
1863  {
1864  fifo_write_helper<sizeof...(T)-1,
1865  std::tuple<T...>,
1866  std::tuple<SY_out<T>...>>::write(vals,ports);
1867  }
1868 
1869 #ifdef FORSYDE_INTROSPECTION
1870  void bindInfo()
1871  {
1872  boundInChans.resize(1); // only one input port
1873  boundInChans[0].port = &iport1;
1874  boundOutChans.resize(sizeof...(Ts)); // two output ports
1875  register_ports(boundOutChans, oport);
1876  }
1877 
1878  template<size_t N, class T>
1879  struct register_ports_helper
1880  {
1881  static void reg_port(std::vector<PortInfo>& boundChans, T& t)
1882  {
1883  register_ports_helper<N-1,T>::reg_port(boundChans,t);
1884  boundChans[N].port = &std::get<N>(t);
1885  }
1886  };
1887 
1888  template<class T>
1889  struct register_ports_helper<0,T>
1890  {
1891  static void reg_port(std::vector<PortInfo>& boundChans, T& t)
1892  {
1893  boundChans[0].port = &std::get<0>(t);
1894  }
1895  };
1896 
1897  template<class... T>
1898  void register_ports(std::vector<PortInfo>& boundChans,
1899  std::tuple<SY_out<T>...>& ports)
1900  {
1901  register_ports_helper<sizeof...(T)-1,
1902  std::tuple<SY_out<T>...>&>::reg_port(boundChans,ports);
1903  }
1904 #endif
1905 
1906 };
1907 
1909 
1913 template <class T>
1914 class sgroup : public sy_process
1915 {
1916 public:
1919 
1921 
1925  sgroup(const sc_module_name& _name,
1926  const unsigned long& samples
1927  )
1928  :sy_process(_name), samples(samples)
1929  {
1930 #ifdef FORSYDE_INTROSPECTION
1931  std::stringstream ss;
1932  ss << samples;
1933  arg_vec.push_back(std::make_tuple("samples", ss.str()));
1934 #endif
1935  }
1936 
1938  std::string forsyde_kind() const {return "SY::sgroup";}
1939 
1940 private:
1941  // Number of samples in each group
1942  unsigned long samples;
1943 
1944  unsigned long samples_took;
1945 
1946  // The output vector
1947  std::vector<T>* oval;
1948 
1949  //Implementing the abstract semantics
1950  void init()
1951  {
1952  oval = new std::vector<T>;
1953  oval->resize(samples);
1954  samples_took = 0;
1955  }
1956 
1957  void prep()
1958  {
1959  auto val_temp = iport1.read();
1960  CHECK_PRESENCE(val_temp);
1961  (*oval)[samples_took] = unsafe_from_abst_ext(val_temp);
1962  samples_took++;
1963  }
1964 
1965  void exec() {}
1966 
1967  void prod()
1968  {
1969  if (samples_took==samples)
1970  {
1971  WRITE_MULTIPORT(oport1, abst_ext<std::vector<T>>(*oval))
1972  samples_took = 0;
1973  }
1974  else
1975  WRITE_MULTIPORT(oport1, abst_ext<std::vector<T>>())
1976  }
1977 
1978  void clean()
1979  {
1980  delete oval;
1981  }
1982 #ifdef FORSYDE_INTROSPECTION
1983  void bindInfo()
1984  {
1985  boundInChans.resize(1); // only one input port
1986  boundInChans[0].port = &iport1;
1987  boundOutChans.resize(1); // only one output port
1988  boundOutChans[0].port = &oport1;
1989  }
1990 #endif
1991 };
1992 
1993 }
1994 }
1995 
1996 #endif
std::function< void(ST &, const ST &, const IT &)> ns_functype
Type of the next-state function to be passed to the process constructor.
Definition: sy_process_constructors_strict.hpp:950
std::function< void(T &, const T &)> functype
Type of the function to be passed to the process constructor.
Definition: sy_process_constructors_strict.hpp:1242
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:75
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:1549
SY_in< std::array< T1, N > > iport1
port for the input channel 1
Definition: sy_process_constructors_strict.hpp:511
SY_in< T > iport1
port for the input channel
Definition: sy_process_constructors_strict.hpp:787
T unsafe_from_abst_ext() const
Unsafely converts a value from an extended value assuming it is present.
Definition: abst_ext.hpp:54
Process constructor for a strict Moore machine.
Definition: sy_process_constructors_strict.hpp:943
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:534
Process constructor for a strict delay element.
Definition: sy_process_constructors_strict.hpp:784
SY_in< T > iport1
port for the input channel
Definition: sy_process_constructors_strict.hpp:1917
std::function< void(T0 &, const T1 &, const T2 &, const T3 &, const T4 &)> functype
Type of the function to be passed to the process constructor.
Definition: sy_process_constructors_strict.hpp:329
scomb3(const sc_module_name &_name, const functype &_func)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:236
std::array< SY_in< T1 >, N > iport
port array for the input channels
Definition: sy_process_constructors_strict.hpp:1536
The strict unzip process with one input and two outputs.
Definition: sy_process_constructors_strict.hpp:1674
std::function< void(T0 &, const T1 &)> functype
Type of the function to be passed to the process constructor.
Definition: sy_process_constructors_strict.hpp:515
SY_out< T > oport1
port for the output channel
Definition: sy_process_constructors_strict.hpp:866
sdpmap(const sc_module_name &_name, const functype &_func)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:522
std::array< SY_in< T1 >, N > iport
port for the input channel 1
Definition: sy_process_constructors_strict.hpp:428
ssink(const sc_module_name &_name, const functype &_func)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:1404
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:615
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:1191
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:1095
The strict group process with one input and one output.
Definition: sy_process_constructors_strict.hpp:1914
SY_out< T > oport1
port for the output channel
Definition: sy_process_constructors_strict.hpp:1167
svsource(const sc_module_name &_name, const std::vector< T > &in_vec)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:1335
scomb2(const sc_module_name &_name, const functype &_func)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:145
The namespace for ForSyDe.
Definition: abssemantics.hpp:30
SY_out< OT > oport1
port for the output channel
Definition: sy_process_constructors_strict.hpp:947
A data-parallel process constructor for a strict reduce process with an array of inputs and one outpu...
Definition: sy_process_constructors_strict.hpp:589
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:725
SY_in< std::tuple< T1, T2 > > iport1
port for the input channel
Definition: sy_process_constructors_strict.hpp:1677
ssource(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: sy_process_constructors_strict.hpp:1248
sunzipN(const sc_module_name &_name)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:1807
szipN(const sc_module_name &_name)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:1603
sconstant(const sc_module_name &_name, const T &init_val, const unsigned long long &take=0)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:1173
Implements the Absent-extended values.
SY_out< T0 > oport1
port for the output channel
Definition: sy_process_constructors_strict.hpp:225
SY_out< T > oport1
port for the output channel
Definition: sy_process_constructors_strict.hpp:1239
SY_in< T2 > iport2
port for the input channel 2
Definition: sy_process_constructors_strict.hpp:223
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:1347
SY_in< T1 > iport1
port for the input channel
Definition: sy_process_constructors_strict.hpp:51
scomb(const sc_module_name &_name, const functype &_func)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:62
std::function< void(T0 &, const T1 &)> functype
Type of the function to be passed to the process constructor.
Definition: sy_process_constructors_strict.hpp:55
SY_in< T4 > iport4
port for the input channel 4
Definition: sy_process_constructors_strict.hpp:324
SY_in< T1 > iport1
port for the input channel 1
Definition: sy_process_constructors_strict.hpp:1466
SY_in< T1 > iport1
port for the input channel 1
Definition: sy_process_constructors_strict.hpp:222
std::function< void(OT &, const ST &, const IT &)> od_functype
Type of the output-decoding function to be passed to the process constructor.
Definition: sy_process_constructors_strict.hpp:1069
The strict zip process with two inputs and one output.
Definition: sy_process_constructors_strict.hpp:1463
smoore(const sc_module_name &_name, const ns_functype &_ns_func, const od_functype &_od_func, const ST &init_st)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:960
SY_out< T > oport1
port for the output channel
Definition: sy_process_constructors_strict.hpp:1329
SY_out< T0 > oport1
port for the output channel
Definition: sy_process_constructors_strict.hpp:429
SY_out< T0 > oport1
port for the output channel
Definition: sy_process_constructors_strict.hpp:135
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:1480
SY_in< IT > iport1
port for the input channel
Definition: sy_process_constructors_strict.hpp:946
SY_out< std::array< T0, N > > oport1
port for the output channel
Definition: sy_process_constructors_strict.hpp:699
SY_out< std::tuple< T1, T2 > > oport1
port for the output channel
Definition: sy_process_constructors_strict.hpp:1468
SY_out< T > oport1
port for the output channel
Definition: sy_process_constructors_strict.hpp:788
szipX(const sc_module_name &_name)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:1543
A data-parallel process constructor for a strict scan process with input and output array types...
Definition: sy_process_constructors_strict.hpp:695
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:249
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:1938
Implements the abstract process in the synchronous Model of Computation.
A data-parallel process constructor for a strict combinational process with input and output array ty...
Definition: sy_process_constructors_strict.hpp:508
The strict zipX process with an array of inputs and one output.
Definition: sy_process_constructors_strict.hpp:1533
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:1269
sdelayn(const sc_module_name &_name, const T &init_val, const unsigned int &n)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:873
The unzip process with one input and variable number of outputs.
Definition: sy_process_constructors_strict.hpp:1797
SY_out< T2 > oport2
port for the output channel 2
Definition: sy_process_constructors_strict.hpp:1679
SY_out< T0 > oport1
port for the output channel
Definition: sy_process_constructors_strict.hpp:593
SY_out< std::array< T0, N > > oport1
port for the output channel
Definition: sy_process_constructors_strict.hpp:512
SY_out< std::tuple< Ts... > > oport1
port for the output channel
Definition: sy_process_constructors_strict.hpp:1597
The sunzipX process with one input and an array of outputs.
Definition: sy_process_constructors_strict.hpp:1736
SY_in< std::array< T1, N > > iport1
port for the input channel
Definition: sy_process_constructors_strict.hpp:1739
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:349
SY_in< T2 > iport2
port for the input channel 2
Definition: sy_process_constructors_strict.hpp:322
Process constructor for a strict combinational process with three inputs and one output.
Definition: sy_process_constructors_strict.hpp:219
sunzip(const sc_module_name &_name)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:1685
The strict zip process with variable number of inputs and one output.
Definition: sy_process_constructors_strict.hpp:1593
std::array< SY_out< T1 >, N > oport
port array for the output channels
Definition: sy_process_constructors_strict.hpp:1740
sdelay(const sc_module_name &_name, const T &init_val)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:795
sdpscan(const sc_module_name &_name, const functype &_func, const T0 &init_res)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:709
SY_in< T1 > iport1
port for the input channel 1
Definition: sy_process_constructors_strict.hpp:133
std::function< void(T0 &, const T0 &, const T0 &)> functype
Type of the function to be passed to the process constructor.
Definition: sy_process_constructors_strict.hpp:596
sdpreduce(const sc_module_name &_name, const functype &_func)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:603
std::tuple< SY_out< Ts >... > oport
tuple of ports for the output channels
Definition: sy_process_constructors_strict.hpp:1801
SY_in< T1 > iport1
port for the input channel 1
Definition: sy_process_constructors_strict.hpp:321
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:1691
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:1417
sunzipX(const sc_module_name &_name)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:1746
SY_in< T2 > iport2
port for the input channel 2
Definition: sy_process_constructors_strict.hpp:134
SY_in< T2 > iport2
port for the input channel 2
Definition: sy_process_constructors_strict.hpp:1467
std::function< void(T0 &, const T1 &, const T2 &)> functype
Type of the function to be passed to the process constructor.
Definition: sy_process_constructors_strict.hpp:138
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:1752
SY_in< T > iport1
port for the input channel
Definition: sy_process_constructors_strict.hpp:1395
std::tuple< SY_in< Ts >... > iport
tuple of ports for the input channels
Definition: sy_process_constructors_strict.hpp:1596
SY_out< std::vector< T > > oport1
port for the output channel
Definition: sy_process_constructors_strict.hpp:1918
SY_out< T0 > oport1
port for the output channel
Definition: sy_process_constructors_strict.hpp:52
The process constructor which defines the abstract semantics of execution.
Definition: abssemantics.hpp:212
std::function< void(T0 &, const T1 &, const T2 &, const T3 &)> functype
Type of the function to be passed to the process constructor.
Definition: sy_process_constructors_strict.hpp:229
szip(const sc_module_name &_name)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:1474
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:1609
SY_in< std::array< T1, N > > iport1
port for the input channel 1
Definition: sy_process_constructors_strict.hpp:698
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:451
Process constructor for a strict combinational process with two inputs and one output.
Definition: sy_process_constructors_strict.hpp:130
Process constructor for a strict n-delay element.
Definition: sy_process_constructors_strict.hpp:862
scomb4(const sc_module_name &_name, const functype &_func)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:336
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:808
#define CHECK_PRESENCE(VAL)
Check for presence in run time.
Definition: abst_ext.hpp:117
Process constructor for a strict combinational process with four inputs and one output.
Definition: sy_process_constructors_strict.hpp:318
std::function< void(T0 &, const T0 &, const T1 &)> functype
Type of the function to be passed to the process constructor.
Definition: sy_process_constructors_strict.hpp:702
SY_in< T > iport1
port for the input channel
Definition: sy_process_constructors_strict.hpp:865
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:158
SY_in< std::tuple< Ts... > > iport1
port for the input channel
Definition: sy_process_constructors_strict.hpp:1800
SY_out< OT > oport1
port for the output channel
Definition: sy_process_constructors_strict.hpp:1063
Process constructor for a strict sink process.
Definition: sy_process_constructors_strict.hpp:1392
Process constructor for a strict combinational process with an array of inputs and one output...
Definition: sy_process_constructors_strict.hpp:425
std::function< void(T0 &, const std::array< T1, N > &)> functype
Type of the function to be passed to the process constructor.
Definition: sy_process_constructors_strict.hpp:432
std::function< void(OT &, const ST &)> od_functype
Type of the output-decoding function to be passed to the process constructor.
Definition: sy_process_constructors_strict.hpp:953
Process constructor for a strict source process with vector input.
Definition: sy_process_constructors_strict.hpp:1326
scombX(const sc_module_name &_name, const functype &_func)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:439
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:1813
SY_out< T0 > oport1
port for the output channel
Definition: sy_process_constructors_strict.hpp:325
SY_in< T3 > iport3
port for the input channel 3
Definition: sy_process_constructors_strict.hpp:224
SY_in< std::array< T0, N > > iport1
port for the input channel 1
Definition: sy_process_constructors_strict.hpp:592
std::function< void(const T &)> functype
Type of the function to be passed to the process constructor.
Definition: sy_process_constructors_strict.hpp:1398
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:890
SY_in< T3 > iport3
port for the input channel 3
Definition: sy_process_constructors_strict.hpp:323
std::string forsyde_kind() const
Specifying from which process constructor is the module built.
Definition: sy_process_constructors_strict.hpp:979
SY_out< std::array< T1, N > > oport1
port for the output channel
Definition: sy_process_constructors_strict.hpp:1537
Process constructor for a strict source process.
Definition: sy_process_constructors_strict.hpp:1236
Process constructor for a strict constant source process.
Definition: sy_process_constructors_strict.hpp:1164
SY_in< IT > iport1
port for the input channel
Definition: sy_process_constructors_strict.hpp:1062
Process constructor for a strict combinational process with one input and one output.
Definition: sy_process_constructors_strict.hpp:48
SY_out< T1 > oport1
port for the output channel 1
Definition: sy_process_constructors_strict.hpp:1678
smealy(const sc_module_name &_name, const ns_functype &_ns_func, const od_functype &_od_func, const ST &init_st)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:1076
sgroup(const sc_module_name &_name, const unsigned long &samples)
The constructor requires the module name.
Definition: sy_process_constructors_strict.hpp:1925
Process constructor for a strict Mealy machine.
Definition: sy_process_constructors_strict.hpp:1059
std::function< void(ST &, const ST &, const IT &)> ns_functype
Type of the next-state function to be passed to the process constructor.
Definition: sy_process_constructors_strict.hpp:1066