inp001.c
11.3 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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
/*
* inp001.c - check loading/holding of accumulators
* 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);
}
/*
* load_accum - set all load signals
*/
void load_accum( void )
{
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;
}
/*
* free_accum - reset all load signals
*/
void free_accum( void )
{
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;
}
/*
* left_major(): set all left major signals
*/
void left_major( void )
{
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;
}
/*
* right_major(): reset all left major signals
*/
void right_major( void )
{
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;
}
/*
* pattern0(): set pattern zero
*/
void pattern0( void )
{
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;
}
/*
* pattern1(): set pattern zero
*/
void pattern1( void )
{
ep_st_r = 0xffff;
ep_st_g = 0xffff;
ep_st_b = 0xffff;
ep_st_a = 0xffff;
ep_st_z = 0x3fffff;
ep_st_s = 0x3fffff;
ep_st_t = 0x3fffff;
ep_st_w = 0x3fffff;
ep_st_l = 0x3fffff;
}
/*
* pattern2(): set pattern zero
*/
void pattern2( void )
{
ep_st_r = 0xd555;
ep_st_g = 0xd555;
ep_st_b = 0xd555;
ep_st_a = 0xd555;
ep_st_z = 0x2aaaaa;
ep_st_s = 0x155555;
ep_st_t = 0x155555;
ep_st_w = 0x155555;
ep_st_l = 0x155555;
}
/*
* pattern3(): set pattern zero
*/
void pattern3( void )
{
ep_st_r = 0x2aaa;
ep_st_g = 0x2aaa;
ep_st_b = 0x2aaa;
ep_st_a = 0x2aaa;
ep_st_z = 0x155555;
ep_st_s = 0x2aaaaa;
ep_st_t = 0x2aaaaa;
ep_st_w = 0x2aaaaa;
ep_st_l = 0x2aaaaa;
}
int
main(int argc, char **argv)
{
int st_pt, dx, dy, ox, oy;
/* print header */
print_vectors(argv[0]);
dv = 1;
left_major();
printf("# Left Major\n");
load_accum();
pattern0();
printf("# load zeros\n");
print_vectors(argv[0]);
load_accum();
pattern1();
printf("# load ones\n");
print_vectors(argv[0]);
load_accum();
pattern0();
printf("# load zeros\n");
print_vectors(argv[0]);
free_accum();
pattern1();
printf("# hold zeros 3 clocks\n");
print_vectors(argv[0]);
print_vectors(argv[0]);
print_vectors(argv[0]);
load_accum();
pattern1();
printf("# load ones\n");
print_vectors(argv[0]);
free_accum();
pattern0();
printf("# hold ones 3 clocks\n");
print_vectors(argv[0]);
print_vectors(argv[0]);
print_vectors(argv[0]);
right_major();
printf("# Right Major\n");
load_accum();
pattern0();
printf("# load zeros\n");
print_vectors(argv[0]);
load_accum();
pattern1();
printf("# load ones\n");
print_vectors(argv[0]);
load_accum();
pattern0();
printf("# load zeros\n");
print_vectors(argv[0]);
free_accum();
pattern1();
printf("# hold zeros 3 clocks\n");
print_vectors(argv[0]);
print_vectors(argv[0]);
print_vectors(argv[0]);
load_accum();
pattern1();
printf("# load ones\n");
print_vectors(argv[0]);
free_accum();
pattern0();
printf("# hold ones 3 clocks\n");
print_vectors(argv[0]);
print_vectors(argv[0]);
print_vectors(argv[0]);
/*
* Next pattern pair
*/
left_major();
printf("# Left Major\n");
load_accum();
pattern2();
printf("# load a's\n");
print_vectors(argv[0]);
load_accum();
pattern3();
printf("# load 5's\n");
print_vectors(argv[0]);
load_accum();
pattern2();
printf("# load a's\n");
print_vectors(argv[0]);
free_accum();
pattern3();
printf("# hold a's 3 clocks\n");
print_vectors(argv[0]);
print_vectors(argv[0]);
print_vectors(argv[0]);
load_accum();
pattern3();
printf("# load 5's\n");
print_vectors(argv[0]);
free_accum();
pattern2();
printf("# hold 5's 3 clocks\n");
print_vectors(argv[0]);
print_vectors(argv[0]);
print_vectors(argv[0]);
right_major();
printf("# Right Major\n");
load_accum();
pattern2();
printf("# load a's\n");
print_vectors(argv[0]);
load_accum();
pattern3();
printf("# load 5's\n");
print_vectors(argv[0]);
load_accum();
pattern2();
printf("# load a's\n");
print_vectors(argv[0]);
free_accum();
pattern3();
printf("# hold a's 3 clocks\n");
print_vectors(argv[0]);
print_vectors(argv[0]);
print_vectors(argv[0]);
load_accum();
pattern3();
printf("# load 5's\n");
print_vectors(argv[0]);
free_accum();
pattern2();
printf("# hold 5's 3 clocks\n");
print_vectors(argv[0]);
print_vectors(argv[0]);
print_vectors(argv[0]);
dv = 0;
print_vectors(argv[0]);
print_vectors(argv[0]);
print_vectors(argv[0]);
exit1 = 1;
print_vectors(argv[0]);
}