mi_helpers.hpp
Go to the documentation of this file.
1 /**********************************************************************
2  * mi_helpers.hpp -- Helper primitives for MoC interfaces *
3  * *
4  * Author: Hosein Attarzadeh (shan2@kth.se) *
5  * *
6  * Purpose: Providing helper primitives for modeling MIs *
7  * *
8  * Usage: This file is included automatically *
9  * *
10  * License: BSD3 *
11  *******************************************************************/
12 
13 #ifndef MI_HELPERS_HPP
14 #define MI_HELPERS_HPP
15 
23 #include <functional>
24 
25 #include "mis.hpp"
26 
27 namespace ForSyDe
28 {
29 
30 using namespace sc_core;
31 
33 
40 template <class OIf, class IIf>
41 inline SY2CT* make_SY2CT(std::string pName,
42  sc_time sample_period,
43  A2DMode op_mode,
44  OIf& outS,
45  IIf& inpS
46  )
47 {
48  auto p = new SY2CT(pName.c_str(), sample_period, op_mode);
49 
50  (*p).iport1(inpS);
51  (*p).oport1(outS);
52 
53  return p;
54 }
55 
57 
64 template <class OIf, class IIf>
65 inline CT2SY* make_CT2SY(std::string pName,
66  sc_time sample_period,
67  OIf& outS,
68  IIf& inpS
69  )
70 {
71  auto p = new CT2SY(pName.c_str(), sample_period);
72 
73  (*p).iport1(inpS);
74  (*p).oport1(outS);
75 
76  return p;
77 }
78 
80 
87 template <class T, template <class> class OIf, class IIf>
88 inline CT2DDE<T>* make_CT2DDE(std::string pName,
89  OIf<T>& outS,
90  IIf& inpS1,
92  )
93 {
94  auto p = new CT2DDE<T>(pName.c_str());
95 
96  (*p).iport1(inpS1);
97  (*p).iport2(inpS2);
98  (*p).oport1(outS);
99 
100  return p;
101 }
102 
104 
111 template <class T, template <class> class OIf, class IIf>
112 inline CT2DDEf<T>* make_CT2DDEf(std::string pName,
113  sc_time sampling_period,
114  OIf<T>& outS,
115  IIf& inpS
116  )
117 {
118  auto p = new CT2DDEf<T>(pName.c_str(), sampling_period);
119 
120  (*p).iport1(inpS);
121  (*p).oport1(outS);
122 
123  return p;
124 }
125 
127 
134 template <class T, class OIf, template <class> class IIf>
135 inline DDE2CT<T>* make_DDE2CT(std::string pName,
136  A2DMode op_mode,
137  OIf& outS,
138  IIf<T>& inpS
139  )
140 {
141  auto p = new DDE2CT<T>(pName.c_str(), op_mode);
142 
143  (*p).iport1(inpS);
144  (*p).oport1(outS);
145 
146  return p;
147 }
148 
150 
157 template <class T, template <class> class OIf, template <class> class IIf>
158 inline SY2SDF<T>* make_SY2SDF(std::string pName,
159  OIf<T>& outS,
160  IIf<T>& inpS
161  )
162 {
163  auto p = new SY2SDF<T>(pName.c_str());
164 
165  (*p).iport1(inpS);
166  (*p).oport1(outS);
167 
168  return p;
169 }
170 
172 
179 template <class T, template <class> class OIf, template <class> class IIf>
180 inline SDF2SY<T>* make_SDF2SY(std::string pName,
181  OIf<T>& outS,
182  IIf<T>& inpS
183  )
184 {
185  auto p = new SDF2SY<T>(pName.c_str());
186 
187  (*p).iport1(inpS);
188  (*p).oport1(outS);
189 
190  return p;
191 }
192 
194 
201 template <class T, template <class> class OIf, template <class> class IIf>
202 inline SY2DDE<T>* make_SY2DDE(std::string pName,
203  sc_time sample_period,
204  OIf<T>& outS,
205  IIf<T>& inpS
206  )
207 {
208  auto p = new SY2DDE<T>(pName.c_str(), sample_period);
209 
210  (*p).iport1(inpS);
211  (*p).oport1(outS);
212 
213  return p;
214 }
215 
217 
224 template <class T, template <class> class OIf, template <class> class IIf>
225 inline DDE2SY<T>* make_DDE2SY(std::string pName,
226  sc_time sample_period,
227  OIf<T>& outS,
228  IIf<T>& inpS
229  )
230 {
231  auto p = new DDE2SY<T>(pName.c_str(), sample_period);
232 
233  (*p).iport1(inpS);
234  (*p).oport1(outS);
235 
236  return p;
237 }
238 
239 }
240 
241 #endif
DDE2SY< T > * make_DDE2SY(std::string pName, sc_time sample_period, OIf< T > &outS, IIf< T > &inpS)
Helper function to construct an DDE2SY MoC interface.
Definition: mi_helpers.hpp:225
SY2DDE< T > * make_SY2DDE(std::string pName, sc_time sample_period, OIf< T > &outS, IIf< T > &inpS)
Helper function to construct an SY2DDE MoC interface.
Definition: mi_helpers.hpp:202
SDF::SDF_in< T > iport1
port for the input channel
Definition: mis.hpp:610
DDE::DDE_in< T > iport1
port for the input channel
Definition: mis.hpp:755
SDF2SY< T > * make_SDF2SY(std::string pName, OIf< T > &outS, IIf< T > &inpS)
Helper function to construct an SDF2SY MoC interface.
Definition: mi_helpers.hpp:180
SY2SDF< T > * make_SY2SDF(std::string pName, OIf< T > &outS, IIf< T > &inpS)
Helper function to construct an SY2SDF MoC interface.
Definition: mi_helpers.hpp:158
The namespace for ForSyDe.
Definition: abssemantics.hpp:30
The DDE_in port is used for input ports of DDE processes.
Definition: dde_process.hpp:56
Process constructor for a DDE2CT MoC interfaces.
Definition: mis.hpp:437
CT2DDE< T > * make_CT2DDE(std::string pName, OIf< T > &outS, IIf &inpS1, DDE::in_port< unsigned int > inpS2)
Helper function to construct an CT2DDE MoC interface.
Definition: mi_helpers.hpp:88
SY2CT * make_SY2CT(std::string pName, sc_time sample_period, A2DMode op_mode, OIf &outS, IIf &inpS)
Helper function to construct an SY2CT MoC interface.
Definition: mi_helpers.hpp:41
A2DMode
Operation modes for the SY2CT converter.
Definition: mis.hpp:30
Process constructor for a SY2DDE MoC interfaces.
Definition: mis.hpp:672
CT::CT_in iport1
port for the input channel
Definition: mis.hpp:365
CT2SY * make_CT2SY(std::string pName, sc_time sample_period, OIf &outS, IIf &inpS)
Helper function to construct an CT2SY MoC interface.
Definition: mi_helpers.hpp:65
CT::CT_in iport1
port for the input channel
Definition: mis.hpp:145
Implements the MoC interfaces between different MoCs.
SY::SY_in< T > iport1
port for the input channel
Definition: mis.hpp:539
Process constructor for a SY2SDF MoC interfaces.
Definition: mis.hpp:536
Process constructor for a SDF2SY MoC interface.
Definition: mis.hpp:607
Process constructor for a CT2DDE MoC interface.
Definition: mis.hpp:222
Process constructor for a CT2SY MoC interface.
Definition: mis.hpp:142
CT2DDEf< T > * make_CT2DDEf(std::string pName, sc_time sampling_period, OIf< T > &outS, IIf &inpS)
Helper function to construct an CT2DDEf MoC interface.
Definition: mi_helpers.hpp:112
CT::CT_in iport1
port for the input channel
Definition: mis.hpp:225
DDE2CT< T > * make_DDE2CT(std::string pName, A2DMode op_mode, OIf &outS, IIf< T > &inpS)
Helper function to construct an DDE2CT MoC interface.
Definition: mi_helpers.hpp:135
Process constructor for a CT2DDEf MoC interface.
Definition: mis.hpp:362
Process constructor for a SY2CT MoC interfaces.
Definition: mis.hpp:40
DDE::DDE_in< T > iport1
port for the input channel
Definition: mis.hpp:440
SY::SY_in< CTTYPE > iport1
port for the input channel
Definition: mis.hpp:43
SY::SY_in< T > iport1
port for the input channel
Definition: mis.hpp:675
Process constructor for a DDE2SY MoC interface.
Definition: mis.hpp:752