checkall.pl
2.79 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
#!/usr/bin/perl
require "/usr/lib/perl/getopts.pl";
require "$ENV{'ROOT'}/PR/rdpsim/test/vi/OutData/vi_pipe/vi_pipe.pl";
local ($cdivot_enable, $cgamma_enable, $cgamma_dither_enable, $crand, $chfrac, $cvfrac,
$crgb0i, $crgb1i, $crgb2i, $crgb3i, $ccvg1i, $ccvg2i, $csynci, $csrgb, $csync,
$osrgb, $osync, $ValidLines);
&Getopts('o:w:h:');
if (defined($opt_w))
{
$ImageWidth = oct($opt_w);
}
else
{
$ImageWidth = 320;
}
if (defined($opt_h))
{
$ImageHeight = oct($opt_h);
}
else
{
$ImageHeight = 240;
}
if (defined($opt_o))
{
if (!open(OUTFILE, ">$opt_o"))
{
print STDERR "Can't open $opt_o: $! \n";
}
else
{
printf("Using width of $ImageWidth height of $ImageHeight \n");
printf(OUTFILE "%s", pack("CCSS", 0, 3, $ImageWidth, $ImageHeight));
$OutputRgb = 1;
}
}
$CurrentX = -2; $CurrentY = 0;
$BufferIndex = 0;
$PixelsValid = 0;
sub WritePixel
{
local ($sync, $srgb);
$srgb = $_[0];
$sync = $_[1];
if ($sync == 1)
{
$PixelsValid = 1;
}
else
{
if ($PixelsValid && ($CurrentX >= 0) && ($CurrentX <= $ImageWidth - 1) &&
($CurrentY <= $ImageHeight - 1))
{
# write pixel
printf(OUTFILE "%c", oct($srgb));
}
if (($CurrentX == $ImageWidth + 1) && ($BufferIndex == 2))
{
$CurrentX = -3; $CurrentY++;
}
if ($PixelsValid)
{
$BufferIndex++;
}
if ($BufferIndex == 3)
{
if ($PixelsValid && ($CurrentX >= 0) &&
($CurrentX <= $ImageWidth - 1) &&
($CurrentY <= $ImageHeight - 1))
{
# spit out full coverage value
printf(OUTFILE "%c", 7);
}
$CurrentX++;
$BufferIndex = 0;
}
}
}
while (<>)
{
next if !(/^[01]/);
chop;
if ($OutputRgb)
{
($cdivot_enable, $cgamma_enable, $cgamma_dither_enable, $crand, $chfrac, $cvfrac,
$crgb0i, $crgb1i, $crgb2i, $crgb3i, $ccvg1i, $ccvg2i, $csynci) = split;
}
else
{
($cdivot_enable, $cgamma_enable, $cgamma_dither_enable, $crand, $chfrac, $cvfrac,
$crgb0i, $crgb1i, $crgb2i, $crgb3i, $ccvg1i, $ccvg2i, $csynci, $vsrgb, $vsync) = split;
}
&vi_pipe($cdivot_enable, $cgamma_enable, $cgamma_dither_enable, $crand, $chfrac, $cvfrac,
$crgb0i, $crgb1i, $crgb2i, $crgb3i, $ccvg1i, $ccvg2i, $csynci, $csrgb, $csync);
if ($OutputRgb)
{
&WritePixel($csrgb, $csync);
}
else
{
# need to skip the first batch of output to get to valid values
if ($csync)
{
$SyncsSeen++;
}
if ($SyncsSeen >= 5)
{
$ValidLines++;
if ($csrgb ne $vsrgb)
{
printf("ERROR rgb, line $. (computed) $csrgb != (verilog) $vsrgb \n");
}
if ($csync ne $vsync)
{
printf("ERROR sync, line $. (computed) $csync != (verilog) $vsync \n");
}
}
if ($ValidLines && !($ValidLines % 100))
{
printf STDERR ".";
}
}
}
printf("\n");
close OUTFILE;