-
Notifications
You must be signed in to change notification settings - Fork 1
/
stdf_V4.py
executable file
·439 lines (412 loc) · 8.28 KB
/
stdf_V4.py
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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
"""
The main object should be used from this module is:
Rec_Dict4
which is a dictionary with (typ,sub) tuple as its keys
and a record instance as its value. For each record instance,
there's is a field: fieldMap to define the record binary structure.
"""
class RecordMeta(type):
""" This metaclass is used to initialize a class which wants its
name as its print form, instead of the typical
<__main__.x instance at 0x@#$%^&*?> form. It is cleaner to view.
"""
def __init__(cls, name, bases, dct):
def fstr(self):
return cls.__name__
setattr(cls, '__str__', fstr)
class Far:
__metaclass__ = RecordMeta
typ = 0
sub = 10
fieldMap = (
('CPU_TYPE', 'U1'),
('STDF_VER', 'U1')
)
class Atr:
__metaclass__ = RecordMeta
typ = 0
sub = 20
fieldMap = (
('MOD_TIM', 'U4'),
('CMD_LINE', 'Cn')
)
class Mir:
__metaclass__ = RecordMeta
typ = 1
sub = 10
fieldMap = (
('SETUP_T', 'U4'),
('START_T', 'U4'),
('STAT_NUM', 'U1'),
('MODE_COD', 'C1'),
('RTST_COD', 'C1'),
('PROT_COD', 'C1'),
('BURN_TIM', 'U2'),
('CMOD_COD', 'C1'),
('LOT_ID', 'Cn'),
('PART_TYP', 'Cn'),
('NODE_NAM', 'Cn'),
('TSTR_TYP', 'Cn'),
('JOB_NAM', 'Cn'),
('JOB_REV', 'Cn'),
('SBLOT_ID', 'Cn'),
('OPER_NAM', 'Cn'),
('EXEC_TYP', 'Cn'),
('EXEC_VER', 'Cn'),
('TEST_COD', 'Cn'),
('TST_TEMP', 'Cn'),
('USER_TXT', 'Cn'),
('AUX_FILE', 'Cn'),
('PKG_TYP', 'Cn'),
('FAMLY_ID', 'Cn'),
('DATE_COD', 'Cn'),
('FACIL_ID', 'Cn'),
('FLOOR_ID', 'Cn'),
('PROC_ID', 'Cn'),
('OPER_FRQ', 'Cn'),
('SPEC_NAM', 'Cn'),
('SPEC_VER', 'Cn'),
('FLOW_ID', 'Cn'),
('SETUP_ID', 'Cn'),
('DSGN_REV', 'Cn'),
('ENG_ID', 'Cn'),
('ROM_COD', 'Cn'),
('SERL_NUM', 'Cn'),
('SUPR_NAM', 'Cn')
)
class Mrr:
__metaclass__ = RecordMeta
typ = 1
sub = 20
fieldMap = (
('FINISH_T', 'U4'),
('DISP_COD', 'C1'),
('USR_DESC', 'Cn'),
('EXC_DESC', 'Cn')
)
class Pcr:
__metaclass__ = RecordMeta
typ = 1
sub = 30
fieldMap = (
('HEAD_NUM','U1'),
('SITE_NUM','U1'),
('PART_CNT','U4'),
('RTST_CNT','U4'),
('ABRT_CNT','U4'),
('GOOD_CNT','U4'),
('FUNC_CNT','U4')
)
class Hbr:
__metaclass__ = RecordMeta
typ = 1
sub = 40
fieldMap = (
('HEAD_NUM','U1'),
('SITE_NUM','U1'),
('HBIN_NUM','U2'),
('HBIN_CNT','U4'),
('HBIN_PF','C1'),
('HBIN_NAM','Cn')
)
class Sbr:
__metaclass__ = RecordMeta
typ = 1
sub = 50
fieldMap = (
('HEAD_NUM','U1'),
('SITE_NUM','U1'),
('SBIN_NUM','U2'),
('SBIN_CNT','U4'),
('SBIN_PF','C1'),
('SBIN_NAM','Cn')
)
class Pmr:
__metaclass__ = RecordMeta
typ = 1
sub = 60
fieldMap = (
('PMR_INDX','U2'),
('CHAN_TYP','U2'),
('CHAN_NAM','Cn'),
('PHY_NAM','Cn'),
('LOG_NAM','Cn'),
('HEAD_NUM','U1'),
('SITE_NUM','U1')
)
class Pgr:
__metaclass__ = RecordMeta
typ = 1
sub = 62
fieldMap = (
('GRP_INDX','U2'),
('GRP_NAM','Cn'),
('INDX_CNT','U2'),
('PMR_INDX','K2U2')
)
class Plr:
__metaclass__ = RecordMeta
typ = 1
sub = 63
fieldMap = (
('GRP_CNT','U2'),
('GRP_INDX','K0U2'),
('GRP_MODE','K0U2'),
('GRP_RADX','K0U1'),
('PGM_CHAR','K0Cn'),
('RTN_CHAR','K0Cn'),
('PGM_CHAL','K0Cn'),
('RTN_CHAL','K0Cn')
)
class Rdr:
__metaclass__ = RecordMeta
typ = 1
sub = 70
fieldMap = (
('NUM_BINS','U2'),
('RTST_BIN','K0U2')
)
class Sdr:
__metaclass__ = RecordMeta
typ = 1
sub = 80
fieldMap = (
('HEAD_NUM','U1'),
('SITE_GRP','U1'),
('SITE_CNT','U1'),
('SITE_NUM','K2U1'),
('HAND_TYP','Cn'),
('HAND_ID','Cn'),
('CARD_TYP','Cn'),
('CARD_ID','Cn'),
('LOAD_TYP','Cn'),
('LOAD_ID','Cn'),
('DIB_TYP','Cn'),
('DIB_ID','Cn'),
('CABL_TYP','Cn'),
('CABL_ID','Cn'),
('CONT_TYP','Cn'),
('CONT_ID','Cn'),
('LASR_TYP','Cn'),
('LASR_ID','Cn'),
('EXTR_TYP','Cn'),
('EXTR_ID','Cn')
)
class Wir:
__metaclass__ = RecordMeta
typ = 2
sub = 10
fieldMap = (
('HEAD_NUM','U1'),
('SITE_GRP','U1'),
('START_T','U4'),
('WAFER_ID','Cn')
)
class Wrr:
__metaclass__ = RecordMeta
typ = 2
sub = 20
fieldMap = (
('HEAD_NUM','U1'),
('SITE_GRP','U1'),
('FINISH_T','U4'),
('PART_CNT','U4'),
('RTST_CNT','U4'),
('ABRT_CNT','U4'),
('GOOD_CNT','U4'),
('FUNC_CNT','U4'),
('WAFER_ID','Cn'),
('FABWF_ID','Cn'),
('FRAME_ID','Cn'),
('MASK_ID','Cn'),
('USR_DESC','Cn'),
('EXC_DESC','Cn')
)
class Wcr:
__metaclass__ = RecordMeta
typ = 2
sub = 30
fieldMap = (
('WAFR_SIZ','R4'),
('DIE_HT','R4'),
('DIE_WID','R4'),
('WF_UNITS','U1'),
('WF_FLAT','C1'),
('CENTER_X','I2'),
('CENTER_Y','I2'),
('POS_X','C1'),
('POS_Y','C1')
)
class Pir:
__metaclass__ = RecordMeta
typ = 5
sub = 10
fieldMap = (
('HEAD_NUM','U1'),
('SITE_NUM','U1')
)
class Prr:
__metaclass__ = RecordMeta
typ = 5
sub = 20
fieldMap = (
('HEAD_NUM','U1'),
('SITE_NUM','U1'),
('PART_FLG','B1'),
('NUM_TEST','U2'),
('HARD_BIN','U2'),
('SOFT_BIN','U2'),
('X_COORD','I2'),
('Y_COORD','I2'),
('TEST_T','U4'),
('PART_ID','Cn'),
('PART_TXT','Cn'),
('PART_FIX','Bn')
)
class Tsr:
__metaclass__ = RecordMeta
typ = 10
sub = 30
fieldMap = (
('HEAD_NUM','U1'),
('SITE_NUM','U1'),
('TEST_TYP','C1'),
('TEST_NUM','U4'),
('EXEC_CNT','U4'),
('FAIL_CNT','U4'),
('ALRM_CNT','U4'),
('TEST_NAM','Cn'),
('SEQ_NAME','Cn'),
('TEST_LBL','Cn'),
('OPT_FLAG','B1'),
('TEST_TIM','R4'),
('TEST_MIN','R4'),
('TEST_MAX','R4'),
('TST_SUMS','R4'),
('TST_SQRS','R4')
)
class Ptr:
__metaclass__ = RecordMeta
typ = 15
sub = 10
fieldMap = (
('TEST_NUM','U4'),
('HEAD_NUM','U1'),
('SITE_NUM','U1'),
('TEST_FLG','B1'),
('PARM_FLG','B1'),
('RESULT','R4'),
('TEST_TXT','Cn'),
('ALARM_ID','Cn'),
('OPT_FLAG','B1'),
('RES_SCAL','I1'),
('LLM_SCAL','I1'),
('HLM_SCAL','I1'),
('LO_LIMIT','R4'),
('HI_LIMIT','R4'),
('UNITS','Cn'),
('C_RESFMT','Cn'),
('C_LLMFMT','Cn'),
('C_HLMFMT','Cn'),
('LO_SPEC','R4'),
('HI_SPEC','R4')
)
class Mpr:
__metaclass__ = RecordMeta
typ = 15
sub = 15
fieldMap = (
('TEST_NUM','U4'),
('HEAD_NUM','U1'),
('SITE_NUM','U1'),
('TEST_FLG','B1'),
('PARM_FLG','B1'),
('RTN_ICNT','U2'),
('RSLT_CNT','U2'),
('RTN_STAT','K5N1'),
('RTN_RSLT','K6R4'),
('TEST_TXT','Cn'),
('ALARM_ID','Cn'),
('OPT_FLAG','B1'),
('RES_SCAL','I1'),
('LLM_SCAL','I1'),
('HLM_SCAL','I1'),
('LO_LIMIT','R4'),
('HI_LIMIT','R4'),
('START_IN','R4'),
('INCR_IN','R4'),
('RTN_INDX','K5U2'),
('UNITS','Cn'),
('UNITS_IN','Cn'),
('C_RESFMT','Cn'),
('C_LLMFMT','Cn'),
('C_HLMFMT','Cn'),
('LO_SPEC','R4'),
('HI_SPEC','R4')
)
class Ftr:
__metaclass__ = RecordMeta
typ = 15
sub = 20
fieldMap = (
('TEST_NUM','U4'),
('HEAD_NUM','U1'),
('SITE_NUM','U1'),
('TEST_FLG','B1'),
('OPT_FLAG','B1'),
('CYCL_CNT','U4'),
('REL_VADR','U4'),
('REPT_CNT','U4'),
('NUM_FAIL','U4'),
('XFAIL_AD','I4'),
('YFAIL_AD','I4'),
('VECT_OFF','I2'),
('RTN_ICNT','U2'),
('PGM_ICNT','U2'),
('RTN_INDX','K12U2'),
('RTN_STAT','K12N1'),
('PGM_INDX','K13U2'),
('PGM_STAT','K13N1'),
('FAIL_PIN','Dn'),
('VECT_NAM','Cn'),
('TIME_SET','Cn'),
('OP_CODE','Cn'),
('TEST_TXT','Cn'),
('ALARM_ID','Cn'),
('PROG_TXT','Cn'),
('RSLT_TXT','Cn'),
('PATG_NUM','U1'),
('SPIN_MAP','Dn')
)
class Bps:
__metaclass__ = RecordMeta
typ = 20
sub = 10
fieldMap = (
('SEQ_NAME','Cn'),
)
class Eps:
__metaclass__ = RecordMeta
typ = 20
sub = 20
fieldMap = ()
class Gdr:
__metaclass__ = RecordMeta
typ = 50
sub = 10
fieldMap = (
('GEN_DATA', 'Vn'),
)
class Dtr:
__metaclass__ = RecordMeta
typ = 50
sub = 30
fieldMap = (
('TEXT_DAT', 'Cn'),
)
Records = [Far(), Atr(), Mir(), Mrr(), Pcr(), Hbr(), Sbr(), Pmr(), Pgr(),
Plr(), Rdr(), Sdr(), Wir(), Wrr(), Wcr(), Pir(), Prr(),
Tsr(), Ptr(), Mpr(), Ftr(), Bps(), Eps(), Gdr(), Dtr()]
Rec_Dict4 = {}
for r in Records:
Rec_Dict4[(r.typ, r.sub)] = r