inp000.c
8.77 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
/*
* inp000.c - run a few simple cases through to make sure
* steppers working.
*/
#include <stdio.h>
#include <stdlib.h>
/*
* G l o b a l s
*/
int startspan_r; /* */
int startspan_g; /* */
int startspan_b; /* */
int startspan_a; /* */
int startspan_z; /* */
int startspan_s; /* */
int startspan_t; /* */
int startspan_w; /* */
int startspan_l; /* */
int ep_st_r; /* [15:0], initial r 10.6 */
int ep_st_g; /* [15:0], initial g 10.6 */
int ep_st_b; /* [15:0], initial b 10.6 */
int ep_st_a; /* [15:0], initial a 10.6 */
int ep_st_z; /* [21:0], initial z s15.6 */
int ep_st_s; /* [21:0], initial s s15.6 */
int ep_st_t; /* [21:0], initial t s15.6 */
int ep_st_w; /* [21:0], initial w s15.6 */
int ep_st_l; /* [21:0], initial l s15.6 */
int at_st_dxr; /* [21:0], change in x, s,10.11 */
int at_st_dxg; /* [21:0], change in x, s,10.11 */
int at_st_dxb; /* [21:0], change in x, s,10.11 */
int at_st_dxa; /* [21:0], change in x, s,10.11 */
int at_st_dxz; /* [31:0], change in x, s,15.16 */
int at_st_dxs; /* [26:0], change in x, s,15.16 */
int at_st_dxt; /* [26:0], change in x, s,15.16 */
int at_st_dxw; /* [26:0], change in x, s,15.16 */
int at_st_dxl; /* [26:0], change in x, s,15.16 */
int at_st_dyr; /* [12:0], change in y, s,10.2 */
int at_st_dyg; /* [12:0], change in y, s,10.2 */
int at_st_dyb; /* [12:0], change in y, s,10.2 */
int at_st_dya; /* [12:0], change in y, s,10.2 */
int at_st_dyz; /* [21:0], change in y, s,10.11 */
int x_offsetr; /* [1:0], subpixel offset in x, 0.2 */
int x_offsetg; /* [1:0], subpixel offset in x, 0.2 */
int x_offsetb; /* [1:0], subpixel offset in x, 0.2 */
int x_offseta; /* [1:0], subpixel offset in x, 0.2 */
int x_offsetz; /* [1:0], subpixel offset in x, 0.2 */
int y_offsetr; /* [1:0], subpixel offset in y, 0.2 */
int y_offsetg; /* [1:0], subpixel offset in y, 0.2 */
int y_offsetb; /* [1:0], subpixel offset in y, 0.2 */
int y_offseta; /* [1:0], subpixel offset in y, 0.2 */
int y_offsetz; /* [1:0], subpixel offset in y, 0.2 */
int ncyc_r; /* */
int ncyc_g; /* */
int ncyc_b; /* */
int ncyc_a; /* */
int ncyc_z; /* */
int ncyc_s; /* */
int ncyc_t; /* */
int ncyc_w; /* */
int ncyc_l; /* */
int left_r; /* */
int left_g; /* */
int left_b; /* */
int left_a; /* */
int left_z; /* */
int left_s; /* */
int left_t; /* */
int left_w; /* */
int left_l; /* */
int dv;
int exit1;
static void
print_vectors( char *prog_name )
{
static int first_time = 1;
if(first_time)
{
first_time = 0;
printf("#\n");
printf("# created by %s.c\n", prog_name);
printf("#\n");
printf("gclk @C 1(8) 0(8)\n");
printf("startspan_r @I @E 0\n");
printf("startspan_g @I @E 0\n");
printf("startspan_b @I @E 0\n");
printf("startspan_a @I @E 0\n");
printf("startspan_z @I @E 0\n");
printf("startspan_s @I @E 0\n");
printf("startspan_t @I @E 0\n");
printf("startspan_w @I @E 0\n");
printf("startspan_l @I @E 0\n");
printf("ep_st_r[15:0] @I @E 0\n");
printf("ep_st_g[15:0] @I @E 0\n");
printf("ep_st_b[15:0] @I @E 0\n");
printf("ep_st_a[15:0] @I @E 0\n");
printf("ep_st_z[21:0] @I @E 0\n");
printf("ep_st_s[21:0] @I @E 0\n");
printf("ep_st_t[21:0] @I @E 0\n");
printf("ep_st_w[21:0] @I @E 0\n");
printf("ep_st_l[21:0] @I @E 0\n");
printf("at_st_dxr[21:0] @I @E 0\n");
printf("at_st_dxg[21:0] @I @E 0\n");
printf("at_st_dxb[21:0] @I @E 0\n");
printf("at_st_dxa[21:0] @I @E 0\n");
printf("at_st_dxz[31:0] @I @E 0\n");
printf("at_st_dxs[26:0] @I @E 0\n");
printf("at_st_dxt[26:0] @I @E 0\n");
printf("at_st_dxw[26:0] @I @E 0\n");
printf("at_st_dxl[26:0] @I @E 0\n");
printf("at_st_dyr[12:0] @I @E 0\n");
printf("at_st_dyg[12:0] @I @E 0\n");
printf("at_st_dyb[12:0] @I @E 0\n");
printf("at_st_dya[12:0] @I @E 0\n");
printf("at_st_dyz[21:0] @I @E 0\n");
printf("x_offsetr[1:0] @I @E 0\n");
printf("x_offsetg[1:0] @I @E 0\n");
printf("x_offsetb[1:0] @I @E 0\n");
printf("x_offseta[1:0] @I @E 0\n");
printf("x_offsetz[1:0] @I @E 0\n");
printf("y_offsetr[1:0] @I @E 0\n");
printf("y_offsetg[1:0] @I @E 0\n");
printf("y_offsetb[1:0] @I @E 0\n");
printf("y_offseta[1:0] @I @E 0\n");
printf("y_offsetz[1:0] @I @E 0\n");
printf("ncyc_r @I @E 0\n");
printf("ncyc_g @I @E 0\n");
printf("ncyc_b @I @E 0\n");
printf("ncyc_a @I @E 0\n");
printf("ncyc_z @I @E 0\n");
printf("ncyc_s @I @E 0\n");
printf("ncyc_t @I @E 0\n");
printf("ncyc_w @I @E 0\n");
printf("ncyc_l @I @E 0\n");
printf("left_r @I @E 0\n");
printf("left_g @I @E 0\n");
printf("left_b @I @E 0\n");
printf("left_a @I @E 0\n");
printf("left_z @I @E 0\n");
printf("left_s @I @E 0\n");
printf("left_t @I @E 0\n");
printf("left_w @I @E 0\n");
printf("left_l @I @E 0\n");
printf("dv @I @E 0\n");
printf("exit @I @E 0\n");
printf("\n"); /* required newline */
}
/*
* print input signals
*/
printf("%d %d %d %d %d %d %d %d %d ",
startspan_r,
startspan_g,
startspan_b,
startspan_a,
startspan_z,
startspan_s,
startspan_t,
startspan_w,
startspan_l );
printf(" 0x%.4x 0x%.4x 0x%.4x 0x%.4x 0x%.6x 0x%.6x 0x%.6x 0x%.6x 0x%.6x ",
ep_st_r,
ep_st_g,
ep_st_b,
ep_st_a,
ep_st_z,
ep_st_s,
ep_st_t,
ep_st_w,
ep_st_l );
printf(" 0x%.6x 0x%.6x 0x%.6x 0x%.6x 0x%.8x 0x%.7x 0x%.7x 0x%.7x 0x%.7x ",
at_st_dxr,
at_st_dxg,
at_st_dxb,
at_st_dxa,
at_st_dxz,
at_st_dxs,
at_st_dxt,
at_st_dxw,
at_st_dxl );
printf(" 0x%.4x 0x%.4x 0x%.4x 0x%.4x 0x%.6x ",
at_st_dyr,
at_st_dyg,
at_st_dyb,
at_st_dya,
at_st_dyz );
printf(" 0x%.1x 0x%.1x 0x%.1x 0x%.1x 0x%.1x ",
x_offsetr,
x_offsetg,
x_offsetb,
x_offseta,
x_offsetz );
printf(" 0x%.1x 0x%.1x 0x%.1x 0x%.1x 0x%.1x ",
y_offsetr,
y_offsetg,
y_offsetb,
y_offseta,
y_offsetz);
printf(" %d %d %d %d %d %d %d %d %d ",
ncyc_r,
ncyc_g,
ncyc_b,
ncyc_a,
ncyc_z,
ncyc_s,
ncyc_t,
ncyc_w,
ncyc_l);
printf(" %d %d %d %d %d %d %d %d %d ",
left_r,
left_g,
left_b,
left_a,
left_z,
left_s,
left_t,
left_w,
left_l);
printf(" %d %d\n", dv, exit1);
}
int
main(int argc, char **argv)
{
int st_pt, dx, dy, ox, oy;
/* print header */
print_vectors(argv[0]);
dv = 1;
/* do left major first */
left_r = 1;
left_g = 1;
left_b = 1;
left_a = 1;
left_z = 1;
left_s = 1;
left_t = 1;
left_w = 1;
left_l = 1;
for(st_pt = 0; st_pt < 4; st_pt++)
{
startspan_r = 1;
startspan_g = 1;
startspan_b = 1;
startspan_a = 1;
startspan_z = 1;
startspan_s = 1;
startspan_t = 1;
startspan_w = 1;
startspan_l = 1;
switch(st_pt)
{
case 2: /* do right major */
left_r = 0;
left_g = 0;
left_b = 0;
left_a = 0;
left_z = 0;
left_s = 0;
left_t = 0;
left_w = 0;
left_l = 0;
case 0:
printf("# load all with zeros, dx = 1.0, dy = 0 \n");
ep_st_r = 0;
ep_st_g = 0;
ep_st_b = 0;
ep_st_a = 0;
ep_st_z = 0;
ep_st_s = 0;
ep_st_t = 0;
ep_st_w = 0;
ep_st_l = 0;
break;
case 3:
case 1:
printf("# load all with close to max values, dx = 1.0, dy = 0 \n");
ep_st_r = 0x7fff;
ep_st_g = 0x7fff;
ep_st_b = 0x7fff;
ep_st_a = 0x7fff;
ep_st_z = 0x3fffff;
ep_st_s = 0x3fffff;
ep_st_t = 0x3fffff;
ep_st_w = 0x3fffff;
ep_st_l = 0x3fffff;
break;
}
print_vectors(argv[0]);
for(dx = 0; dx < 50; dx++)
{
x_offsetr = dx % 4;
x_offsetg = dx % 4;
x_offsetb = dx % 4;
x_offseta = dx % 4;
x_offsetz = dx % 4;
y_offsetr = dx % 4;
y_offsetg = dx % 4;
y_offsetb = dx % 4;
y_offseta = dx % 4;
y_offsetz = dx % 4;
startspan_r = 0;
startspan_g = 0;
startspan_b = 0;
startspan_a = 0;
startspan_z = 0;
startspan_s = 0;
startspan_t = 0;
startspan_w = 0;
startspan_l = 0;
at_st_dxr = 0x800;
at_st_dxg = 0x800;
at_st_dxb = 0x800;
at_st_dxa = 0x800;
at_st_dxz = 0x800;
at_st_dxs = 0x800;
at_st_dxt = 0x800;
at_st_dxw = 0x800;
at_st_dxl = 0x800;
print_vectors(argv[0]);
}
}
exit1 = 1;
print_vectors(argv[0]);
}