inp003.c
2.6 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
#include <bstring.h>
#include <stdio.h>
#include "inp.h"
static void oneCycleMode(void);
static void twoCycleMode(void);
int
main(int argc, char *argv[])
{
printHeader();
oneCycleMode();
twoCycleMode();
printTrailingCycles();
}
static void
oneCycleMode(void)
{
cc_t cc;
cc_t *ccp = &cc;
int i;
bzero(ccp, sizeof(cc));
ccp->ncyc = 0; /* one cycle mode */
/* Initialize mode 0 (x,y,a,c) selects to produce (0,0,0,0) */
ccp->cc_x_sel_0_r = CC_SUBA_ZERO;
ccp->cc_y_sel_0_r = CC_SUBB_ZERO;
ccp->cc_a_sel_0_r = CC_MULT_ZERO;
ccp->cc_c_sel_0_r = CC_ADD_ZERO;
ccp->cc_x_sel_0_a = CC_SUBA_ZERO_ALPHA;
ccp->cc_y_sel_0_a = CC_SUBB_ZERO_ALPHA;
ccp->cc_a_sel_0_a = CC_MULT_ZERO_ALPHA;
ccp->cc_c_sel_0_a = CC_ADD_ZERO_ALPHA;
/* Initialize mode 1 (x,y,a,c) selects to produce (0,0,0,1) */
ccp->cc_x_sel_1_r = CC_SUBA_ZERO;
ccp->cc_y_sel_1_r = CC_SUBB_ZERO;
ccp->cc_a_sel_1_r = CC_MULT_ZERO;
ccp->cc_c_sel_1_r = CC_ADD_ONE;
ccp->cc_x_sel_1_a = CC_SUBA_ZERO_ALPHA;
ccp->cc_y_sel_1_a = CC_SUBB_ZERO_ALPHA;
ccp->cc_a_sel_1_a = CC_MULT_ZERO_ALPHA;
ccp->cc_c_sel_1_a = CC_ADD_ONE_ALPHA;
printf("# Toggle start of span in one cycle mode\n");
ccp->st_span = 0; /* start of span off */
printVector(ccp, 1);
ccp->st_span = 1; /* start of span on, remain in cycle 1 */
printVector(ccp, 1);
printVector(ccp, 1);
ccp->st_span = 0; /* start of span off, remain in cycle 1 */
printVector(ccp, 1); /* now use cycle 1 selects */
}
static void
twoCycleMode(void)
{
cc_t cc;
cc_t *ccp = &cc;
int i;
bzero(ccp, sizeof(cc));
ccp->ncyc = 1; /* two cycle mode */
/* Initialize mode 0 (x,y,a,c) selects to produce (0,0,0,0) */
ccp->cc_x_sel_0_r = CC_SUBA_ZERO;
ccp->cc_y_sel_0_r = CC_SUBB_ZERO;
ccp->cc_a_sel_0_r = CC_MULT_ZERO;
ccp->cc_c_sel_0_r = CC_ADD_ZERO;
ccp->cc_x_sel_0_a = CC_SUBA_ZERO_ALPHA;
ccp->cc_y_sel_0_a = CC_SUBB_ZERO_ALPHA;
ccp->cc_a_sel_0_a = CC_MULT_ZERO_ALPHA;
ccp->cc_c_sel_0_a = CC_ADD_ZERO_ALPHA;
/* Initialize mode 1 (x,y,a,c) selects to produce (0,0,0,1) */
ccp->cc_x_sel_1_r = CC_SUBA_ZERO;
ccp->cc_y_sel_1_r = CC_SUBB_ZERO;
ccp->cc_a_sel_1_r = CC_MULT_ZERO;
ccp->cc_c_sel_1_r = CC_ADD_ONE;
ccp->cc_x_sel_1_a = CC_SUBA_ZERO_ALPHA;
ccp->cc_y_sel_1_a = CC_SUBB_ZERO_ALPHA;
ccp->cc_a_sel_1_a = CC_MULT_ZERO_ALPHA;
ccp->cc_c_sel_1_a = CC_ADD_ONE_ALPHA;
printf("# Toggle start of span in two cycle mode\n");
ccp->st_span = 0; /* start of span off */
printVector(ccp, 1);
ccp->st_span = 1; /* start of span on, remain in cycle 0 */
printVector(ccp, 1);
ccp->st_span = 0; /* start of span off, go to cycle 1 */
printVector(ccp, 1);
printVector(ccp, 1); /* back to cycle 0 */
}