test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
sp_wrap.h
Go to the documentation of this file.
1 
2 #ifndef __sp_wrap_h_file__
3 #define __sp_wrap_h_file__
4 #include "vppc_sim_lib.h"
5 #include "sp.h"
6 
7 class sp_wrap
8 {
9  public:
10  void run
11  (
12  unsigned q__io[5][9][2],
13  unsigned wg__io[5][9][2],
14  unsigned hstr__io[5][9][2],
15  unsigned cpat__io[5][9][2],
16 
17  unsigned bt_phi__io [3],
18  unsigned bt_theta__io [3],
19  unsigned bt_cpattern__io [3],
20  // ph and th deltas from best stations
21  // [best_track_num], last index: [0] - best pair of stations, [1] - second best pair
22  unsigned bt_delta_ph__io [3][2],
23  unsigned bt_delta_th__io [3][2],
24  unsigned bt_sign_ph__io[3][2],
25  unsigned bt_sign_th__io[3][2],
26  // ranks [best_track_num]
27  unsigned bt_rank__io [3],
28  // segment IDs
29  // [best_track_num][station 0-3]
30  unsigned bt_vi__io [3][5], // valid
31  unsigned bt_hi__io [3][5], // bx index
32  unsigned bt_ci__io [3][5], // chamber
33  unsigned bt_si__io [3][5] // segment
34 
35  );
36  sp_wrap(){built = false; glbl_gsr = true; defparam();}
37 
38  void defparam();
39  void build();
40  bool built;
41  bool glbl_gsr;
42  unsigned station;
43  unsigned cscid;
44  unsigned max_ev;
45  // segments per chamber
46  unsigned seg_ch;
47  // bit widths of ph and th outputs, reduced precision
48 // have to be derived from pattern width on top level
49  unsigned bw_ph;
50  unsigned bw_th;
51  // bit widths of ph and th, full precision
52  unsigned bw_fph;
53  unsigned bw_fth;
54  // wiregroup input bit width (0..111)
55  unsigned bw_wg;
56  // bit width of dblstrip input (max 80 for ME234/1 with double-width strips)
57  unsigned bw_ds;
58  // width of halfstrip input
59  unsigned bw_hs;
60  // pattern half-width for stations 3,4
61  unsigned pat_w_st3; //4;
62  // pattern half-width for station 1
63  unsigned pat_w_st1;
64  // number of input bits for stations 3,4
65  unsigned full_pat_w_st3;
66  // number of input bits for st 1
67  unsigned full_pat_w_st1;
68  // width of zero padding for station copies
69  unsigned padding_w_st1;
70  unsigned padding_w_st3;
71  // full pattern widths (aka reduced pattern)
72  unsigned red_pat_w_st3;
73  unsigned red_pat_w_st1;
74  // number of folds for pattern detectors, do not set to 1
75  unsigned fold;
76  // number of th outputs for ME1/1
77  unsigned th_ch11;
78  unsigned bw_q;
79  unsigned bw_addr;
80  // strips per section, calculated so ph pattern would cover +/- 8 deg in st 1
81  unsigned ph_raw_w;
82  unsigned th_raw_w;
83  // max possible drifttime
84  unsigned max_drift;
85  // bit widths of precise phi and eta outputs
86  unsigned bw_phi;
87  unsigned bw_eta;
88  // width of ph raw hits, max coverage +8 to cover possible chamber displacement
89  unsigned ph_hit_w; //80 + 8;
90  // for 20 deg chambers
91  unsigned ph_hit_w20;
92  // for 10 deg chambers
93  unsigned ph_hit_w10; //40 + 8;
94  // width of th raw hits, max coverage +8 to cover possible chamber displacement
95  unsigned th_hit_w;
96  unsigned endcap;
97  unsigned n_strips;
98  unsigned n_wg;
99  // theta range (take +1 because th_coverage contains max th value starting from 0)
100  unsigned th_coverage;
101  // phi range
102  unsigned ph_coverage; //80 : 40;
103  // number of th outputs takes ME1/1 th duplication into account
104  unsigned th_ch;
105  // is this chamber mounted in reverse direction?
106  unsigned ph_reverse;
107  unsigned th_mem_sz;
108  unsigned th_corr_mem_sz;
109  // multiplier bit width (phi + factor)
110  unsigned mult_bw;
111  // ph zone boundaries for chambers that cover more than one zone
112 // hardcoded boundaries must match boundaries in ph_th_match module
113  unsigned ph_zone_bnd1;
114  unsigned ph_zone_bnd2;
115  unsigned zone_overlap;
116  // sorter parameters
117  unsigned bwr; // rank width
118  unsigned bpow; // (1 << bpow) is count of input ranks
119  unsigned cnr; // internal rank count
120  unsigned cnrex; // actual input rank count, must be even
121 
122  // io
127  // precise parameters
128 /*
129  * wire [bw_phi-1:0] phi [2:0];
130  wire [bw_eta-1:0] eta [2:0];
131  wire [12:0] pt [2:0];
132  wire [2:0] sign;
133  wire [3:0] modeMem [2:0];
134  wire [4:0] etaPT [2:0];
135  wire [2:0] FR;
140  signal_storage r_ini__storage; signal_ r_ini; // reg data for memory or register
141  signal_storage wei__storage; signal_ wei; // write enable for memory or register
143  // ph_init storage one bit wider, because ph_init is scaled at 0.1333 deg per bit
148  // event storage
181 
182  signal_storage r_outo__storage; signal_ r_outo; // output data from memory or register
183  // ph quality codes output [zone][key_strip]
196  // numbers of best ranks [zone][num]
198  // best ranks [zone][num]
201  signal_storage th_match__storage; signal_ th_match; // matching th, 2 segments
202  signal_storage th_match11__storage; signal_ th_match11; // matching th for ME11 (station 0 only), 4 segments (due to th duplication)
203  // precise phi and theta of best tracks
204 // [best_track_num]
208  // ph and th deltas from best stations
209 // [best_track_num], last index: [0] - best pair of stations, [1] - second best pair
214  // ranks [best_track_num]
216  // segment IDs
217 // [best_track_num][station 0-3]
225 
256  unsigned k;
257 
258  void init ();
259  void operator()
260  (
261  );
263 
264 
265 };
266 #endif
signal_ isg
Definition: sp_wrap.h:255
signal_ begin_time
Definition: sp_wrap.h:222
signal_ ipr
Definition: sp_wrap.h:235
signal_storage patt_ci__storage
Definition: sp_wrap.h:194
signal_ good_ev
Definition: sp_wrap.h:175
signal_ v3
Definition: sp_wrap.h:156
signal_ ph_init
Definition: sp_wrap.h:144
signal_storage bt_rank__storage
Definition: sp_wrap.h:215
unsigned ph_raw_w
Definition: sp_wrap.h:81
signal_storage elapsed_time__storage
Definition: sp_wrap.h:224
signal_ _station
Definition: sp_wrap.h:165
unsigned bpow
Definition: sp_wrap.h:118
signal_ _quality
Definition: sp_wrap.h:170
signal_ bt_delta_ph
Definition: sp_wrap.h:210
unsigned n_strips
Definition: sp_wrap.h:97
signal_ _sector
Definition: sp_wrap.h:163
signal_storage bt_hi__storage
Definition: sp_wrap.h:219
signal_storage ph_ranko__storage
Definition: sp_wrap.h:184
unsigned bw_hs
Definition: sp_wrap.h:59
unsigned mult_bw
Definition: sp_wrap.h:110
signal_storage b__storage
Definition: sp_wrap.h:178
signal_ _pattern
Definition: sp_wrap.h:171
signal_ line
Definition: sp_wrap.h:173
signal_storage ii__storage
Definition: sp_wrap.h:229
signal_ iz
Definition: sp_wrap.h:239
signal_storage cpati__storage
Definition: sp_wrap.h:126
signal_ si
Definition: sp_wrap.h:251
signal_storage v2__storage
Definition: sp_wrap.h:155
signal_ vl
Definition: sp_wrap.h:188
signal_storage _wiregroup__storage
Definition: sp_wrap.h:172
signal_storage wei__storage
Definition: sp_wrap.h:141
signal_ bt_hi
Definition: sp_wrap.h:219
signal_storage ibx__storage
Definition: sp_wrap.h:253
signal_storage patt_hi__storage
Definition: sp_wrap.h:193
signal_storage _event__storage
Definition: sp_wrap.h:160
signal_ qi
Definition: sp_wrap.h:123
signal_ quality
Definition: sp_wrap.h:149
signal_storage st_cnt__storage
Definition: sp_wrap.h:248
signal_ icid
Definition: sp_wrap.h:234
signal_ _endcap
Definition: sp_wrap.h:162
unsigned bw_phi
Definition: sp_wrap.h:86
signal_ bt_ci
Definition: sp_wrap.h:220
signal_storage _sector__storage
Definition: sp_wrap.h:163
unsigned seg_ch
Definition: sp_wrap.h:46
signal_ pr_cnt
Definition: sp_wrap.h:159
unsigned full_pat_w_st1
Definition: sp_wrap.h:67
signal_storage st__storage
Definition: sp_wrap.h:247
signal_storage in__storage
Definition: sp_wrap.h:241
signal_ j
Definition: sp_wrap.h:231
signal_ bt_rank
Definition: sp_wrap.h:215
unsigned th_coverage
Definition: sp_wrap.h:100
signal_storage isg__storage
Definition: sp_wrap.h:255
signal_storage a__storage
Definition: sp_wrap.h:177
signal_storage ph_zone__storage
Definition: sp_wrap.h:191
bool glbl_gsr
Definition: sp_wrap.h:41
signal_storage me11a__storage
Definition: sp_wrap.h:190
signal_storage quality__storage
Definition: sp_wrap.h:149
signal_ bt_delta_th
Definition: sp_wrap.h:211
signal_ ibx
Definition: sp_wrap.h:253
signal_storage patt_si__storage
Definition: sp_wrap.h:195
unsigned bw_eta
Definition: sp_wrap.h:87
unsigned bwr
Definition: sp_wrap.h:117
unsigned cnrex
Definition: sp_wrap.h:120
signal_ r_outo
Definition: sp_wrap.h:182
signal_storage end_time__storage
Definition: sp_wrap.h:223
signal_storage bt_delta_ph__storage
Definition: sp_wrap.h:210
unsigned th_raw_w
Definition: sp_wrap.h:82
signal_storage d__storage
Definition: sp_wrap.h:179
signal_ ph_num
Definition: sp_wrap.h:197
signal_storage vl__storage
Definition: sp_wrap.h:188
signal_storage ev__storage
Definition: sp_wrap.h:174
signal_storage good_ev_cnt__storage
Definition: sp_wrap.h:244
signal_storage pi__storage
Definition: sp_wrap.h:230
signal_ _valid
Definition: sp_wrap.h:169
signal_storage ist__storage
Definition: sp_wrap.h:233
signal_storage bt_ci__storage
Definition: sp_wrap.h:220
signal_ ph_ranko
Definition: sp_wrap.h:184
signal_storage hstri__storage
Definition: sp_wrap.h:125
signal_ ph_disp
Definition: sp_wrap.h:146
signal_storage th__storage
Definition: sp_wrap.h:187
unsigned th_corr_mem_sz
Definition: sp_wrap.h:108
signal_storage best_tracks__storage
Definition: sp_wrap.h:242
signal_storage bt_delta_th__storage
Definition: sp_wrap.h:211
unsigned ph_hit_w10
Definition: sp_wrap.h:93
signal_storage seli__storage
Definition: sp_wrap.h:138
signal_ iev
Definition: sp_wrap.h:237
signal_ bt_cpattern
Definition: sp_wrap.h:207
void run(unsigned q__io[5][9][2], unsigned wg__io[5][9][2], unsigned hstr__io[5][9][2], unsigned cpat__io[5][9][2], unsigned bt_phi__io[3], unsigned bt_theta__io[3], unsigned bt_cpattern__io[3], unsigned bt_delta_ph__io[3][2], unsigned bt_delta_th__io[3][2], unsigned bt_sign_ph__io[3][2], unsigned bt_sign_th__io[3][2], unsigned bt_rank__io[3], unsigned bt_vi__io[3][5], unsigned bt_hi__io[3][5], unsigned bt_ci__io[3][5], unsigned bt_si__io[3][5])
signal_ csi
Definition: sp_wrap.h:136
signal_storage wiregroup__storage
Definition: sp_wrap.h:150
signal_storage pr_cnt__storage
Definition: sp_wrap.h:159
signal_ ev
Definition: sp_wrap.h:174
void init()
signal_ _event
Definition: sp_wrap.h:160
unsigned ph_hit_w
Definition: sp_wrap.h:89
Definition: sp_wrap.h:7
signal_storage _subsector__storage
Definition: sp_wrap.h:164
void build()
signal_ patt_si
Definition: sp_wrap.h:195
signal_ r_ini
Definition: sp_wrap.h:140
signal_storage ph__storage
Definition: sp_wrap.h:185
signal_ th_match
Definition: sp_wrap.h:201
signal_storage ph_match__storage
Definition: sp_wrap.h:200
signal_storage i__storage
Definition: sp_wrap.h:228
signal_storage bt_sign_ph__storage
Definition: sp_wrap.h:212
signal_storage pts__storage
Definition: sp_wrap.h:180
unsigned ph_coverage
Definition: sp_wrap.h:102
signal_storage code__storage
Definition: sp_wrap.h:236
signal_storage clctpat__storage
Definition: sp_wrap.h:152
signal_ pts
Definition: sp_wrap.h:180
signal_ ich
Definition: sp_wrap.h:254
unsigned n_wg
Definition: sp_wrap.h:98
signal_ th_match11
Definition: sp_wrap.h:202
signal_ bt_si
Definition: sp_wrap.h:221
signal_ me11a
Definition: sp_wrap.h:190
signal_storage th_match__storage
Definition: sp_wrap.h:201
signal_ _halfstrip
Definition: sp_wrap.h:168
signal_ bt_sign_ph
Definition: sp_wrap.h:212
signal_storage ip__storage
Definition: sp_wrap.h:252
signal_storage ich__storage
Definition: sp_wrap.h:254
unsigned padding_w_st3
Definition: sp_wrap.h:70
signal_storage j__storage
Definition: sp_wrap.h:231
signal_storage r_outo__storage
Definition: sp_wrap.h:182
unsigned bw_fth
Definition: sp_wrap.h:53
unsigned bw_wg
Definition: sp_wrap.h:55
signal_storage v0__storage
Definition: sp_wrap.h:153
signal_storage _pattern__storage
Definition: sp_wrap.h:171
signal_storage iev__storage
Definition: sp_wrap.h:237
signal_ bt_phi
Definition: sp_wrap.h:205
signal_storage patt_vi__storage
Definition: sp_wrap.h:192
signal_ ist
Definition: sp_wrap.h:233
unsigned ph_zone_bnd2
Definition: sp_wrap.h:114
signal_storage _endcap__storage
Definition: sp_wrap.h:162
signal_ wgi
Definition: sp_wrap.h:124
signal_ b
Definition: sp_wrap.h:178
unsigned max_ev
Definition: sp_wrap.h:44
unsigned full_pat_w_st3
Definition: sp_wrap.h:65
signal_ cpati
Definition: sp_wrap.h:126
void defparam()
signal_ phzvl
Definition: sp_wrap.h:189
signal_storage bt_phi__storage
Definition: sp_wrap.h:205
unsigned zone_overlap
Definition: sp_wrap.h:115
signal_ s
Definition: sp_wrap.h:227
signal_storage ph_init__storage
Definition: sp_wrap.h:144
signal_ found_cand
Definition: sp_wrap.h:246
signal_ wei
Definition: sp_wrap.h:141
signal_storage v5__storage
Definition: sp_wrap.h:158
signal_ best_tracks
Definition: sp_wrap.h:242
signal_ a
Definition: sp_wrap.h:177
signal_storage iadr__storage
Definition: sp_wrap.h:226
signal_ th_disp
Definition: sp_wrap.h:147
signal_storage ph_disp__storage
Definition: sp_wrap.h:146
signal_storage csi__storage
Definition: sp_wrap.h:136
signal_ _bx_jitter
Definition: sp_wrap.h:161
signal_ code
Definition: sp_wrap.h:236
signal_ addri
Definition: sp_wrap.h:139
signal_ _bend
Definition: sp_wrap.h:167
signal_ th_init
Definition: sp_wrap.h:145
signal_ in
Definition: sp_wrap.h:241
signal_ tphi
Definition: sp_wrap.h:176
signal_storage th_disp__storage
Definition: sp_wrap.h:147
signal_storage r_ini__storage
Definition: sp_wrap.h:140
signal_ clctpat
Definition: sp_wrap.h:152
signal_storage th_init__storage
Definition: sp_wrap.h:145
signal_storage th11__storage
Definition: sp_wrap.h:186
unsigned ph_zone_bnd1
Definition: sp_wrap.h:113
signal_ sn
Definition: sp_wrap.h:232
signal_ ph_zone
Definition: sp_wrap.h:191
signal_storage stat__storage
Definition: sp_wrap.h:243
signal_ st_cnt
Definition: sp_wrap.h:248
signal_ _wiregroup
Definition: sp_wrap.h:172
signal_ pps_csi
Definition: sp_wrap.h:137
signal_ ph
Definition: sp_wrap.h:185
signal_storage pps_csi__storage
Definition: sp_wrap.h:137
signal_storage _bend__storage
Definition: sp_wrap.h:167
signal_storage s__storage
Definition: sp_wrap.h:227
signal_storage phzvl__storage
Definition: sp_wrap.h:189
signal_ seli
Definition: sp_wrap.h:138
signal_ stat
Definition: sp_wrap.h:243
signal_ ip
Definition: sp_wrap.h:252
unsigned bw_q
Definition: sp_wrap.h:78
signal_storage v1__storage
Definition: sp_wrap.h:154
signal_storage tphi__storage
Definition: sp_wrap.h:176
signal_storage _station__storage
Definition: sp_wrap.h:165
signal_ bt_sign_th
Definition: sp_wrap.h:213
signal_storage qi__storage
Definition: sp_wrap.h:123
signal_ i
Definition: sp_wrap.h:228
signal_storage _halfstrip__storage
Definition: sp_wrap.h:168
signal_storage bt_vi__storage
Definition: sp_wrap.h:218
signal_ v4
Definition: sp_wrap.h:157
signal_ d
Definition: sp_wrap.h:179
signal_ iseg
Definition: sp_wrap.h:249
signal_storage sn__storage
Definition: sp_wrap.h:232
unsigned th_hit_w
Definition: sp_wrap.h:95
unsigned ph_hit_w20
Definition: sp_wrap.h:91
signal_ ph_match
Definition: sp_wrap.h:200
signal_ zi
Definition: sp_wrap.h:250
sp_wrap()
Definition: sp_wrap.h:36
unsigned bw_th
Definition: sp_wrap.h:50
signal_ pi
Definition: sp_wrap.h:230
unsigned bw_ph
Definition: sp_wrap.h:49
signal_storage line__storage
Definition: sp_wrap.h:173
signal_storage wgi__storage
Definition: sp_wrap.h:124
unsigned th_ch11
Definition: sp_wrap.h:77
signal_storage bt_cpattern__storage
Definition: sp_wrap.h:207
signal_ v2
Definition: sp_wrap.h:155
signal_storage bt_si__storage
Definition: sp_wrap.h:221
signal_ bt_vi
Definition: sp_wrap.h:218
signal_storage ipr__storage
Definition: sp_wrap.h:235
signal_storage _quality__storage
Definition: sp_wrap.h:170
unsigned red_pat_w_st3
Definition: sp_wrap.h:72
signal_storage clki__storage
Definition: sp_wrap.h:142
unsigned bw_addr
Definition: sp_wrap.h:79
signal_ hstrip
Definition: sp_wrap.h:151
signal_storage begin_time__storage
Definition: sp_wrap.h:222
signal_storage th_match11__storage
Definition: sp_wrap.h:202
signal_ elapsed_time
Definition: sp_wrap.h:224
signal_storage v3__storage
Definition: sp_wrap.h:156
signal_ th11
Definition: sp_wrap.h:186
signal_ _subsector
Definition: sp_wrap.h:164
signal_storage found_cand__storage
Definition: sp_wrap.h:246
signal_ bt_theta
Definition: sp_wrap.h:206
signal_storage good_ev__storage
Definition: sp_wrap.h:175
signal_ iadr
Definition: sp_wrap.h:226
unsigned red_pat_w_st1
Definition: sp_wrap.h:73
unsigned bw_fph
Definition: sp_wrap.h:52
signal_ patt_vi
Definition: sp_wrap.h:192
signal_storage _valid__storage
Definition: sp_wrap.h:169
signal_ v5
Definition: sp_wrap.h:158
signal_storage icid__storage
Definition: sp_wrap.h:234
unsigned bw_ds
Definition: sp_wrap.h:57
signal_ end_time
Definition: sp_wrap.h:223
signal_ v1
Definition: sp_wrap.h:154
signal_storage bt_theta__storage
Definition: sp_wrap.h:206
signal_storage addri__storage
Definition: sp_wrap.h:139
signal_ wiregroup
Definition: sp_wrap.h:150
unsigned th_ch
Definition: sp_wrap.h:104
signal_storage ir__storage
Definition: sp_wrap.h:240
unsigned th_mem_sz
Definition: sp_wrap.h:107
signal_storage bt_sign_th__storage
Definition: sp_wrap.h:213
signal_ im
Definition: sp_wrap.h:238
signal_storage ph_num__storage
Definition: sp_wrap.h:197
signal_ ph_q
Definition: sp_wrap.h:199
signal_ good_ev_cnt
Definition: sp_wrap.h:244
unsigned padding_w_st1
Definition: sp_wrap.h:69
signal_ hstri
Definition: sp_wrap.h:125
Definition: sp.h:21
signal_ patt_hi
Definition: sp_wrap.h:193
unsigned fold
Definition: sp_wrap.h:75
signal_storage hstrip__storage
Definition: sp_wrap.h:151
unsigned ph_reverse
Definition: sp_wrap.h:106
signal_storage zi__storage
Definition: sp_wrap.h:250
unsigned cnr
Definition: sp_wrap.h:119
unsigned pat_w_st3
Definition: sp_wrap.h:61
signal_storage _bx_jitter__storage
Definition: sp_wrap.h:161
unsigned k
Definition: sp_wrap.h:256
unsigned pat_w_st1
Definition: sp_wrap.h:63
signal_ patt_ci
Definition: sp_wrap.h:194
bool built
Definition: sp_wrap.h:40
signal_storage iseg__storage
Definition: sp_wrap.h:249
signal_ ir
Definition: sp_wrap.h:240
signal_ _cscid
Definition: sp_wrap.h:166
signal_storage _cscid__storage
Definition: sp_wrap.h:166
signal_ v0
Definition: sp_wrap.h:153
sp uut
Definition: sp_wrap.h:262
unsigned cscid
Definition: sp_wrap.h:43
unsigned endcap
Definition: sp_wrap.h:96
signal_storage iz__storage
Definition: sp_wrap.h:239
signal_storage ph_q__storage
Definition: sp_wrap.h:199
signal_storage im__storage
Definition: sp_wrap.h:238
signal_ th
Definition: sp_wrap.h:187
unsigned max_drift
Definition: sp_wrap.h:84
signal_storage v4__storage
Definition: sp_wrap.h:157
signal_ ii
Definition: sp_wrap.h:229
signal_ st
Definition: sp_wrap.h:247
signal_ found_tr
Definition: sp_wrap.h:245
unsigned station
Definition: sp_wrap.h:42
signal_ clki
Definition: sp_wrap.h:142
signal_storage si__storage
Definition: sp_wrap.h:251
signal_storage found_tr__storage
Definition: sp_wrap.h:245