inp000.c
2.02 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
/*
* 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 vcectors
*/
main(int argc, char **argv)
{
int i;
x_major = 0xaa;
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 = 0xee;
print_input_sigs();
printf("# xm0\n");
ew_cv_data = 0xdd << 3;
print_input_sigs();
printf("# xh1\n");
ew_cv_data = 0xcc;
print_input_sigs();
printf("# xm1\n");
ew_cv_data = 0xbb << 3;
print_input_sigs();
printf("# xh2\n");
ew_cv_data = 0xaa;
print_input_sigs();
printf("# xm2\n");
ew_cv_data = 0x99 << 3;
print_input_sigs();
printf("# xh3\n");
ew_cv_data = 0x88;
print_input_sigs();
printf("# xm3\n");
ew_cv_data = 0x77 << 3;
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 < 100; i++)
print_input_sigs();
}