testit
12.6 KB
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
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
#!/bin/sh -f
#################################################################
#
# Script to make tabular files. Make up for lack of prefix
# rules in smake.
#
#################################################################
#
# either att, cov, ew, tex, ms
#
TYPE=""
#
# Three digit test number
#
TNUM=""
#
# Simulator, c, cv, io, gate
#
SIM="cv"
#
# Use archived source files (.rdp, .mem, .rdram) from apps directory
# This isolates us from rabid changes in the emulator
#
USE_ARCHIVE=""
#
# Use bb source files (captured from real hardware(indy))
#
USE_BB_FILES=""
SYSTEM_4MB=""
#
# Hardcode the random seed used by the simulator so that images will
# compare from run to run.
#
USE_SEED="100"
#
# The gate level simulation is currently a hand tweaked executable maintained
# by Ken Hayes; coming soon to an account on a server near you...
#
# When we do change the location, we'll reflect that here. SIMVGATEDIR gets
# used by the gatesim() internal script function, and overwrites SIMVDIR as set
# in the incoming shell environment (which is used by the iosim() internal
# script function).
#
SIMVGATEDIR="/hosts/baraka/e/kishor/simv_ipc_gate"
#
# Directories
#
PRDEPTH="../../.."
init_test()
{
if [ "$USE_BB_FILES" = "" ]
then
ATTDIR="${PRDEPTH}/apps/rdpatt/InData"
COVDIR="${PRDEPTH}/apps/rdpcov/InData"
EWDIR="${PRDEPTH}/apps/rdpew/InData"
TEXDIR="${PRDEPTH}/apps/rdptex/InData"
MSDIR="${PRDEPTH}/apps/rdpms/InData"
else
ATTDIR="${PRDEPTH}/apps/rdpatt_bb/InData"
COVDIR="${PRDEPTH}/apps/rdpcov_bb/InData"
EWDIR="${PRDEPTH}/apps/rdpew_bb/InData"
TEXDIR="${PRDEPTH}/apps/rdptex_bb/InData"
MSDIR="${PRDEPTH}/apps/rdpms_bb/InData"
fi
if [ "$SYSTEM_4MB" = "" ]; then
IO_TEST=${ROOT}/PR/iosim/test/rdp_3stall.tst
else
IO_TEST=${ROOT}/PR/iosim/test/rdp_3stall_4M.tst
fi
}
INDATA="InData"
OUTDATA="OutData"
#
# Tools
#
RDP_CV="./rdp_cv $RDP_OPTS"
RDP_C="./rdp_c $RDP_OPTS"
RDP_IO="${ROOT}/PR/iosim/src/iosim"
FILTER=${ROOT}/PR/rdpsim/backend/filter
IO_TEST=${ROOT}/PR/iosim/test/rdp_3stall.tst
RDRAM2RDP=rdram2rdp
RDRAMGCLR=rdramgclr
RDRAM2IMG=rdram2image
export SIMVDIR=${ROOT}/PR/hw2/chip/sim
#
# Set environment
#
LD_LIBRARY_PATH="/ecad/vcs/vcs_2.2/sgi/lib:${PRDEPTH}/lib/libimage:${PRDEPTH}/iosim/src/iosim"
export LD_LIBRARY_PATH
TIMELIMIT=180000
##################################################
#
# Usage message
#
##################################################
usage()
{
echo "Usage: testit [-a][-b][-m] <-n> test_number <-t> type <-s> simulator"
echo " -b : Use bb files(captured from indy)"
echo " -m : Configure as 4 MBytes system"
exit 2
}
##################################################
#
# Run the C/Verilog simulation (rdp_cv)
#
##################################################
cvsim()
{
echo CV sim test ${TNUM} start `date`
#set -x
# Generate input file names
if [ ${TNUM} -ge 100 ] ; then
NUM=`expr ${TNUM} - 100`
else
NUM=`expr ${TNUM} + 0`
fi
if [ "$USE_BB_FILES" = "TRUE" ]; then
IN_BASE=test${TNUM}.${TYPE}_bb
else
IN_BASE=test${TNUM}.${TYPE}
fi
if test "$USE_ARCHIVE" = "TRUE"; then
RDP_SRC=${APPDIR}/test${TNUM}.${NUM}.rdp.Z.archive
MEM_SRC=${APPDIR}/test${TNUM}.${NUM}.mem.Z.archive
else
RDP_SRC=${APPDIR}/test${TNUM}.${NUM}.rdp.Z
MEM_SRC=${APPDIR}/test${TNUM}.${NUM}.mem.Z
fi
RDP_FILE=${INDATA}/${IN_BASE}.rdp
MEM_FILE=${INDATA}/${IN_BASE}_cv.mem
# Generate output file names
if [ "$USE_BB_FILES" = "TRUE" ]
then
OUT_BASE=test${TNUM}_${TYPE}_bb_cv
else
OUT_BASE=test${TNUM}_${TYPE}_cv
fi
OUT_LOG=${OUTDATA}/${OUT_BASE}.out
COV_FILE=${OUTDATA}/${OUT_BASE}_0.cov
CVG_FILE=${OUTDATA}/${OUT_BASE}_0.cvg
RGB_FILE=${OUTDATA}/${OUT_BASE}_0.rgb
RGBF_FILE=${OUTDATA}/test${TNUM}_${TYPE}_cvf_0.rgb
# Copy and uncompress rdp and mem file from apps directory
if test -r $MEM_SRC; then
cat ${MEM_SRC} | uncompress -c > ${MEM_FILE}
if test $? -ne 0; then
echo ".mem file ERROR"
exit 1
fi
else
echo "Error: $MEM_SRC does not exist or is not readable"
exit 1
fi
if test -r $RDP_SRC; then
cat ${RDP_SRC} | uncompress -c > ${RDP_FILE}
if test $? -ne 0; then
echo ".rdp file ERROR"
exit 1
fi
else
echo "Error: $RDP_SRC does not exist or is not readable"
exit 1
fi
# Run simulation
${RDP_CV} -e -i ${IN_BASE} -m ${IN_BASE}_cv \
+tmem=allones.mem \
-M 500 -S ${USE_SEED} \
-f ${OUT_BASE} -z | tee ${OUT_LOG}
if test $? -ne 0 ; then
echo "RDP_CV FAILED"
exit 1
fi
# Create output files for comparison
${FILTER} -c ${COV_FILE} -i ${CVG_FILE} \
-n ${RGB_FILE} -o ${RGBF_FILE}
# cleanup
rm -f ${MEM_FILE}
echo CV sim test ${TNUM} finish `date`
}
##################################################
#
# Run the C simulation (rdp_c)
#
##################################################
csim()
{
echo "C sim test ${TNUM} start `date`"
set -x
# Generate input file names
if [ ${TNUM} -ge 100 ] ; then
NUM=`expr ${TNUM} - 100`
else
NUM=`expr ${TNUM} + 0`
fi
if [ "$USE_BB_FILES" = "TRUE" ]; then
IN_BASE=test${TNUM}.${TYPE}_bb
else
IN_BASE=test${TNUM}.${TYPE}
fi
IN_BASE=test${TNUM}.${TYPE}
if test "$USE_ARCHIVE" = "TRUE"; then
RDP_SRC=${APPDIR}/test${TNUM}.${NUM}.rdp.Z.archive
MEM_SRC=${APPDIR}/test${TNUM}.${NUM}.mem.Z.archive
else
RDP_SRC=${APPDIR}/test${TNUM}.${NUM}.rdp.Z
MEM_SRC=${APPDIR}/test${TNUM}.${NUM}.mem.Z
fi
RDP_FILE=${INDATA}/${IN_BASE}.rdp
MEM_FILE=${INDATA}/${IN_BASE}_c.mem
# Generate output file names
if [ "$USE_BB_FILES" = "TRUE" ]
then
OUT_BASE=test${TNUM}_${TYPE}_bb_c
else
OUT_BASE=test${TNUM}_${TYPE}_c
fi
OUT_LOG=${OUTDATA}/${OUT_BASE}.out
COV_FILE=${OUTDATA}/${OUT_BASE}_0.cov
CVG_FILE=${OUTDATA}/${OUT_BASE}_0.cvg
RGB_FILE=${OUTDATA}/${OUT_BASE}_0.rgb
RGBF_FILE=${OUTDATA}/test${TNUM}_${TYPE}_cf_0.rgb
# Copy and uncompress rdp and mem file from apps directory
if test -r $MEM_SRC; then
cat ${MEM_SRC} | uncompress -c > ${MEM_FILE}
if test $? -ne 0; then
echo ".mem file ERROR"
exit 1
fi
else
echo "Error: $MEM_SRC does not exist or is not readable"
exit 1
fi
if test -r $RDP_SRC; then
cat ${RDP_SRC} | uncompress -c > ${RDP_FILE}
if test $? -ne 0; then
echo ".rdp file ERROR"
exit 1
fi
else
echo "Error: $RDP_SRC does not exist or is not readable"
exit 1
fi
# Run simulation
${RDP_C} -e -i ${IN_BASE} -m ${IN_BASE}_c \
-M 500 -S ${USE_SEED} \
-f ${OUT_BASE} -z | tee ${OUT_LOG}
if test $? -ne 0 ; then
echo "RDP_C FAILED"
exit 1
fi
# Create output files for comparison
${FILTER} -c ${COV_FILE} -i ${CVG_FILE} \
-n ${RGB_FILE} -o ${RGBF_FILE}
# cleanup
rm -f ${MEM_FILE}
echo "C sim test ${TNUM} finish `date`"
}
##################################################
#
# Run the io simulation (simv.ipc or simv2.ipc)
#
##################################################
iosim()
{
echo "IO sim test ${TNUM} start `date`"
set -x
# Generate input file names
if [ ${TNUM} -ge 100 ] ; then
NUM=`expr ${TNUM} - 100`
else
NUM=`expr ${TNUM} + 0`
fi
SRC_BASE=test${TNUM}.${TYPE}
if [ "$USE_BB_FILES" = "TRUE" ]; then
IN_BASE=test${TNUM}_${TYPE}_bb
else
IN_BASE=test${TNUM}_${TYPE}
fi
if test "$USE_ARCHIVE" = "TRUE"; then
# RDP_SRC=${APPDIR}/test${TNUM}.${NUM}.rdp.Z.archive
MEM_SRC=${APPDIR}/test${TNUM}.${NUM}.rdram.Z.archive
else
# RDP_SRC=${APPDIR}/test${TNUM}.${NUM}.rdp.Z
MEM_SRC=${APPDIR}/test${TNUM}.${NUM}.rdram.Z
fi
# RDP_FILE=${INDATA}/${SRC_BASE}.rdp
MEM_FILE=${INDATA}/${IN_BASE}_io.rdram
# Generate output file names
if [ "$USE_BB_FILES" = "TRUE" ]
then
OUT_BASE=test${TNUM}_${TYPE}_bb_io
else
OUT_BASE=test${TNUM}_${TYPE}_io
fi
OUT_LOG=${OUTDATA}/${OUT_BASE}.log
OUT_LOGF=${OUTDATA}/${OUT_BASE}f.log
COV_FILE=${OUTDATA}/${OUT_BASE}_0.cov
CVG_FILE=${OUTDATA}/${OUT_BASE}_0.cvg
RGB_FILE=${OUTDATA}/${OUT_BASE}_0.rgb
RGBF_FILE=${OUTDATA}/test${TNUM}_${TYPE}_iof_0.rgb
# Copy and uncompress rdp and mem file from apps directory
if test -r $MEM_SRC; then
cat ${MEM_SRC} | uncompress -c > ${MEM_FILE}
if test $? -ne 0; then
echo ".mem file ERROR"
exit 1
fi
else
echo "Error: $MEM_SRC does not exist or is not readable"
exit 1
fi
# if test -r $RDP_SRC; then
# cat ${RDP_SRC} | uncompress -c > ${RDP_FILE}
# if test $? -ne 0; then
# echo ".rdp file ERROR"
# exit 1
# fi
# else
# echo "Error: $RDP_SRC does not exist or is not readable"
# exit 1
# fi
if [ "$SYSTEM_4MB" = "" ]; then
${RDRAMGCLR} ${INDATA}/${IN_BASE}_io
else
${RDRAMGCLR} -m 2 ${INDATA}/${IN_BASE}_io
fi
#
# Check to see if the user wants to generate images from 1st tapeout sim.
#
if test -z "${USE_HW_ROOT}" ; then
SIMV_EXE=${SIMVDIR}/simv2.ipc
else
SIMV_EXE=${SIMVDIR}/simv.ipc
fi
# Run simulation
SIMV="${SIMV_EXE} +mmap_rdram=${INDATA}/${IN_BASE}_io \
+timelimit=${TIMELIMIT} \
+gclock_mon=150 +cbus_mon $RDP_OPTS"
export SIMV
${RDP_IO} \
-n test${TNUM}_${TYPE} \
-d 0x41 \
-f ${IO_TEST} \
-l ${OUT_LOG} \
> ${OUT_LOGF}
if test $? -ne 0 ; then
echo "IOSIM FAILED"
exit 1
fi
${RDRAM2IMG} ${INDATA}/${IN_BASE}_io
# Create output files for comparison
${FILTER} -c ${COV_FILE} -i ${CVG_FILE} \
-n ${RGB_FILE} -o ${RGBF_FILE}
# cleanup
rm -f ${MEM_FILE}
echo "IO sim test ${TNUM} finish `date`"
}
##################################################
#
# Run the gate level simulation (simv.ipc.gates or simv2.ipc.gates)
#
##################################################
gatesim()
{
echo "GATE sim test ${TNUM} start `date`"
set -x
# Generate input file names
if [ ${TNUM} -ge 100 ] ; then
NUM=`expr ${TNUM} - 100`
else
NUM=`expr ${TNUM} + 0`
fi
SRC_BASE=test${TNUM}.${TYPE}
if [ "$USE_BB_FILES" = "TRUE" ]; then
IN_BASE=test${TNUM}_${TYPE}_bb
else
IN_BASE=test${TNUM}_${TYPE}
fi
if test "$USE_ARCHIVE" = "TRUE"; then
MEM_SRC=${APPDIR}/test${TNUM}.${NUM}.rdram.Z.archive
else
MEM_SRC=${APPDIR}/test${TNUM}.${NUM}.rdram.Z
fi
MEM_FILE=${INDATA}/${IN_BASE}_gate.rdram
# Generate output file names
if [ "$USE_BB_FILES" = "TRUE" ]
then
OUT_BASE=test${TNUM}_${TYPE}_bb_gate
else
OUT_BASE=test${TNUM}_${TYPE}_gate
fi
OUT_LOG=${OUTDATA}/${OUT_BASE}.log
OUT_LOGF=${OUTDATA}/${OUT_BASE}f.log
COV_FILE=${OUTDATA}/${OUT_BASE}_0.cov
CVG_FILE=${OUTDATA}/${OUT_BASE}_0.cvg
RGB_FILE=${OUTDATA}/${OUT_BASE}_0.rgb
RGBF_FILE=${OUTDATA}/test${TNUM}_${TYPE}_gatef_0.rgb
# Copy and uncompress rdp and mem file from apps directory
if test -r $MEM_SRC; then
cat ${MEM_SRC} | uncompress -c > ${MEM_FILE}
if test $? -ne 0; then
echo ".mem file ERROR"
exit 1
fi
else
echo "Error: $MEM_SRC does not exist or is not readable"
exit 1
fi
${RDRAMGCLR} ${INDATA}/${IN_BASE}_gate
#
# Check to see if the user wants to generate images from 1st tapeout sim.
#
if test -z "${USE_HW_ROOT}"; then
SIMV_EXE=${SIMVGATEDIR}/simv2.ipc.gates
else
SIMV_EXE=${SIMVGATEDIR}/simv.ipc.gates
fi
SIMV="${SIMV_EXE} +mmap_rdram=${INDATA}/${IN_BASE}_gate $RDP_OPTS"
export SIMV
${RDP_IO} \
-n test${TNUM}_${TYPE} \
-d 0x41 \
-f ${IO_TEST} \
-l ${OUT_LOG} \
> ${OUT_LOGF}
if test $? -ne 0 ; then
echo "IOSIM FAILED"
exit 1
fi
${RDRAM2IMG} ${INDATA}/${IN_BASE}_gate
# Create output files for comparison
${FILTER} -c ${COV_FILE} -i ${CVG_FILE} \
-n ${RGB_FILE} -o ${RGBF_FILE}
# cleanup
rm -f ${MEM_FILE}
echo "GATE sim test ${TNUM} finish `date`"
}
##################################################
# Main
#
##################################################
if test $# = 0
then
usage
fi
while getopts "n:t:s:m?b?a?" a
do
case $a in
a) USE_ARCHIVE=TRUE;;
b) USE_BB_FILES=TRUE;;
m) SYSTEM_4MB=TRUE;;
n) TNUM=$OPTARG;;
t) TYPE=$OPTARG;;
s) SIM=$OPTARG;;
\?) usage ;;
esac
done
shift `expr $OPTIND - 1`
init_test
# Determine app directory
case ${TYPE} in
"att") APPDIR=$ATTDIR;;
"tex") APPDIR=$TEXDIR;;
"cov") APPDIR=$COVDIR;;
"ew") APPDIR=$EWDIR;;
"ms") APPDIR=$MSDIR;;
*) echo "Unrecognized type: ${TYPE}"
exit 1;;
esac
# run simulation
case $SIM in
c) csim;;
cv) cvsim;;
io) iosim;;
gate) gatesim;;
*) echo "Unrecognized simulator: ${SIM}"
esac
# End testit