checklerp.c
1.35 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
#include <stdio.h>
#include "PR/rdpsim/test/vi/OutData/vi_lerp/vivl.c"
main(int argc, char *argv[])
{
FILE *InFile;
char InData[80] = "foo";
char *ReadOk = "foo";
unsigned int frac, rgb_a, rgb_b, sync_b, vlerp_rgb, vlerp_sync, clerp_rgb, clerp_sync;
int CurrentLine = 0;
int NumErrors = 0;
if (!argv[1])
{
fprintf(stderr, "ERROR, specify file \n");
NumErrors++;
}
else if ((InFile = fopen(argv[1], "r")) == NULL)
{
fprintf(stderr, "ERROR, cannot open %s \n", argv[1]);
exit (1);
}
while((InData[0] != '0') && (InData[1] != 'x'))
{
fgets(InData, 80, InFile);
CurrentLine++;
}
while (ReadOk)
{
sscanf(InData, "%x %x %x %x %x %x",
&frac, &rgb_a, &rgb_b, &sync_b, &vlerp_rgb, &vlerp_sync);
vivl(frac, rgb_a, rgb_b, sync_b, &clerp_rgb, &clerp_sync);
if (vlerp_rgb != clerp_rgb)
{
printf("ERROR rgb, line %d (computed) 0x%.2x != (verilog) 0x%.2x \n",
CurrentLine, clerp_rgb, vlerp_rgb);
NumErrors++;
}
if (vlerp_sync != clerp_sync)
{
printf("ERROR sync, line %d (computed) %d != (verilog) %d \n",
CurrentLine, clerp_sync, vlerp_sync);
NumErrors++;
}
ReadOk = fgets(InData, 80, InFile);
CurrentLine++;
}
fclose(InFile);
printf("!!! %s of vi_lerp: number of errors:\t\t%d\n", argv[1], NumErrors);
}