inp001.c
3.55 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
/**************************************************************************
* *
* Copyright (C) 1994, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
*************************************************************************/
#include <bstring.h>
#include <stdio.h>
#include <mbi.h> /* from software-land */
#include "inp.h"
static void simpleTest(void);
static void checkResetValues(void);
static void incrementWritePointer(void);
static void checkRequest(void);
static void doFILLRECT(vector_t *vp);
static void doNOOP(vector_t *vp, int);
static void printTrailingCycles(void);
int
main(int argc, char *argv[])
{
printHeader();
resetFifo();
initFifo();
resetFifo();
incrementWritePointer();
resetFifo();
checkRequest();
printTrailingCycles();
}
static void
incrementWritePointer(void)
{
int i;
vector_t v;
vector_t *vp = &v;
printf("# Supply data, verify read/write pointers increment and wraps\n");
bzero(vp, sizeof(*vp));
vp->reset_l = 1;
for (i = 0; i < 66; i++) {
doNOOP(vp, 1);
}
}
static void
checkRequest(void)
{
int i;
vector_t v;
vector_t *vp = &v;
bzero(vp, sizeof(*vp));
vp->reset_l = 1;
printf("# Verify cs_xbus_request goes low when (r < 32) && (w < 32)\n");
doFILLRECT(vp);
doFILLRECT(vp);
printf("# Verify cs_xbus_request goes high when fifo empties\n");
for (i = 0; i < 22; i++)
doNOOP(vp, 1);
vp->xbus_cs_valid = 0;
vp->data64 = 0;
for (i = 0; i < 37; i++)
printVector(vp, 1);
printf("# Verify cs_xbus_request goes low when (r < 32) && (w >= 32)\n");
doFILLRECT(vp);
doFILLRECT(vp);
printf("# Verify cs_xbus_request goes high when fifo empties\n");
for (i = 0; i < 22; i++)
doNOOP(vp, 1);
vp->xbus_cs_valid = 0;
vp->data64 = 0;
for (i = 0; i < 37; i++)
printVector(vp, 1);
printf("# Verify cs_xbus_request goes low when (r >= 32) && (w < 32)\n");
doFILLRECT(vp);
doFILLRECT(vp);
printf("# Verify cs_xbus_request goes high when fifo empties\n");
for (i = 0; i < 22; i++)
doNOOP(vp, 1);
vp->xbus_cs_valid = 0;
vp->data64 = 0;
for (i = 0; i < 37; i++)
printVector(vp, 1);
printf("# Verify cs_xbus_request goes low when (r < 32) && (w >= 32)\n");
doFILLRECT(vp);
doFILLRECT(vp);
printf("# Verify cs_xbus_request goes high when fifo empties\n");
for (i = 0; i < 22; i++)
doNOOP(vp, 1);
vp->xbus_cs_valid = 0;
vp->data64 = 0;
for (i = 0; i < 37; i++)
printVector(vp, 1);
}
static void
doFILLRECT(vector_t *vp)
{
printf("# FILLRECT\n");
vp->xbus_cs_valid = 1;
vp->gfillr.cmd = G_FILLRECT;
vp->gfillr.x0 = 100;
vp->gfillr.y0 = 150;
vp->gfillr.pad = 0;
vp->gfillr.x1 = 200;
vp->gfillr.y1 = 250;
printVector(vp, 1);
}
static void
doNOOP(vector_t *vp, int valid)
{
printf("# NOOP\n");
vp->xbus_cs_valid = 1;
vp->data[0] = (G_NOOP << 24);
vp->data[1] = 0x0;
printVector(vp, valid);
}
static void
printTrailingCycles(void)
{
int i;
vector_t v;
vector_t *vp = &v;
printf("# Trailing cycles\n");
bzero(vp, sizeof(*vp));
vp->reset_l = 1;
for (i = 0; i < 3; i++)
printVector(vp, 0);
}