Belle II Software
release-08-01-10
TRGUT2Template.cc
1
/**************************************************************************
2
* basf2 (Belle II Analysis Software Framework) *
3
* Author: The Belle II Collaboration *
4
* *
5
* See git log for contributors and copyright holders. *
6
* This file is licensed under LGPL-3.0, see LICENSE.md. *
7
**************************************************************************/
8
9
#define TRG_SHORT_NAMES
10
11
#include <iostream>
12
#include <fstream>
13
#include <string>
14
#include "trg/trg/Utilities.h"
15
16
using namespace
std;
17
using namespace
Belle2
;
18
19
#define DEBUG_LEVEL 0
20
#define NAME "TRGUT2Template"
21
#define VERSION "version 0.00"
22
#define NOT_CONNECTED 99999
23
24
int
vhdlVersion0(ofstream&);
25
int
ucfVersion0(ofstream&);
26
27
int
28
main
(
int
argc,
const
char
* argv[])
29
{
30
31
cout << NAME <<
" ... "
<< VERSION << endl;
32
const
string
tab =
" "
;
33
34
//...Check arguments...
35
if
(argc > 2) {
36
cout << NAME <<
" !!! two many arguments"
<< endl
37
<< tab <<
" 1 : template version"
<< endl;
38
return
-1;
39
}
40
41
//...Template version...
42
string
version =
"latest"
;
43
if
(argc == 2)
44
version = argv[1];
45
if
(version ==
"latest"
)
46
version =
"0"
;
47
48
//...Version check...
49
if
(version !=
"0"
) {
50
cout << NAME <<
" !!! no such a version"
<< endl
51
<< tab <<
" 0 : 1st version"
<< endl;
52
return
-1;
53
}
54
55
//...Date...
56
string
ts0 = TRGUtil::dateStringF();
57
string
ts1 = TRGUtil::dateString();
58
59
//...1st argument...
60
const
string
vname =
"TRGUT2Template_"
+ version +
"_"
+ ts0 +
".vhd"
;
61
const
string
uname =
"TRGUT2Template_"
+ version +
"_"
+ ts0 +
".ucf"
;
62
63
//...Open vhdl file...
64
ofstream vout(vname.c_str(), ios::out);
65
if
(vout.fail()) {
66
cout << NAME <<
" !!! can not open file"
<< endl
67
<<
" "
<< vname << endl;
68
return
-2;
69
}
70
71
//...Main...
72
cout << NAME <<
" ... generating VHDL file"
<< endl;
73
vout <<
"-- Generated by "
<< NAME <<
" "
<< VERSION << endl;
74
vout <<
"-- Template version "
<< version << endl;
75
vout <<
"-- "
<< ts1 << endl;
76
vout <<
"--"
<< endl;
77
vhdlVersion0(vout);
78
vout.close();
79
80
//...Open ucf file...
81
ofstream uout(uname.c_str(), ios::out);
82
if
(uout.fail()) {
83
cout << NAME <<
" !!! can not open file"
<< endl
84
<<
" "
<< uname << endl;
85
return
-3;
86
}
87
88
//...Main...
89
cout << NAME <<
" ... generating UCF file"
<< endl;
90
uout <<
"-- Generated by "
<< NAME <<
" "
<< VERSION << endl;
91
uout <<
"-- Template version "
<< version << endl;
92
uout <<
"-- "
<< ts1 << endl;
93
uout <<
"--"
<< endl;
94
ucfVersion0(uout);
95
uout.close();
96
97
//...Termination...
98
cout << NAME <<
" ... terminated"
<< endl;
99
return
0;
100
}
101
102
int
103
vhdlVersion0(ofstream&)
104
{
105
return
0;
106
}
107
108
int
109
ucfVersion0(ofstream& uout)
110
{
111
uout <<
"###############################################################################"
<< endl;
112
uout <<
"###############################################################################"
<< endl;
113
uout <<
"#...GTP CLOCK Locations..."
<< endl;
114
uout <<
"NET REFCLK_P LOC=V4;"
<< endl;
115
uout <<
"NET REFCLK_N LOC=V3;"
<< endl;
116
uout <<
""
<< endl;
117
uout <<
"#...Clock..."
<< endl;
118
uout <<
"NET CLK42M LOC=AL27;"
<< endl;
119
uout <<
""
<< endl;
120
uout <<
"#...LEDs..."
<< endl;
121
uout <<
"NET LED_STAT_X<0> LOC=N25;"
<< endl;
122
uout <<
"NET LED_STAT_X<1> LOC=P25;"
<< endl;
123
uout <<
"NET LED_STAT_X<2> LOC=P18;"
<< endl;
124
uout <<
"NET LED_STAT_X<3> LOC=P17;"
<< endl;
125
uout <<
"NET LED_PWR_X LOC=P26;"
<< endl;
126
uout <<
"NET LED_CLK_X LOC=N26;"
<< endl;
127
uout <<
""
<< endl;
128
uout <<
"#...NIM..."
<< endl;
129
uout <<
"NET TRG_IN LOC=R8;"
<< endl;
130
uout <<
"NET TRG_OUT LOC=F6;"
<< endl;
131
uout <<
"NET BUSY_IN LOC=F7;"
<< endl;
132
uout <<
"NET BUSY_OUT LOC=R7;"
<< endl;
133
uout <<
"NET CLK_IN LOC=AN15;"
<< endl;
134
uout <<
"NET CLK_OUT LOC=N9;"
<< endl;
135
uout <<
""
<< endl;
136
uout <<
"#...VME bus..."
<< endl;
137
uout <<
"NET LWORD_X LOC=H41;"
<< endl;
138
uout <<
"NET DS0_X LOC=G42;"
<< endl;
139
uout <<
"NET DS1_X LOC=F41;"
<< endl;
140
uout <<
"NET WRITE_X LOC=F42;"
<< endl;
141
uout <<
"NET IACK_X LOC=R39;"
<< endl;
142
uout <<
"NET IACKIN_X LOC=J41;"
<< endl;
143
uout <<
"NET BERR_X LOC=N38;"
<< endl;
144
uout <<
"NET IACKOUT_X LOC=P37;"
<< endl;
145
uout <<
"NET DIRL LOC=T42;"
<< endl;
146
uout <<
"NET DIRH LOC=U42;"
<< endl;
147
uout <<
"NET OEBL LOC=U41;"
<< endl;
148
uout <<
"NET OEBH LOC=V41;"
<< endl;
149
uout <<
"NET DTACK_X LOC=R37;"
<< endl;
150
uout <<
"NET IRQ_X LOC=P38;"
<< endl;
151
uout <<
"NET AM<0> LOC=V40;"
<< endl;
152
uout <<
"NET AM<1> LOC=W41;"
<< endl;
153
uout <<
"NET AM<2> LOC=W42;"
<< endl;
154
uout <<
"NET AM<3> LOC=Y42;"
<< endl;
155
uout <<
"NET AM<4> LOC=AA42;"
<< endl;
156
uout <<
"NET AM<5> LOC=AA41;"
<< endl;
157
uout <<
"NET AS_X LOC=G41;"
<< endl;
158
uout <<
""
<< endl;
159
uout <<
"NET VMEA<1> LOC=AL40;"
<< endl;
160
uout <<
"NET VMEA<2> LOC=AL41;"
<< endl;
161
uout <<
"NET VMEA<3> LOC=AK42;"
<< endl;
162
uout <<
"NET VMEA<4> LOC=AL42;"
<< endl;
163
uout <<
"NET VMEA<5> LOC=AM42;"
<< endl;
164
uout <<
"NET VMEA<6> LOC=AM41;"
<< endl;
165
uout <<
"NET VMEA<7> LOC=AN41;"
<< endl;
166
uout <<
"NET VMEA<8> LOC=AP42;"
<< endl;
167
uout <<
"NET VMEA<9> LOC=AP41;"
<< endl;
168
uout <<
"NET VMEA<10> LOC=AR42;"
<< endl;
169
uout <<
"NET VMEA<11> LOC=AT42;"
<< endl;
170
uout <<
"NET VMEA<12> LOC=AT41;"
<< endl;
171
uout <<
"NET VMEA<13> LOC=AU41;"
<< endl;
172
uout <<
"NET VMEA<14> LOC=AU42;"
<< endl;
173
uout <<
"NET VMEA<15> LOC=AV41;"
<< endl;
174
uout <<
"NET VMEA<16> LOC=J42;"
<< endl;
175
uout <<
"NET VMEA<17> LOC=K42;"
<< endl;
176
uout <<
"NET VMEA<18> LOC=L40;"
<< endl;
177
uout <<
"NET VMEA<19> LOC=L41;"
<< endl;
178
uout <<
"NET VMEA<20> LOC=L42;"
<< endl;
179
uout <<
"NET VMEA<21> LOC=M41;"
<< endl;
180
uout <<
"NET VMEA<22> LOC=M42;"
<< endl;
181
uout <<
"NET VMEA<23> LOC=N41;"
<< endl;
182
uout <<
"NET VMEA<24> LOC=H36;"
<< endl;
183
uout <<
"NET VMEA<25> LOC=G37;"
<< endl;
184
uout <<
"NET VMEA<26> LOC=F36;"
<< endl;
185
uout <<
"NET VMEA<27> LOC=G36;"
<< endl;
186
uout <<
"NET VMEA<28> LOC=F37;"
<< endl;
187
uout <<
"NET VMEA<29> LOC=E37;"
<< endl;
188
uout <<
"NET VMEA<30> LOC=E38;"
<< endl;
189
uout <<
"NET VMEA<31> LOC=D37;"
<< endl;
190
uout <<
""
<< endl;
191
uout <<
"NET VMED<0> LOC=N40;"
<< endl;
192
uout <<
"NET VMED<1> LOC=P40;"
<< endl;
193
uout <<
"NET VMED<2> LOC=W40;"
<< endl;
194
uout <<
"NET VMED<3> LOC=Y40;"
<< endl;
195
uout <<
"NET VMED<4> LOC=AA40;"
<< endl;
196
uout <<
"NET VMED<5> LOC=AA39;"
<< endl;
197
uout <<
"NET VMED<6> LOC=Y39;"
<< endl;
198
uout <<
"NET VMED<7> LOC=Y38;"
<< endl;
199
uout <<
"NET VMED<8> LOC=Y37;"
<< endl;
200
uout <<
"NET VMED<9> LOC=AA37;"
<< endl;
201
uout <<
"NET VMED<10> LOC=R42;"
<< endl;
202
uout <<
"NET VMED<11> LOC=P42;"
<< endl;
203
uout <<
"NET VMED<12> LOC=P41;"
<< endl;
204
uout <<
"NET VMED<13> LOC=R40;"
<< endl;
205
uout <<
"NET VMED<14> LOC=T40;"
<< endl;
206
uout <<
"NET VMED<15> LOC=T41;"
<< endl;
207
uout <<
"NET VMED<16> LOC=H38;"
<< endl;
208
uout <<
"NET VMED<17> LOC=H39;"
<< endl;
209
uout <<
"NET VMED<18> LOC=G38;"
<< endl;
210
uout <<
"NET VMED<19> LOC=G39;"
<< endl;
211
uout <<
"NET VMED<20> LOC=F39;"
<< endl;
212
uout <<
"NET VMED<21> LOC=F40;"
<< endl;
213
uout <<
"NET VMED<22> LOC=E39;"
<< endl;
214
uout <<
"NET VMED<23> LOC=E40;"
<< endl;
215
uout <<
"NET VMED<24> LOC=L36;"
<< endl;
216
uout <<
"NET VMED<25> LOC=L35;"
<< endl;
217
uout <<
"NET VMED<26> LOC=K35;"
<< endl;
218
uout <<
"NET VMED<27> LOC=J35;"
<< endl;
219
uout <<
"NET VMED<28> LOC=H35;"
<< endl;
220
uout <<
"NET VMED<29> LOC=J36;"
<< endl;
221
uout <<
"NET VMED<30> LOC=K37;"
<< endl;
222
uout <<
"NET VMED<31> LOC=J37;"
<< endl;
223
uout <<
""
<< endl;
224
uout <<
"#...Logic Analyzer (LA1)..."
<< endl;
225
uout <<
"NET LA1<0> LOC=P7;"
<< endl;
226
uout <<
"NET LA1<1> LOC=P8;"
<< endl;
227
uout <<
"NET LA1<2> LOC=D7;"
<< endl;
228
uout <<
"NET LA1<3> LOC=V9;"
<< endl;
229
uout <<
"NET LA1<4> LOC=V10;"
<< endl;
230
uout <<
"NET LA1<5> LOC=F9;"
<< endl;
231
uout <<
"NET LA1<6> LOC=G9;"
<< endl;
232
uout <<
"NET LA1<7> LOC=G7;"
<< endl;
233
uout <<
"NET LA1<8> LOC=G8;"
<< endl;
234
uout <<
"NET LA1<9> LOC=U8;"
<< endl;
235
uout <<
"NET LA1<10> LOC=U9;"
<< endl;
236
uout <<
"NET LA1<11> LOC=H8;"
<< endl;
237
uout <<
"NET LA1<12> LOC=H9;"
<< endl;
238
uout <<
"NET LA1<13> LOC=T10;"
<< endl;
239
uout <<
"NET LA1<14> LOC=T11;"
<< endl;
240
uout <<
"NET LA1<15> LOC=J8;"
<< endl;
241
uout <<
"NET LA1<16> LOC=J7;"
<< endl;
242
uout <<
"NET LA1<17> LOC=U11;"
<< endl;
243
uout <<
"NET LA1<18> LOC=V11;"
<< endl;
244
uout <<
"NET LA1<19> LOC=K8;"
<< endl;
245
uout <<
"NET LA1<20> LOC=K9;"
<< endl;
246
uout <<
"NET LA1<21> LOC=K7;"
<< endl;
247
uout <<
"NET LA1<22> LOC=L7;"
<< endl;
248
uout <<
"NET LA1<23> LOC=M7;"
<< endl;
249
uout <<
"NET LA1<24> LOC=J12;"
<< endl;
250
uout <<
"NET LA1<25> LOC=H11;"
<< endl;
251
uout <<
"NET LA1<26> LOC=G12;"
<< endl;
252
uout <<
"NET LA1<27> LOC=G11;"
<< endl;
253
uout <<
"NET LA1<28> LOC=F12;"
<< endl;
254
uout <<
"NET LA1<29> LOC=F11;"
<< endl;
255
uout <<
"NET LA1<30> LOC=F10;"
<< endl;
256
uout <<
"NET LA1<31> LOC=K14;"
<< endl;
257
uout <<
"NET LA1_CLK1P LOC=J16;"
<< endl;
258
uout <<
"NET LA1_CLK1N LOC=J15;"
<< endl;
259
uout <<
"NET LA1_CLK2P LOC=L14;"
<< endl;
260
uout <<
"NET LA1_CLK2N LOC=K15;"
<< endl;
261
uout <<
""
<< endl;
262
uout <<
"#...Logic Analyzer (LA2)..."
<< endl;
263
uout <<
"NET LA2<0> LOC=K13;"
<< endl;
264
uout <<
"NET LA2<1> LOC=K12;"
<< endl;
265
uout <<
"NET LA2<2> LOC=J11;"
<< endl;
266
uout <<
"NET LA2<3> LOC=J13;"
<< endl;
267
uout <<
"NET LA2<4> LOC=H13;"
<< endl;
268
uout <<
"NET LA2<5> LOC=H10;"
<< endl;
269
uout <<
"NET LA2<6> LOC=J10;"
<< endl;
270
uout <<
"NET LA2<7> LOC=H14;"
<< endl;
271
uout <<
"NET LA2<8> LOC=H15;"
<< endl;
272
uout <<
"NET LA2<9> LOC=K10;"
<< endl;
273
uout <<
"NET LA2<10> LOC=L10;"
<< endl;
274
uout <<
"NET LA2<11> LOC=L12;"
<< endl;
275
uout <<
"NET LA2<12> LOC=L11;"
<< endl;
276
uout <<
"NET LA2<13> LOC=G13;"
<< endl;
277
uout <<
"NET LA2<14> LOC=G14;"
<< endl;
278
uout <<
"NET LA2<15> LOC=M11;"
<< endl;
279
uout <<
"NET LA2<16> LOC=M12;"
<< endl;
280
uout <<
"NET LA2<17> LOC=F14;"
<< endl;
281
uout <<
"NET LA2<18> LOC=E13;"
<< endl;
282
uout <<
"NET LA2<19> LOC=N11;"
<< endl;
283
uout <<
"NET LA2<20> LOC=P12;"
<< endl;
284
uout <<
"NET LA2<21> LOC=E12;"
<< endl;
285
uout <<
"NET LA2<22> LOC=D12;"
<< endl;
286
uout <<
"NET LA2<23> LOC=P11;"
<< endl;
287
uout <<
"NET LA2<24> LOC=L24;"
<< endl;
288
uout <<
"NET LA2<25> LOC=M24;"
<< endl;
289
uout <<
"NET LA2<26> LOC=E18;"
<< endl;
290
uout <<
"NET LA2<27> LOC=E17;"
<< endl;
291
uout <<
"NET LA2<28> LOC=K24;"
<< endl;
292
uout <<
"NET LA2<29> LOC=L25;"
<< endl;
293
uout <<
"NET LA2<30> LOC=F16;"
<< endl;
294
uout <<
"NET LA2<31> LOC=F17;"
<< endl;
295
uout <<
"NET LA2_CLK1P LOC=J17;"
<< endl;
296
uout <<
"NET LA2_CLK1N LOC=K17;"
<< endl;
297
uout <<
"NET LA2_CLK2P LOC=L17;"
<< endl;
298
uout <<
"NET LA2_CLK2N LOC=M17;"
<< endl;
299
uout <<
""
<< endl;
300
uout <<
"#...Logic Analyzer (LA3)..."
<< endl;
301
uout <<
"NET LA3<0> LOC=K25;"
<< endl;
302
uout <<
"NET LA3<1> LOC=J25;"
<< endl;
303
uout <<
"NET LA3<2> LOC=G16;"
<< endl;
304
uout <<
"NET LA3<3> LOC=H16;"
<< endl;
305
uout <<
"NET LA3<4> LOC=H26;"
<< endl;
306
uout <<
"NET LA3<5> LOC=J26;"
<< endl;
307
uout <<
"NET LA3<6> LOC=G18;"
<< endl;
308
uout <<
"NET LA3<7> LOC=G17;"
<< endl;
309
uout <<
"NET LA3<8> LOC=J28;"
<< endl;
310
uout <<
"NET LA3<9> LOC=J27;"
<< endl;
311
uout <<
"NET LA3<10> LOC=J18;"
<< endl;
312
uout <<
"NET LA3<11> LOC=H18;"
<< endl;
313
uout <<
"NET LA3<12> LOC=K18;"
<< endl;
314
uout <<
"NET LA3<13> LOC=K19;"
<< endl;
315
uout <<
"NET LA3<14> LOC=K27;"
<< endl;
316
uout <<
"NET LA3<15> LOC=L26;"
<< endl;
317
uout <<
"NET LA3<16> LOC=N20;"
<< endl;
318
uout <<
"NET LA3<17> LOC=P20;"
<< endl;
319
uout <<
"NET LA3<18> LOC=G27;"
<< endl;
320
uout <<
"NET LA3<19> LOC=F27;"
<< endl;
321
uout <<
"NET LA3<20> LOC=M19;"
<< endl;
322
uout <<
"NET LA3<21> LOC=N19;"
<< endl;
323
uout <<
"NET LA3<22> LOC=G28;"
<< endl;
324
uout <<
"NET LA3<23> LOC=H28;"
<< endl;
325
uout <<
"NET LA3<24> LOC=M18;"
<< endl;
326
uout <<
"NET LA3<25> LOC=N18;"
<< endl;
327
uout <<
"NET LA3<26> LOC=G29;"
<< endl;
328
uout <<
"NET LA3<27> LOC=F29;"
<< endl;
329
uout <<
"NET LA3<28> LOC=L20;"
<< endl;
330
uout <<
"NET LA3<29> LOC=L19;"
<< endl;
331
uout <<
"NET LA3<30> LOC=H29;"
<< endl;
332
uout <<
"NET LA3<31> LOC=H30;"
<< endl;
333
uout <<
"NET LA3_CLK1P LOC=M26;"
<< endl;
334
uout <<
"NET LA3_CLK1N LOC=L27;"
<< endl;
335
uout <<
"NET LA3_CLK2P LOC=L29;"
<< endl;
336
uout <<
"NET LA3_CLK2N LOC=K28;"
<< endl;
337
uout <<
""
<< endl;
338
uout <<
"#...FPGAIO..."
<< endl;
339
uout <<
"NET FPGAIO<0> LOC=N33;"
<< endl;
340
uout <<
"NET FPGAIO<1> LOC=N34;"
<< endl;
341
uout <<
"NET FPGAIO<2> LOC=M34;"
<< endl;
342
uout <<
"NET FPGAIO<3> LOC=M33;"
<< endl;
343
uout <<
"NET FPGAIO<4> LOC=M32;"
<< endl;
344
uout <<
"NET FPGAIO<5> LOC=M31;"
<< endl;
345
uout <<
"NET FPGAIO<6> LOC=N31;"
<< endl;
346
uout <<
"NET FPGAIO<7> LOC=P31;"
<< endl;
347
uout <<
"NET FPGAIO<8> LOC=H34;"
<< endl;
348
uout <<
"NET FPGAIO<9> LOC=G34;"
<< endl;
349
uout <<
"NET FPGAIO<10> LOC=G33;"
<< endl;
350
uout <<
"NET FPGAIO<11> LOC=H33;"
<< endl;
351
uout <<
"NET FPGAIO<12> LOC=G32;"
<< endl;
352
uout <<
"NET FPGAIO<13> LOC=G31;"
<< endl;
353
uout <<
"NET FPGAIO<14> LOC=H31;"
<< endl;
354
uout <<
"NET FPGAIO<15> LOC=J31;"
<< endl;
355
uout <<
"NET FPGAIO<16> LOC=F35;"
<< endl;
356
uout <<
"NET FPGAIO<17> LOC=E35;"
<< endl;
357
uout <<
"NET FPGAIO<18> LOC=E34;"
<< endl;
358
uout <<
"NET FPGAIO<19> LOC=F34;"
<< endl;
359
uout <<
"NET FPGAIO<20> LOC=F31;"
<< endl;
360
uout <<
"NET FPGAIO<21> LOC=F32;"
<< endl;
361
uout <<
"NET FPGAIO<22> LOC=E32;"
<< endl;
362
uout <<
"NET FPGAIO<23> LOC=E33;"
<< endl;
363
uout <<
"NET FPGAIO<24> LOC=L34;"
<< endl;
364
uout <<
"NET FPGAIO<25> LOC=K34;"
<< endl;
365
uout <<
"NET FPGAIO<26> LOC=K33;"
<< endl;
366
uout <<
"NET FPGAIO<27> LOC=J33;"
<< endl;
367
uout <<
"NET FPGAIO<28> LOC=K32;"
<< endl;
368
uout <<
"NET FPGAIO<29> LOC=J32;"
<< endl;
369
uout <<
"NET FPGAIO<30> LOC=L32;"
<< endl;
370
uout <<
"NET FPGAIO<31> LOC=L31;"
<< endl;
371
uout <<
"NET FPGAIO<32> LOC=P33;"
<< endl;
372
uout <<
"NET FPGAIO<33> LOC=P32;"
<< endl;
373
uout <<
"NET FPGAIO<34> LOC=R33;"
<< endl;
374
uout <<
"NET FPGAIO<35> LOC=R32;"
<< endl;
375
return
0;
376
}
Belle2
Abstract base class for different kinds of events.
Definition:
MillepedeAlgorithm.h:17
main
int main(int argc, char **argv)
Run all tests.
Definition:
test_main.cc:91
trg
trg
tools
TRGUT2Template.cc
Generated on Mon Sep 23 2024 14:07:12 for Belle II Software by
1.9.1