-
Notifications
You must be signed in to change notification settings - Fork 1
/
lt_pnode_top.h
executable file
·270 lines (238 loc) · 10.2 KB
/
lt_pnode_top.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
/*
*
* Author: Tatiana Djaba Nya (Lead author)
* Author: Stephan C. Stilkerich
*
* Reference Architecture Model (EPiCS FP7 FET program, No. 257906)
* - Peter R. Lewis, University of Birmingham
* - Xin Yao, University of Birmingham
*
* Copyright (c) 2013, EADS Deutschland GmbH, EADS Innovation Works
*
*==============================================================================
*
*This file is part of ProprioSimEnv.
*
* ProprioSimEnv is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProprioSimEnv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProprioSimEnv. If not, see <http://www.gnu.org/licenses/>.
*/
//========================================================================================
/// @file lt_pnode_top.h
//
/// @brief This is the module node, the highest level in the model hierarchy.
//
/// @details It is responsible for the generation of the number of sensors and
/// actuators specified by the user and for the necessary socket and port bindings between all
/// the TLM components of a proprioceptive node. <br>
/// Before grouping, it first make sure that the choosen values of constructor variables
/// are in the given limits. If this is not the case an error message is thrown and the
/// simulation is stopped.
//
//========================================================================================
#ifndef __lt_PNODE_TOP_H__
#define __lt_PNODE_TOP_H__
#include <tlm.h>
#include <systemc.h>
#include <tlm_utils\tlm_quantumkeeper.h>
#include "initiator_othernode.h"
#include "initiator_sensorenv.h"
#include "initiator_gvoc.h"
#include "target_sae.h"
#include "target_actuator.h"
#include "target_extaction.h"
#include "interconnect1.h"
#include "interconnect2.h"
#include "interconnect3.h"
#include "interconnect4.h"
#include "bridge_lmodel.h"
#include "bridge_monitor.h"
#include "bridge_see.h"
#include "constants.h"
class lt_pnode_top: public sc_module
{
public:
lt_pnode_top( sc_module_name name_ ///< sc module name
, unsigned int ID_ ///< Knoten ID
, unsigned int sensorenv_number_ ///< number of sensors and environment components
, unsigned int othernodes_in_number_ ///< number of connected nodes for data input
, unsigned int othernodes_out_number_ ///< number of connected nodes for data output
, unsigned int actuator_number_ ///< number of actuators
, unsigned int extaction_number_ ///< number of actuators
, unsigned int ic1initiator_data_length_ ///< max length of sensor data
, unsigned int gvoc_monitor_data_length_ ///< max length of gvoc data for the monitor
, unsigned int gvoc_see_data_length_ ///< max length of gvoc data for the see
, unsigned int lm_report_data_length_ ///< max length for lm result data
, unsigned int lm_result_data_length_ ///< max length for lm result data
, unsigned int see_report_data_length_ ///< max length for see report data
, unsigned int see_actions_data_length_ ///< max length of see actions data
, unsigned int ic1initiator_nr_dataset_cycle_ ///< number of sensor dataset per process cycle
, unsigned int lmresult_nr_dataset_cycle_ ///< number of LM result-dataset per process cycle
, unsigned int seeresult_nr_dataset_cycle_ ///< number of see actions-dataset per process cycle
, unsigned int gvocm_nr_dataset_cycle_ ///< number of gvoc monitor-dataset per process cycle
, unsigned int gvocsee_nr_dataset_cycle_ ///< number of gvoc see-dataset per process cycle
, sc_core::sc_time globales_quantum_ ///< time value of the global quantum for all processes
, unsigned int cycle_trigger_nr_ ///< process cycles interval to trigger the monitor
, unsigned int infifos_size_ ///< size of the fifo channel for incoming sensor data from the files
, unsigned int outfifos_size_ ///< size of the fifo channel for outgoing actuator data
, unsigned int nodenbr_ ///< Position index for the vectoors of events
);
public:
SC_HAS_PROCESS(lt_pnode_top);
void pn_thread( void ) ;
void print_keyparameters(void) ;
private:
unsigned int node_id ;
//komponentenanzahl
unsigned int sensorenv_number ;
unsigned int othernodes_in_number ;
unsigned int othernodes_out_number ;
unsigned int actuator_number ;
unsigned int ic1initiator_number ;
unsigned int ic4target_number ;
//datenlänge im Modell
unsigned int ic1initiator_data_length ;
unsigned int gvoc_monitor_data_length ;
unsigned int gvoc_see_data_length ;
unsigned int lm_report_data_length ;
unsigned int lm_result_data_length ;
unsigned int see_report_data_length ;
unsigned int see_actions_data_length ;
//Quantum
sc_core::sc_time glob_quantum ;
sc_core::sc_time node_delay ;
tlm_utils::tlm_quantumkeeper node_qk ;
//latenzzeiten im Modell
sc_core::sc_time sae_write_latency ;
sc_core::sc_time sae_read_latency ;
sc_core::sc_time monitor_write_latency ;
sc_core::sc_time lm_read_latency ;
sc_core::sc_time see_lm_write_latency ;
sc_core::sc_time see_gvoc_write_latency ;
sc_core::sc_time see_report_read_latency ;
sc_core::sc_time actuator_write_latency ;
sc_core::sc_time extaction_write_latency ;
//memory sizes
unsigned int sae_memory_size ;
unsigned int monitor_memory_size ;
unsigned int actuator_memory_size ;
unsigned int extaction_memory_size ;
unsigned int lm_reportmemory_size ;
unsigned int see_reportmemory_size ;
unsigned int see_lmmemory_size ;
unsigned int see_gvocmemory_size ;
initiator_gvoc gvoc ;
sc_core::sc_vector<initiator_sensorenv> sensorsenv ;
sc_core::sc_vector<initiator_othernode> the_others ;
sc_core::sc_vector<target_actuator> actuators ;
sc_core::sc_vector<target_extaction> extactions ;
target_sae sae ;
interconnect1 ic1 ;
interconnect2 ic2 ;
interconnect3 ic3 ;
interconnect4 ic4 ;
bridge_lmodel lmodel ;
bridge_monitor monitor ;
bridge_see see ;
public:
//For Data from sensors and environment
sc_core::sc_vector< sc_core::sc_fifo< datyp > > node_infifos ;
//For Data to other nodes
sc_core::sc_vector< sc_core::sc_fifo< sc_dt::uchar> > node_outfifos ;
//For Data from other nodes
sc_core::sc_vector< sc_core::sc_port< sc_core::sc_fifo_in_if<sc_dt::uchar> > > othernodes_inports ;
//======================================================================
/// @struct create_sensor_obj
//
/// @brief creates sensor objects
//
//======================================================================
struct create_sensor_obj
{
create_sensor_obj(unsigned int id, unsigned int dl, unsigned int dset_nr, sc_core::sc_time gq, unsigned int fs)
:cid(id), clength(dl), cgq(gq), cds_nr(dset_nr), cfs(fs){}
initiator_sensorenv* operator()(const char* name, size_t)
{
return new initiator_sensorenv(name, cid, clength, cds_nr, cgq, cfs);
}
unsigned int cid, clength, cds_nr, cfs ;
sc_core::sc_time cgq ;
};
//======================================================================
/// @struct create_actuator_obj
//
/// @brief creates actuator objects
//
//======================================================================
struct create_actuator_obj
{
create_actuator_obj(unsigned int id, unsigned int dl, unsigned int wd, sc_core::sc_time readlat, sc_core::sc_time writelat, sc_core::sc_time gq)
:cid(id), csize(dl), cwidth(wd), cwritelat(writelat), creadlat(readlat), cgq(gq){}
target_actuator* operator()(const char* name, size_t)
{
return new target_actuator(name, cid, csize, cwidth, creadlat, cwritelat, cgq);
}
unsigned int cid, csize, cwidth ;
sc_core::sc_time cwritelat, creadlat, cgq ;
};
//======================================================================
/// @struct create_othernode_obj
//
/// @brief creates othernode objects
//
//======================================================================
struct create_othernode_obj
{
create_othernode_obj(unsigned int id, unsigned int dl, unsigned int dset_nr, sc_core::sc_time gquantum)
:cid(id), csize(dl), cquantum(gquantum), cds_nr(dset_nr){}
initiator_othernode* operator()(const char* name, size_t)
{
return new initiator_othernode(name, cid, csize, cds_nr , cquantum);
}
unsigned int cid, csize, cds_nr ;
sc_core::sc_time cquantum ;
};
//======================================================================
/// @struct create_extaction_obj
//
/// @brief creates extaction objects
//
//======================================================================
struct create_extaction_obj
{
create_extaction_obj(unsigned int id, unsigned int dl, unsigned int wd, sc_core::sc_time readlat, sc_core::sc_time writelat)
:cid(id), csize(dl), cwidth(wd), cwritelat(writelat), creadlat(readlat){}
target_extaction* operator()(const char* name, size_t)
{
return new target_extaction(name, cid, csize, cwidth, creadlat, cwritelat);
}
unsigned int cid, csize, cwidth ;
sc_core::sc_time cwritelat, creadlat;
};
//======================================================================
/// @struct create_fifo_obj
//
/// @brief creates fifo objects
//
//======================================================================
struct create_fifo_obj
{
create_fifo_obj(int size)
:csize(size){}
sc_fifo<datyp>* operator()(const char* name, size_t)
{
return new sc_fifo<datyp>(name, csize);
}
int csize;
};
};
#endif /* __lt_pnode_top_H__ */