inp001.c
4.01 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
/*
* inp001.c: check "left" signal delay
*/
#include <stdio.h>
#include "ints.h"
#include "rdpcmd.h"
#define SET_COMMAND(cmd) (cs_ew_d.word1 = cmd << 24)
/*
* Signals
*/
int reset;
int cs_st_prim;
int cs_st_attr;
int cs_cmd; /* [5:0] */
int64 cs_ew_d; /* [63:0] */
int dv; /* data valid */
unsigned int count; /* count clocks after start_span */
/*
* Prints header info for input signals, same for all dumps
*/
static void
print_input_header( void )
{
printf("# inp000.c: Check unsynced attributes\n");
printf("gclk @C 1(8) 0(8)\n");
printf("reset @I @E 0\n");
printf("cs_st_prim @I @E 0\n");
printf("cs_st_attr @I @E 0\n");
printf("cs_cmd[5:0] @I @E 0\n");
printf("cs_ew_d[63:0] @I @E 0\n");
printf("dv @I @E 0\n");
printf("count[31:0] @I @E 0\n");
printf("\n"); /* required newline */
}
/*
* Prints signal values info for input signals, same for all dumps
*/
static void
print_input_sigs( void )
{
printf("%d %d %d 0x%0.2x 0x%0.8x%0.8x %d 0x%0.8x\n",
reset,
cs_st_prim,
cs_st_attr,
cs_cmd,
cs_ew_d.word1,
cs_ew_d.word0,
dv,
count);
if(cs_st_prim)
count = 0;
else
count++;
}
/*
* reset_sig: reset for 60 clocks
*/
static void
reset_sigs( void )
{
int i;
printf("# reset 60 clocks\n");
reset = 0;
print_input_sigs();
reset = 1;
for(i = 0; i < 60; i++)
print_input_sigs();
printf("# release reset\n");
reset = 0;
print_input_sigs();
print_input_sigs();
print_input_sigs();
}
/*
* Initialize every latch to zero so we don't get bad compares
*/
static void
init_latches( void )
{
int i;
cs_st_attr = 1;
cs_ew_d.word1 = 0x0;
cs_ew_d.word0 = 0x0;
printf("# SETCIMG\n");
cs_cmd = SETCIMG;
print_input_sigs();
printf("# SETMIMG\n");
cs_cmd = SETMIMG;
print_input_sigs();
printf("# SETTIMG\n");
cs_cmd = SETTIMG;
print_input_sigs();
printf("# SETCOMBINE\n");
cs_cmd = SETCOMBINE;
print_input_sigs();
printf("# SETENVCOLOR\n");
cs_cmd = SETENVCOLOR;
print_input_sigs();
printf("# SETPRIMCOLOR\n");
cs_cmd = SETPRIMCOLOR;
print_input_sigs();
printf("# SETBLENDCOLOR\n");
cs_cmd = SETBLENDCOLOR;
print_input_sigs();
printf("# SETFOGCOLOR\n");
cs_cmd = SETFOGCOLOR;
print_input_sigs();
printf("# SETFILLCOLOR\n");
cs_cmd = SETFILLCOLOR;
print_input_sigs();
printf("# SETTILE\n");
cs_cmd = SETTILE;
print_input_sigs();
printf("# SETTILESIZE\n");
cs_cmd = SETTILESIZE;
print_input_sigs();
printf("# SETRDPOTHER\n");
cs_cmd = SETRDPOTHER;
print_input_sigs();
printf("# SETPRIMDEPTH\n");
cs_cmd = SETPRIMDEPTH;
print_input_sigs();
printf("# SETSCISSOR\n");
cs_cmd = SETSCISSOR;
print_input_sigs();
printf("# SETCONVERT\n");
cs_cmd = SETCONVERT;
print_input_sigs();
printf("# SETKEYR\n");
cs_cmd = SETKEYR;
print_input_sigs();
printf("# SETKEYGB\n");
cs_cmd = SETKEYGB;
print_input_sigs();
printf("# SETKEYGB\n");
cs_cmd = SETKEYGB;
print_input_sigs();
printf("# TRIFILL\n");
cs_cmd = TRIFILL;
cs_st_prim = 1;
print_input_sigs();
cs_st_prim = 0;
print_input_sigs();
for(i = 0; i < 40; i++)
print_input_sigs();
}
/*
* Generate test vectors
*/
main(int argc, char **argv)
{
int i;
print_input_header();
reset_sigs();
init_latches();
dv = 1;
printf("# set other modes = 0, tlut_en = 0\n");
cs_st_attr = 1;
cs_cmd = SETRDPOTHER;
cs_ew_d.word1 = 0x0;
cs_ew_d.word0 = 0x0;
print_input_sigs();
cs_st_attr = 0;
cs_cmd = 0;
print_input_sigs();
printf("# set left flag\n");
cs_st_prim = 1;
cs_ew_d.word1 = 0x00800000;
cs_ew_d.word0 = 0xdeaddaff;
print_input_sigs();
printf("# unset left flag\n");
cs_st_prim = 0;
cs_ew_d.word1 = 0x00000000;
cs_ew_d.word0 = 0xbeefface;
print_input_sigs();
print_input_sigs();
print_input_sigs();
print_input_sigs();
cs_st_prim = 1;
print_input_sigs();
cs_st_prim = 0;
print_input_sigs();
printf("# wait 40 clocks\n");
for(i = 0; i < 45; i++)
print_input_sigs();
}