inp003.c
5.15 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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
/*
* inp000.c, generate s (0-(MaxX-1)), t (0-(MaxY-1)), while
* applying a constant modeword.
*
*
*
*/
#include <stdio.h>
#include <stdlib.h>
#include "ints.h"
/*
* Globals
*/
static int MaxX = 64;
static int MaxY = 64;
static int TileNumber = 0;
/* input signals */
static int st_span;
static int ncyc;
static int l;
static int s;
static int t;
static int w;
static int min_level;
static int detail_en;
static int sharp_en;
static int lod_en;
static int persp_en;
static int copy;
static int samp_type;
static int tlut_en;
static int tlut_type;
static int max_level;
static int prim_tile;
static int load;
static int shift_coord;
static int tile_adrs;
static int64 tile_data;
static int we_tile_size;
static int we_tile_attr;
static int vm_in;
static int vm_dv;
static int load_dv;
static int dv;
static int exit1;
static int xo;
static int yo;
static int64 copy_bus;
/*
* print_header, tabular format header file
*/
static void
print_header( void )
{
printf("#\n");
printf("# Created by adrs_walk.c\n");
printf("#\n");
printf("gclk @C 0 8\n");
printf("st_span @I @E 0\n");
printf("ncyc @I @E 0\n");
printf("l[15:0] \"%%04x\" @I\n");
printf("s[15:0] \"%%04x\" @I\n");
printf("t[15:0] \"%%04x\" @I\n");
printf("w[15:0] \"%%04x\" @I\n");
printf("min_level[4:0] \"%%02x\" @I\n");
printf("detail_en @I\n");
printf("sharp_en @I\n");
printf("lod_en @I\n");
printf("persp_en @I\n");
printf("copy @I\n");
printf("samp_type @I\n");
printf("tlut_en @I\n");
printf("tlut_type @I\n");
printf("max_level[2:0] \"%%01x\" @I\n");
printf("prim_tile[2:0] \"%%01x\" @I\n");
printf("load @I\n");
printf("shift_coord @I\n");
printf("tile_adrs[2:0] \"%%01x\" @I\n");
printf("tile_data[47:0] \"%%012x\" @I\n");
printf("we_tile_size @I\n");
printf("we_tile_attr @I\n");
printf("vm_in[7:0] @I\n");
printf("vm_dv @I\n");
printf("copy_load[63:0] \"%%016x\" @B\n");
printf("load_dv @I\n");
printf("dv @I\n");
printf("exit1 @I\n");
printf("x[9:0] \"%%03x\" @I\n");
printf("y[9:0] \"%%03x\" @I\n");
printf("\n"); /* required blank line before vectors */
}
/*
* print_vector, tabular file format vector
*/
static void
print_vector( void )
{
printf("%01x ", st_span);
printf("%01x ", ncyc);
printf("0x%04x ", l & 0xffff);
printf("0x%04x ", s & 0xffff);
printf("0x%04x ", t & 0xffff);
printf("0x%04x ", w & 0xffff);
printf("0x%02x ", min_level & 0x1f);
printf("%01x ", detail_en & 1);
printf("%01x ", sharp_en & 1);
printf("%01x ", lod_en & 1);
printf("%01x ", persp_en & 1);
printf("%01x ", copy & 1);
printf("%01x ", samp_type & 1);
printf("%01x ", tlut_en & 1);
printf("%01x ", tlut_type & 1);
printf("0x%01x ", max_level & 0x7);
printf("0x%01x ", prim_tile & 0x7);
printf("%01x ",load & 1);
printf("%01x ",shift_coord & 1);
printf("0x%01x ",tile_adrs & 0x7);
printf("0x%04x%08x ",tile_data.word1 & 0xffff, tile_data.word0);
printf("%01x ",we_tile_size & 1);
printf("%01x ",we_tile_attr & 1);
printf("0x%02x ",vm_in & 0xff);
printf("%01x ",vm_dv & 1);
printf("0x%08x%08x ", copy_bus.word1, copy_bus.word0);
printf("%01x ",load_dv & 1);
printf("%01x ",dv & 1);
printf("%01x ",exit1 & 1);
printf("0x%03x ", xo & 0x3ff);
printf("0x%03x ", yo & 0x3ff);
printf("\n");
}
/*
* load_mode_word()
*/
static void
load_mode_word(char *fname)
{
/* stub */
}
/*
* adrs_walk()
*/
static void
adrs_walk( void )
{
int i;
int x, y;
int xd, yd;
/* set static signals */
st_span = 1;
ncyc = 0;
l = 0;
w = 0;
min_level = 0;
detail_en = 0;
sharp_en = 0;
lod_en = 0;
persp_en = 0;
copy = 0;
samp_type = 0;
tlut_en = 0;
tlut_type = 0;
max_level = 0;
prim_tile = TileNumber;
load = 0;
shift_coord= 0;
tile_adrs = 0;
tile_data.word0 = 0;
tile_data.word1 = 0;
we_tile_size = 0;
we_tile_attr = 0;
vm_in = 0xff;
vm_dv = 0;
load_dv = 0;
exit1 = 0;
copy_bus.word0 = 0;
copy_bus.word1 = 0;
/* walk addresses */
for(y = 0; y < MaxY; y++)
{
for(x = 0; x < MaxX; x++)
{
/* set dv */
dv = 1;
xo = x;
yo = y;
/* set s, t */
s = x << 5;
t = y << 5;
print_vector();
}
}
/* when valid data runs out, exit */
exit1 = 1;
dv = 0;
for (i=0; i<13; i++)
print_vector();
}
/*
* main()
*/
int
main(int argc, char **argv)
{
int c, i;
extern char *optarg;
extern int optind, opterr, optopt;
optind = 1;
opterr = 0;
while((c = getopt(argc, argv, "m:l:x:y:h")) != EOF)
{
switch(c)
{
case 'm':
load_mode_word(optarg);
break;
case 'l':
TileNumber = atoi(optarg);
break;
case 'x':
MaxX = atoi(optarg);
break;
case 'y':
MaxY = atoi(optarg);
break;
case 'h': fprintf(stderr,"Usage for driver:\n");
fprintf(stderr," -m <mode word file>\n");
fprintf(stderr," -l <tile_num>\n");
fprintf(stderr," -x <max_x>\n");
fprintf(stderr," -y <max_y>\n");
exit(0);
default:
break;
}
}
print_header();
adrs_walk();
return(0);
}