OpenCores
URL https://opencores.org/ocsvn/socgen/socgen/trunk

Subversion Repositories socgen

[/] [socgen/] [trunk/] [Projects/] [opencores.org/] [io/] [ip/] [io_ps2/] [sim/] [icarus/] [mouse_default/] [test_define] - Blame information for rev 131

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 131 jt_eaton
`include "../../testbenches/elab/io_ps2_mouse_tb/sw/mb.v"
2
 
3
initial
4
 begin
5
 $display("              ");
6
 $display("          ===================================================");
7
 $display("%t  Test Start",$realtime);
8
 $display("          ===================================================");
9
 $display("              ");
10
 test.reading = 8'h00;
11
 
12
 test.cg.next(20);
13
 
14
 test.cg.next(10);
15
 fork
16
 begin
17
 
18
 
19
test.start   = 1'b1;
20
 test.bus.u_read(status, test.reading);
21
 while(test.start )
22
   begin
23
    test.bus.u_read(status, test.reading);
24
    if( test.reading & 8'h80)  test.start = 1;
25
    else                  test.start = 0;
26
    test.cg.next(100);
27
   end
28
 
29
// send ff to device
30
 test.bus.u_write(ps2_data, 8'hff);
31
 test.bus.u_write(cntrl, 8'h02);
32
  test.cg.next(5000);
33
 test.bus.u_write(cntrl, 8'h00);
34
 test.cg.next(1000);
35
 
36
 
37
 
38
// receive fa
39
test.start   = 1'b1;
40
 test.bus.u_read(status, test.reading);
41
 while(test.start )
42
   begin
43
    test.bus.u_read(status, test.reading);
44
    if( test.reading & 8'h40)  test.start = 0;
45
    test.cg.next(100);
46
   end
47
 test.bus.u_cmp(ps2_data, 8'hfa);
48
 test.cg.next(1000);
49
 
50
// receive aa
51
 test.start   = 1'b1;
52
 test.bus.u_read(status, test.reading);
53
 while(test.start )
54
   begin
55
    test.bus.u_read(status, test.reading);
56
    if( test.reading & 8'h40)  test.start = 0;
57
    test.cg.next(100);
58
   end
59
 test.bus.u_cmp(ps2_data, 8'haa);
60
 test.cg.next(1000);
61
 
62
// receive 00
63
 test.start   = 1'b1;
64
 test.bus.u_read(status, test.reading);
65
 while(test.start )
66
   begin
67
    test.bus.u_read(status, test.reading);
68
    if( test.reading & 8'h40)  test.start = 0;
69
    test.cg.next(100);
70
   end
71
 test.bus.u_cmp(ps2_data, 8'h00);
72
 test.cg.next(1000);
73
 
74
 
75
// send f3 to device
76
test.start   = 1'b1;
77
 test.bus.u_read(status, test.reading);
78
 while(test.start )
79
   begin
80
    test.bus.u_read(status, test.reading);
81
    if( test.reading & 8'h80)  test.start = 1;
82
    else                  test.start = 0;
83
    test.cg.next(100);
84
   end
85
 test.bus.u_write(ps2_data, 8'hf3);
86
 test.bus.u_write(cntrl, 8'h02);
87
  test.cg.next(5000);
88
 test.bus.u_write(cntrl, 8'h00);
89
 test.cg.next(100);
90
 
91
 
92
// send c8 to device
93
test.start   = 1'b1;
94
 test.bus.u_read(status, test.reading);
95
 while(test.start )
96
   begin
97
    test.bus.u_read(status, test.reading);
98
    if( test.reading & 8'h80)  test.start = 1;
99
    else                  test.start = 0;
100
    test.cg.next(100);
101
   end
102
 test.bus.u_write(ps2_data, 8'hc8);
103
 test.bus.u_write(cntrl, 8'h02);
104
  test.cg.next(5000);
105
 test.bus.u_write(cntrl, 8'h00);
106
 test.cg.next(100);
107
 
108
// send f3 to device
109
test.start   = 1'b1;
110
 test.bus.u_read(status, test.reading);
111
 while(test.start )
112
   begin
113
    test.bus.u_read(status, test.reading);
114
    if( test.reading & 8'h80)  test.start = 1;
115
    else                  test.start = 0;
116
    test.cg.next(100);
117
   end
118
 test.bus.u_write(ps2_data, 8'hf3);
119
 test.bus.u_write(cntrl, 8'h02);
120
  test.cg.next(5000);
121
 test.bus.u_write(cntrl, 8'h00);
122
 test.cg.next(100);
123
 
124
 
125
 
126
 
127
// send 64 to device
128
test.start   = 1'b1;
129
 test.bus.u_read(status, test.reading);
130
 while(test.start )
131
   begin
132
    test.bus.u_read(status, test.reading);
133
    if( test.reading & 8'h80)  test.start = 1;
134
    else                  test.start = 0;
135
    test.cg.next(100);
136
   end
137
 test.bus.u_write(ps2_data, 8'h64);
138
 test.bus.u_write(cntrl, 8'h02);
139
  test.cg.next(5000);
140
 test.bus.u_write(cntrl, 8'h00);
141
 test.cg.next(100);
142
 
143
 
144
 
145
// send f3 to device
146
test.start   = 1'b1;
147
 test.bus.u_read(status, test.reading);
148
 while(test.start )
149
   begin
150
    test.bus.u_read(status, test.reading);
151
    if( test.reading & 8'h80)  test.start = 1;
152
    else                  test.start = 0;
153
    test.cg.next(100);
154
   end
155
 test.bus.u_write(ps2_data, 8'hf3);
156
 test.bus.u_write(cntrl, 8'h02);
157
  test.cg.next(5000);
158
 test.bus.u_write(cntrl, 8'h00);
159
 test.cg.next(100);
160
 
161
 
162
 
163
// send 50 to device
164
test.start   = 1'b1;
165
 test.bus.u_read(status, test.reading);
166
 while(test.start )
167
   begin
168
    test.bus.u_read(status, test.reading);
169
    if( test.reading & 8'h80)  test.start = 1;
170
    else                  test.start = 0;
171
    test.cg.next(100);
172
   end
173
 test.bus.u_write(ps2_data, 8'h50);
174
 test.bus.u_write(cntrl, 8'h02);
175
  test.cg.next(5000);
176
 test.bus.u_write(cntrl, 8'h00);
177
 test.cg.next(100);
178
 
179
 test.cg.next(10000);
180
 
181
 
182
// send f2 to device
183
test.start   = 1'b1;
184
 test.bus.u_read(status, test.reading);
185
 while(test.start )
186
   begin
187
    test.bus.u_read(status, test.reading);
188
    if( test.reading & 8'h80)  test.start = 1;
189
    else                  test.start = 0;
190
    test.cg.next(100);
191
   end
192
 test.bus.u_write(ps2_data, 8'hf2);
193
 test.bus.u_write(cntrl, 8'h02);
194
  test.cg.next(5000);
195
 test.bus.u_write(cntrl, 8'h00);
196
 test.cg.next(100);
197
 
198
 
199
 
200
// receive fa
201
 test.start   = 1'b1;
202
 test.bus.u_read(status, test.reading);
203
 while(test.start )
204
   begin
205
    test.bus.u_read(status, test.reading);
206
    if( test.reading & 8'h40)  test.start = 0;
207
    test.cg.next(100);
208
   end
209
 test.bus.u_cmp(ps2_data, 8'hfa);
210
 test.cg.next(1000);
211
 
212
 
213
 
214
 
215
// send e8 to device
216
test.start   = 1'b1;
217
 test.bus.u_read(status, test.reading);
218
 while(test.start )
219
   begin
220
    test.bus.u_read(status, test.reading);
221
    if( test.reading & 8'h80)  test.start = 1;
222
    else                  test.start = 0;
223
    test.cg.next(100);
224
   end
225
 test.bus.u_write(ps2_data, 8'he8);
226
 test.bus.u_write(cntrl, 8'h02);
227
  test.cg.next(5000);
228
 test.bus.u_write(cntrl, 8'h00);
229
 test.cg.next(100);
230
 
231
 
232
 
233
// send 03 to device
234
test.start   = 1'b1;
235
 test.bus.u_read(status, test.reading);
236
 while(test.start )
237
   begin
238
    test.bus.u_read(status, test.reading);
239
    if( test.reading & 8'h80)  test.start = 1;
240
    else                  test.start = 0;
241
    test.cg.next(100);
242
   end
243
 test.bus.u_write(ps2_data, 8'h03);
244
 test.bus.u_write(cntrl, 8'h02);
245
  test.cg.next(5000);
246
 test.bus.u_write(cntrl, 8'h00);
247
 test.cg.next(100);
248
 
249
 
250
 
251
// send f3 to device
252
test.start   = 1'b1;
253
 test.bus.u_read(status, test.reading);
254
 while(test.start )
255
   begin
256
    test.bus.u_read(status, test.reading);
257
    if( test.reading & 8'h80)  test.start = 1;
258
    else                  test.start = 0;
259
    test.cg.next(100);
260
   end
261
 test.bus.u_write(ps2_data, 8'hf3);
262
 test.bus.u_write(cntrl, 8'h02);
263
  test.cg.next(5000);
264
 test.bus.u_write(cntrl, 8'h00);
265
 test.cg.next(100);
266
 
267
 
268
// send 28 to device
269
test.start   = 1'b1;
270
 test.bus.u_read(status, test.reading);
271
 while(test.start )
272
   begin
273
    test.bus.u_read(status, test.reading);
274
    if( test.reading & 8'h80)  test.start = 1;
275
    else                  test.start = 0;
276
    test.cg.next(100);
277
   end
278
 test.bus.u_write(ps2_data, 8'h28);
279
 test.bus.u_write(cntrl, 8'h02);
280
  test.cg.next(5000);
281
 test.bus.u_write(cntrl, 8'h00);
282
 test.cg.next(100);
283
 
284
// send f4 to device
285
test.start   = 1'b1;
286
 test.bus.u_read(status, test.reading);
287
 while(test.start )
288
   begin
289
    test.bus.u_read(status, test.reading);
290
    if( test.reading & 8'h80)  test.start = 1;
291
    else                  test.start = 0;
292
    test.cg.next(100);
293
   end
294
 test.bus.u_write(ps2_data, 8'hf4);
295
 test.bus.u_write(cntrl, 8'h02);
296
  test.cg.next(5000);
297
 test.bus.u_write(cntrl, 8'h00);
298
 test.cg.next(100);
299
 test.bus.u_write(cntrl, 8'h01);
300
 
301
 
302
 test.cg.next(1000);
303
 
304
 
305
 end
306
 begin
307
 test.ps2_model.rcv_byte(8'hff,1'b1);
308
 test.cg.next(5000);
309
 test.ps2_model.send_byte(8'hfa);
310
 test.cg.next(20000);
311
 test.ps2_model.send_byte(8'haa);
312
 test.cg.next(20000);
313
 test.ps2_model.send_byte(8'h00);
314
 test.cg.next(2000);
315
 test.ps2_model.rcv_byte(8'hf3,1'b1);
316
 test.cg.next(2000);
317
 test.ps2_model.rcv_byte(8'hc8,1'b0);
318
 test.cg.next(2000);
319
 test.ps2_model.rcv_byte(8'hf3,1'b1);
320
 test.cg.next(2000);
321
 test.ps2_model.rcv_byte(8'h64,1'b0);
322
 test.cg.next(2000);
323
 test.ps2_model.rcv_byte(8'hf3,1'b1);
324
 test.cg.next(2000);
325
 test.ps2_model.rcv_byte(8'h50,1'b1);
326
 test.cg.next(2000);
327
 test.ps2_model.rcv_byte(8'hf2,1'b0);
328
 test.cg.next(5000);
329
 test.ps2_model.send_byte(8'hfa);
330
 test.cg.next(2000);
331
 test.ps2_model.rcv_byte(8'he8,1'b1);
332
 test.cg.next(2000);
333
 test.ps2_model.rcv_byte(8'h03,1'b1);
334
 test.cg.next(2000);
335
 test.ps2_model.rcv_byte(8'hf3,1'b1);
336
 test.cg.next(2000);
337
 test.ps2_model.rcv_byte(8'h28,1'b1);
338
 test.cg.next(2000);
339
 test.ps2_model.rcv_byte(8'hf4,1'b0);
340
 
341
// Now send mice packets
342
 test.ps2_model.send_byte(8'h12);
343
 test.cg.next(2000);
344
 test.ps2_model.send_byte(8'h34);
345
 test.cg.next(2000);
346
 test.ps2_model.send_byte(8'h56);
347
 test.cg.next(2000);
348
 
349
 test.ps2_model.send_byte(8'h78);
350
 test.cg.next(2000);
351
 test.ps2_model.send_byte(8'h9a);
352
 test.cg.next(2000);
353
 test.ps2_model.send_byte(8'hbc);
354
 test.cg.next(2000);
355
 
356
 test.ps2_model.send_byte(8'hde);
357
 test.cg.next(2000);
358
 test.ps2_model.send_byte(8'hf0);
359
 test.cg.next(2000);
360
 test.ps2_model.send_byte(8'h01);
361
 test.cg.next(2000);
362
 
363
 test.ps2_model.send_byte(8'h23);
364
 test.cg.next(2000);
365
 test.ps2_model.send_byte(8'h45);
366
 test.cg.next(2000);
367
 test.ps2_model.send_byte(8'h67);
368
 test.cg.next(2000);
369
 
370
 test.ps2_model.send_byte(8'h89);
371
 test.cg.next(2000);
372
 test.ps2_model.send_byte(8'hab);
373
 test.cg.next(2000);
374
 test.ps2_model.send_byte(8'hcd);
375
 test.cg.next(2000);
376
 
377
 
378
 end
379
 join
380
 
381
 
382
 
383
test.cg.exit;
384
end
385
 
386
 
387
 
388
 
389
 
390
 
391
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.