trace2ver
1.81 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
#!/usr/local/bin/perl
#
$TEST = "";
$TRACE_FILE = "";
if ($#ARGV >= 0){
$TEST = $ARGV[0];
$TRACE_FILE = $TEST.".ctrace";
}
if ($#ARGV == 1){
$RANDOM = 1;
}
open(TRACEIN,$TRACE_FILE) || die "Cant open $TRACE_FILE \n";
open(FP_SU,">$TEST.trSU") || die "Cant open file $TEST.trSU \n";
open(FP_VU,">$TEST.trVU") || die "Cant open file $TEST.trVU \n";
open(FP_DM,">$TEST.trDM") || die "Cant open file $TEST.trDM \n";
if ($RANDOM) {
open(FP_NC,">$TEST.NC") || die "Cant open file $TEST.NC \n";
}
$DEPTH = 256;
for ($i=0; $i<32; $i++) {
$VU_CNT[$i] = 0;
}
$SU_CNT = 0;
$DM_CNT = 0;
while ($_ = <TRACEIN>) {
split;
chop;
if ($_[0] eq "SU") {
$SU_CNT++;
printf FP_SU "@%03X %s //pc=%s \n",$SU_CNT,$_[2], $_[1];
}
elsif ($_[0] eq "VS" || $_[0] eq "VV") {
($JUNK,$VR) = split(/V/,$_[1]);
$VU_CNT[$VR]++;
if ($_[0] eq "VS") {
printf FP_VU "@%04X 0_%s //bySU, pc=%s \n",$VU_CNT[$VR]+($VR*$DEPTH),$_[3], $_[2];
}
else {
printf FP_VU "@%04X 1_%s\t\t\t//byVU, pc=%s \n",$VU_CNT[$VR]+($VR*$DEPTH),$_[3], $_[2];
}
}
elsif ($_[0] eq "DM") {
$DM_CNT++;
printf FP_DM "@%03X %s //pc=%s \n",$DM_CNT,$_[2], $_[1];
}
elsif ($_[0] eq "NC") {
printf FP_NC "@0 %s\n",$_[1];
}
else {
die "ERROR: unrecognised token";
}
}
print FP_SU "/**********/\n";
printf FP_SU "@000 %05x //Trace Count \n",$SU_CNT;
print FP_VU "/**********/\n";
for ($i=0; $i<32; $i++) {
printf FP_VU "@%04X %05x //Trace Count \n",($i*$DEPTH),$VU_CNT[$i];
if ($VU_CNT[$i]>=$DEPTH) {
printf FP_VU "TRACE COUNT on Vector Register %d Exceeds $DEPTH\n",$i;
}
}
print FP_DM "/**********/\n";
printf FP_DM "@000 %05x //Trace Count \n",$DM_CNT;
close (FP_SU);
close (FP_VU);
close (FP_DM);
if ($RANDOM) { close (FP_NC); }