inp008.c
1.86 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
#include <bstring.h>
#include <stdio.h>
#include "inp.h"
static void passThrough(void);
static void varyAlpha(void);
int
main(int argc, char *argv[])
{
printHeader();
passThrough();
varyAlpha();
printTrailingCycles();
}
/*
* passThrough choose an alpha such that numerator (and denominator)
* of multiply is non-zero and step through all coverage values.
*/
static void
passThrough(void)
{
cc_t cc;
cc_t *ccp = &cc;
int i;
bzero(ccp, sizeof(cc));
ccp->ncyc = 0; /* one cycle mode */
/* Initialize mode 1 (x,y,a,c) selects to produce (0,0,0,0) */
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;
ccp->alpha_cvg_select = 0;
printf("# Coverage value pass through test\n");
for (i = 0; i <= 8; i++) {
ccp->cvg = i;
printf("# cvg 0x%x\n", ccp->cvg);
printVector(ccp, 1);
}
}
/*
* varyAlpha hold coverage value constant and vary alpha values
* and verify that coverage does not vary
*/
static void
varyAlpha(void)
{
cc_t cc;
cc_t *ccp = &cc;
int i;
bzero(ccp, sizeof(cc));
ccp->ncyc = 0; /* one cycle mode */
/* Initialize mode 1 (x,y,a,c) selects to produce (0,0,0,0) */
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_PRIM_ALPHA;
ccp->alpha_cvg_select = 0;
ccp->cvg = 0x2;
printf("# Vary alpha while holding coverage constant\n");
for (i = 1; i < 32; i++) {
ccp->prim_a = i<<3;
printf("# alpha 0x%x\n", ccp->prim_a);
printVector(ccp, 1);
}
}