testit
9.05 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
#!/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"
#
# 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/a/hayes.gates"
#
# Directories
#
PRDEPTH="../../.."
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"
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
#
# Set environment
#
LD_LIBRARY_PATH="/ecad/vcs/vcs_2.2/sgi/lib:${PRDEPTH}/lib/libimage:${PRDEPTH}/iosim/src/iosim"
export LD_LIBRARY_PATH
TIMELIMIT=21600
##################################################
#
# Usage message
#
##################################################
usage()
{
echo "Usage: testit <-n> test_number <-t> type <-s> simulator"
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
IN_BASE=test${TNUM}.${TYPE}
RDP_SRC=${APPDIR}/test${TNUM}.${NUM}.rdp.Z
MEM_SRC=${APPDIR}/test${TNUM}.${NUM}.mem.Z
RDP_FILE=${INDATA}/${IN_BASE}.rdp
MEM_FILE=${INDATA}/${IN_BASE}_cv.mem
# Generate output file names
OUT_BASE=test${TNUM}_${TYPE}_cv
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
zcat ${MEM_SRC} > ${MEM_FILE}
if test $? -ne 0; then
echo ".mem file ERROR"
exit 1
fi
zcat ${RDP_SRC} > ${RDP_FILE}
if test $? -ne 0; then
echo ".rdp file ERROR"
exit 1
fi
# Run simulation
${RDP_CV} -e -i ${IN_BASE} -m ${IN_BASE}_cv \
+tmem=allones.mem \
-M 500 -S ${NUM} \
-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
IN_BASE=test${TNUM}.${TYPE}
RDP_SRC=${APPDIR}/test${TNUM}.${NUM}.rdp.Z
MEM_SRC=${APPDIR}/test${TNUM}.${NUM}.mem.Z
RDP_FILE=${INDATA}/${IN_BASE}.rdp
MEM_FILE=${INDATA}/${IN_BASE}_c.mem
# Generate output file names
OUT_BASE=test${TNUM}_${TYPE}_c
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
zcat ${MEM_SRC} > ${MEM_FILE}
if test $? -ne 0; then
echo ".mem file ERROR"
exit 1
fi
zcat ${RDP_SRC} > ${RDP_FILE}
if test $? -ne 0; then
echo ".rdp file ERROR"
exit 1
fi
# Run simulation
${RDP_C} -e -i ${IN_BASE} -m ${IN_BASE}_c \
-M 500 -S ${NUM} \
-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)
#
##################################################
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}
IN_BASE=test${TNUM}_${TYPE}
RDP_SRC=${APPDIR}/test${TNUM}.${NUM}.rdp.Z
MEM_SRC=${APPDIR}/test${TNUM}.${NUM}.rdram.Z
RDP_FILE=${INDATA}/${SRC_BASE}.rdp
MEM_FILE=${INDATA}/${IN_BASE}_io.rdram
# Generate output file names
OUT_BASE=test${TNUM}_${TYPE}_io
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
zcat ${MEM_SRC} > ${MEM_FILE}
if test $? -ne 0; then
echo ".mem file ERROR"
exit 1
fi
zcat ${RDP_SRC} > ${RDP_FILE}
if test $? -ne 0; then
echo ".rdp file ERROR"
exit 1
fi
${RDRAMGCLR} ${INDATA}/${IN_BASE}_io
# Run simulation
SIMV="${SIMVDIR}/simv.ipc +mmap_rdram=${INDATA}/${IN_BASE}_io \
+timelimit=${TIMELIMIT} +mspan_mon \
+gclock_mon=150 +mbus_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)
#
##################################################
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}
IN_BASE=test${TNUM}_${TYPE}
RDP_SRC=${APPDIR}/test${TNUM}.${NUM}.rdp.Z
MEM_SRC=${APPDIR}/test${TNUM}.${NUM}.rdram.Z
RDP_FILE=${INDATA}/${SRC_BASE}.rdp
MEM_FILE=${INDATA}/${IN_BASE}_gate.rdram
# Generate output file names
OUT_BASE=test${TNUM}_${TYPE}_gate
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
zcat ${MEM_SRC} > ${MEM_FILE}
if test $? -ne 0; then
echo ".mem file ERROR"
exit 1
fi
zcat ${RDP_SRC} > ${RDP_FILE}
if test $? -ne 0; then
echo ".rdp file ERROR"
exit 1
fi
${RDRAMGCLR} ${INDATA}/${IN_BASE}_gate
#
# Run simulation; can't use mspan, gclock, mbus monitors, because they're not
# supported at the gate level. The timelimit is similarly not used, although
# we probably could use that, with the proviso that the gate level tests take
# MUCH longer to run to completion than the behavioral (iosim) tests.
#
SIMVDIR=${SIMVGATEDIR}
export SIMVDIR
SIMV="${SIMVDIR}/simv.ipc.gates +mmap_rdram=${INDATA}/${IN_BASE}_gate \
+mbus_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}_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
#
##################################################
while getopts "n:t:s:" a
do
case $a in
n) TNUM=$OPTARG;;
t) TYPE=$OPTARG;;
s) SIM=$OPTARG;;
\?) usage ;;
esac
done
shift `expr $OPTIND - 1`
# 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