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

Subversion Repositories socgen

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

powered by: WebSVN 2.1.0

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