inp001.c
4.92 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
/*
* vi_filter_pipe inp001.c - generate random test vectors for
* top level pipe module
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
/*
* G l o b a l s
*/
int max, min, rgb, cvg;
int rgb_a, rgb_b, rgb_c, rgb_d, rgb_e, rgb_f, rgb_g, cvg_a, sync_a;
unsigned int divot_enable, type, aa_off, gamma_enable, gamma_dither_enable, vrand, hfrac;
unsigned int vfrac, rgb0i, rgb1i, rgb2i, rgb3i, cvg0i, cvg1i, cvg2i, cvg3i, synci;
char *prog_name;
static void
print_vectors()
{
static int first_time = 1;
if(first_time)
{
first_time = 0;
printf("#\n");
printf("# created by %s.c\n", prog_name);
printf("#\n");
printf("vclk @C 1(8) 0(8)\n");
printf("divot_enable @I @E 2\n");
printf("type @I @E 2\n");
printf("aa_off @I @E 2\n");
printf("gamma_enable @I @E 2\n");
printf("gamma_dither_enable @I @E 2\n");
printf("rand[5:0] @I @E 2\n");
printf("hfrac[4:0] @I @E 2\n");
printf("vfrac[4:0] @I @E 2\n");
printf("rgb0i[7:0] @I @E 2\n");
printf("rgb1i[7:0] @I @E 2\n");
printf("rgb2i[7:0] @I @E 2\n");
printf("rgb3i[7:0] @I @E 2\n");
printf("cvg0i[2:0] @I @E 2\n");
printf("cvg1i[2:0] @I @E 2\n");
printf("cvg2i[2:0] @I @E 2\n");
printf("cvg3i[2:0] @I @E 2\n");
printf("synci @I @E 2\n");
printf("\n"); /* required newline */
}
/*
* print input signals
*/
printf("%d 0x%.1x %d %d %d 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.1x 0x%.1x 0x%.1x 0x%.1x %d \n",
divot_enable, type, aa_off, gamma_enable, gamma_dither_enable, vrand, hfrac, vfrac, rgb0i,
rgb1i, rgb2i, rgb3i, cvg0i, cvg1i, cvg2i, cvg3i, synci);
}
void usage(void)
{
fprintf(stderr, "Try again \n");
exit(1);
}
void initialize(void)
{
divot_enable = 0;
type = 0;
aa_off = 0;
gamma_enable = 0;
gamma_dither_enable = 0;
vrand = 0;
hfrac = 0;
vfrac = 0;
rgb0i = 0;
rgb1i = 0;
rgb2i = 0;
rgb3i = 0;
cvg0i = 0;
cvg1i = 0;
cvg2i = 0;
cvg3i = 0;
synci = 0;
}
void setwires(int divot_enableval, int typeval,
int aa_offval, int gamma_enableval,
int gamma_dither_enableval,
int vrandval, int hfracval, int vfracval,
int rgb0ival, int rgb1ival, int rgb2ival,
int rgb3ival, int cvg0ival, int cvg1ival,
int cvg2ival, int cvg3ival, int syncival)
{
divot_enable = divot_enableval;
type = typeval;
aa_off = aa_offval;
gamma_enable = gamma_enableval;
gamma_dither_enable = gamma_dither_enableval;
vrand = vrandval;
hfrac = hfracval;
vfrac = vfracval;
rgb0i = rgb0ival;
rgb1i = rgb1ival;
rgb2i = rgb2ival;
rgb3i = rgb3ival;
cvg0i = cvg0ival;
cvg1i = cvg1ival;
cvg2i = cvg2ival;
cvg3i = cvg3ival;
synci = syncival;
print_vectors();
}
OutputPrimingSyncs()
{
int i;
for (i=0; i< 10; i++)
{
synci = 1;
rgb0i = 16;
rgb1i = 16;
rgb2i = 16;
rgb3i = 16;
print_vectors();
synci = 0;
rgb0i = 0;
rgb1i = 0;
rgb2i = 0;
rgb3i = 0;
print_vectors();
print_vectors();
print_vectors();
}
}
void HandTests(void)
{
}
void DoRandomTests(void)
{
int i;
/* need to use a constant seed so that we can
diff tab files against a golden set stored away
to see if anything has broken later */
srandom(100);
for (i=0; i<20000; i++)
{
setwires(random() & 0x01,
random() & 0x03,
random() & 0x01,
random() & 0x01,
random() & 0x01,
random() & 0x3f,
random() & 0x1f,
random() & 0x1f,
random() & 0xff,
random() & 0xff,
random() & 0xff,
random() & 0xff,
random() & 0x07,
random() & 0x07,
random() & 0x07,
random() & 0x07,
random() & 0x01);
}
}
int
main(int argc, char **argv)
{
int c;
extern char *optarg;
extern int optind;
char *ofile = NULL;
int i;
prog_name = argv[0];
/* Print Headers */
print_vectors();
initialize();
OutputPrimingSyncs();
HandTests();
DoRandomTests();
/*flush pipe */
setwires(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
for (i=0; i<5; i++)
{
print_vectors();
}
return 0;
}