inp001.c
2.49 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
/*
* inp000.c: quick check of coverage unit
*/
#include <stdio.h>
/*
* Signals
*/
int ew_cv_data; /* [12:0] */
int x_major; /* [11:0] */
int cycle_type; /* lsb of cycle type */
int ew_cv_newspan; /* start span */
int left; /* left major flag */
int reset;
int dv; /* data valid */
/*
* Prints header info for input signals, same for all dumps
*/
static void
print_input_header( void )
{
printf("gclk @C 1(8) 0(8)\n");
printf("ew_cv_data[12:0] @I @E 0\n");
printf("x_major[11:0] @I @E 0\n");
printf("cycle_type @I @E 0\n");
printf("ew_cv_newspan @I @E 0\n");
printf("left @I @E 0\n");
printf("reset @I @E 0\n");
printf("dv @I @E 0\n");
printf("\n");
}
/*
* Prints signal values info for input signals, same for all dumps
*/
static void
print_input_sigs( void )
{
printf("0x%.4x 0x%0.3x %d %d %d %d %d\n",
ew_cv_data,
x_major,
cycle_type,
ew_cv_newspan,
left,
reset,
dv);
}
/*
* Generate test vectors
*/
main(int argc, char **argv)
{
int i;
/*
* 0 1 2 3 4 5 6 7
* +----#-+------+------+--@---+------+------+------+------+
* | | #| @ | | | | | |
* | | @ | #| | | | | |
* | @ | | | #| | | | |
* +------+------+------+------+------+------+------+------+
* 0 1 2 3 4 5 6 7
*
* @ - left edge
* # - right edge
*/
x_major = 0x00;
cycle_type = 0;
left = 1;
print_input_header();
printf("# reset 6 clocks\n");
reset = 0;
for(i = 0; i < 6; i++)
print_input_sigs();
reset = 1;
printf("# xh0\n");
ew_cv_data = 0x26;
print_input_sigs();
printf("# xm0\n");
ew_cv_data = 0x06;
print_input_sigs();
printf("# xh1\n");
ew_cv_data = 0x1e;
print_input_sigs();
printf("# xm1\n");
ew_cv_data = 0x0e;
print_input_sigs();
printf("# xh2\n");
ew_cv_data = 0x14;
print_input_sigs();
printf("# xm2\n");
ew_cv_data = 0x16;
print_input_sigs();
printf("# xh3\n");
ew_cv_data = 0x0c;
print_input_sigs();
printf("# xm3\n");
ew_cv_data = 0x1e;
print_input_sigs();
printf("# xval, latch xm's, xh's\n");
ew_cv_data = 0xf;
ew_cv_newspan = 1;
print_input_sigs();
dv = 1; /* one clock after new span, data should be valid */
ew_cv_newspan = 0;
for(i = 0; i < 25; i++)
print_input_sigs();
}