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

Subversion Repositories uart2bus_testbench

[/] [uart2bus_testbench/] [trunk/] [tb/] [agent/] [sequence/] [uart_sequence.svh] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 HanySalah
//-------------------------------------------------------------------------------------------------
2 2 HanySalah
//
3
//                             UART2BUS VERIFICATION
4
//
5 3 HanySalah
//-------------------------------------------------------------------------------------------------
6 2 HanySalah
// CREATOR    : HANY SALAH
7
// PROJECT    : UART2BUS UVM TEST BENCH
8
// UNIT       : SEQUENCE
9 3 HanySalah
//-------------------------------------------------------------------------------------------------
10
// TITLE      : UART SEQUENCE
11
// DESCRIPTION: THIS FILE INCLUDES THE ALL SEQUENCES THAT WOULD BE FORCED INTO DUT. THE SEQUENCES
12
//              MENTIONED BELOW IS IDENTIFIED IN THE MANNER RELATED TO THE TEST PLAN SECTION IN
13
//              THE DOCUMENT; IT IS IDENTIFIED USING TWO TERMS; SUBSECTION AND ITEM INSIDE SUB-
14
//              SECTION.
15
//-------------------------------------------------------------------------------------------------
16 2 HanySalah
// LOG DETAILS
17
//-------------
18
// VERSION      NAME        DATE        DESCRIPTION
19
//    1       HANY SALAH    01012016    FILE CREATION
20
//    2       HANY SALAH    02012016    ADD REST OF TESTS
21 3 HanySalah
//    3       HANY SALAH    29012016    INSERT WRONG MODE IN BOTH BINARY AND TEXT COMMUNICATION
22
//                                      MODES
23
//    4       HANY SALAH    09022016    REFINE BLOCK DESCRIPTION
24
//-------------------------------------------------------------------------------------------------
25
// ALL COPYRIGHTS ARE RESERVED FOR THE PRODUCER ONLY .THIS FILE IS PRODUCED FOR OPENCORES MEMBERS
26
// ONLY AND IT IS PROHIBTED TO USE THIS MATERIAL WITHOUT THE CREATOR'S PERMISSION
27
//-------------------------------------------------------------------------------------------------
28 2 HanySalah
 
29
// Base Sequence Class that hold the common attributes to all sequences
30
class uart_base_sequence extends uvm_sequence #(uart_transaction);
31
 
32
  uart_transaction    trans;
33
 
34
  `uvm_object_utils(uart_base_sequence)
35
 
36
  function new (string name = "uart_base_sequence");
37
    super.new(name);
38
    trans = uart_transaction::type_id::create("trans");
39
  endfunction:new
40
endclass:uart_base_sequence
41
 
42 3 HanySalah
//-------------------------------------------------------------------------------------------------
43 2 HanySalah
//
44 3 HanySalah
//                                    WRITE IN TEXT MODE
45 2 HanySalah
//
46 3 HanySalah
//-------------------------------------------------------------------------------------------------
47 2 HanySalah
 
48
  // 1.1 Apply UART write request using capital W
49
  class seq_1p1 extends uart_base_sequence;
50
 
51
    `uvm_object_utils(seq_1p1)
52
 
53
    function new (string name = "seq_1p1");
54
      super.new(name);
55
    endfunction:new
56
 
57
    virtual task body ();
58
      start_item(trans);
59
      trans.randomize() with {
60
        _mode       == text;
61
        _spacetype1 != wrong_space;
62
        _spacetype2 != wrong_space;
63
        length_data == 1;
64
        _eoltype    != wrong_eol;
65
        _command    == write;
66
        _reqinc     == no;
67
        _arbit      == accept;
68
        _chartype   == cap;
69
      };
70
      finish_item(trans);
71
    endtask:body
72
  endclass:seq_1p1
73
 
74
 
75
  // 1.2 Apply UART write request using small w
76
  class seq_1p2 extends uart_base_sequence;
77
 
78
    `uvm_object_utils(seq_1p2)
79
 
80
    function new (string name = "seq_1p2");
81
      super.new(name);
82
    endfunction:new
83
 
84
    virtual task body ();
85
      start_item(trans);
86
      trans.randomize() with {
87
        _mode       == text;
88
        _spacetype1 != wrong_space;
89
        _spacetype2 != wrong_space;
90
        length_data == 1;
91
        _eoltype    != wrong_eol;
92
        _command    == write;
93
        _reqinc     == no;
94
        _arbit      == accept;
95
        _chartype   == smal;
96
      } ;
97
      finish_item(trans);
98
    endtask:body
99
  endclass:seq_1p2
100
 
101
 
102
  // 1.3 Apply UART write request using single space only
103
  class seq_1p3 extends uart_base_sequence;
104
 
105
    `uvm_object_utils(seq_1p3)
106
 
107
    function new (string name = "seq_1p3");
108
      super.new(name);
109
    endfunction:new
110
 
111
    virtual task body ();
112
      start_item(trans);
113
      trans.randomize() with {
114
        _mode       == text;
115
        _spacetype1 == single;
116
        _spacetype2 == single;
117
        length_data == 1;
118
        _eoltype    != wrong_eol;
119
        _command    == write;
120
        _reqinc     == no;
121
        _arbit      == accept;
122
      } ;
123
      finish_item(trans);
124
    endtask:body
125
  endclass:seq_1p3
126
 
127
 
128
  // 1.4 Apply UART write request using tab only.
129
  class seq_1p4 extends uart_base_sequence;
130
 
131
    `uvm_object_utils(seq_1p4)
132
 
133
    function new (string name = "seq_1p4");
134
      super.new(name);
135
    endfunction:new
136
 
137
    virtual task body ();
138
      start_item(trans);
139
      trans.randomize() with {
140
        _mode       == text;
141
        _spacetype1 == tab;
142
        _spacetype2 == tab;
143
        length_data == 1;
144
        _eoltype    != wrong_eol;
145
        _command    == write;
146
        _reqinc     == no;
147
        _arbit      == accept;
148
      } ;
149
      finish_item(trans);
150
    endtask:body
151
  endclass:seq_1p4
152
 
153
 
154
  // 1.5 Apply UART write request using both single space and tab.
155
  class seq_1p5 extends uart_base_sequence;
156
 
157
    `uvm_object_utils(seq_1p5)
158
 
159
    function new (string name = "seq_1p5");
160
      super.new(name);
161
    endfunction:new
162
 
163
    virtual task body ();
164
      start_item(trans);
165
      trans.randomize() with {
166
        _mode       == text;
167
        _spacetype1 != wrong_space;
168
        _spacetype2 != wrong_space;
169
        _spacetype2 != _spacetype1;
170
        length_data == 1;
171
        _eoltype    != wrong_eol;
172
        _command    == write;
173
        _reqinc     == no;
174
        _arbit      == accept;
175
      } ;
176
      finish_item(trans);
177
    endtask:body
178
  endclass:seq_1p5
179
 
180
 
181
  // 1.6 Apply UART write request using one wrong space.
182
  class seq_1p6 extends uart_base_sequence;
183
 
184
    `uvm_object_utils(seq_1p6)
185
 
186
    function new (string name = "seq_1p6");
187
      super.new(name);
188
    endfunction:new
189
 
190
    virtual task body ();
191
      start_item(trans);
192
      trans.randomize() with {
193
        _mode       == text;
194
        (_spacetype1 == wrong_space) -> (_spacetype2 inside {tab, single});
195
        (_spacetype1 != wrong_space) -> (_spacetype2 == wrong_space);
196
        length_data == 1;
197
        _eoltype    != wrong_eol;
198
        _command    == write;
199
        _reqinc     == no;
200
        _arbit      == accept;
201
      };
202
      finish_item(trans);
203
    endtask:body
204
  endclass:seq_1p6
205
 
206
 
207
  // 1.7 Apply UART write request using two wrong spaces
208
  class seq_1p7 extends uart_base_sequence;
209
 
210
    `uvm_object_utils(seq_1p7)
211
 
212
    function new (string name = "seq_1p7");
213
      super.new(name);
214
    endfunction:new
215
 
216
    virtual task body ();
217
      start_item(trans);
218
      trans.randomize() with {
219
        _mode       == text;
220
        _spacetype1 == wrong_space;
221
        _spacetype2 == wrong_space;
222
        length_data == 1;
223
        _eoltype    != wrong_eol;
224
        _command    == write;
225
        _reqinc     == no;
226
        _arbit      == accept;
227
      };
228
      finish_item(trans);
229
    endtask:body
230
  endclass:seq_1p7
231
 
232
 
233
  // 1.8 Apply UART write request to address 0
234
  class seq_1p8 extends uart_base_sequence;
235
 
236
    `uvm_object_utils(seq_1p8)
237
 
238
    function new (string name = "seq_1p8");
239
      super.new(name);
240
    endfunction:new
241
 
242
    virtual task body ();
243
      start_item(trans);
244
      trans.randomize() with {
245
        _mode       == text;
246
        _spacetype1 != wrong_space;
247
        _spacetype2 != wrong_space;
248
        length_data == 1;
249
        _eoltype    != wrong_eol;
250
        _command    == write;
251
        address     == 16'b0;
252
        _reqinc     == no;
253
        _arbit      == accept;
254
      };
255
      finish_item(trans);
256
    endtask:body
257
  endclass:seq_1p8
258
 
259
 
260
  // 1.9 Apply UART write request to full range address
261
  class seq_1p9 extends uart_base_sequence;
262
 
263
    `uvm_object_utils(seq_1p9)
264
 
265
    function new (string name = "seq_1p9");
266
      super.new(name);
267
    endfunction:new
268
 
269
    virtual task body ();
270
      start_item(trans);
271
      trans.randomize() with {
272
        _mode       == text;
273
        _spacetype1 != wrong_space;
274
        _spacetype2 != wrong_space;
275
        length_data == 1;
276
        _eoltype    != wrong_eol;
277
        _command    == write;
278 3 HanySalah
        address     == 16'hFFFF;
279 2 HanySalah
        _reqinc     == no;
280
        _arbit      == accept;
281
      };
282
      finish_item(trans);
283
    endtask:body
284
  endclass:seq_1p9
285
 
286
 
287
  // 1.10 Apply UART write request with data equal 0.
288
  class seq_1p10 extends uart_base_sequence;
289
 
290
    `uvm_object_utils(seq_1p10)
291
 
292
    function new (string name = "seq_1p10");
293
      super.new(name);
294
    endfunction:new
295
 
296
    virtual task body ();
297
      start_item(trans);
298
      trans.randomize() with {
299
        _mode       == text;
300
        _spacetype1 != wrong_space;
301
        _spacetype2 != wrong_space;
302
        length_data == 1;
303
        _eoltype    != wrong_eol;
304
        _command    == write;
305
        _data [0]   == 8'b0;
306
        _reqinc     == no;
307
        _arbit      == accept;
308
      } ;
309
      finish_item(trans);
310
    endtask:body
311
  endclass:seq_1p10
312
 
313
 
314
  // 1.11 Apply UART write request with full range data.
315
  class seq_1p11 extends uart_base_sequence;
316
 
317
    `uvm_object_utils(seq_1p11)
318
 
319
    function new (string name = "seq_1p11");
320
      super.new(name);
321
    endfunction:new
322
 
323
    virtual task body ();
324
      start_item(trans);
325
      trans.randomize() with {
326
        _mode       == text;
327
        _spacetype1 != wrong_space;
328
        _spacetype2 != wrong_space;
329
        length_data == 1;
330
        _eoltype    != wrong_eol;
331
        _command    == write;
332 3 HanySalah
        _data [0]   == 8'hff;
333 2 HanySalah
        _reqinc     == no;
334
        _arbit      == accept;
335
      } ;
336
      finish_item(trans);
337
    endtask:body
338
  endclass:seq_1p11
339
 
340
 
341 3 HanySalah
  // 1.12 Apply UART write request using different EOL character.
342
  class seq_1p12 extends uart_base_sequence;
343
 
344
    `uvm_object_utils(seq_1p12)
345
 
346
    function new (string name = "seq_1p12");
347
      super.new(name);
348
    endfunction:new
349
 
350
    virtual task body ();
351
      start_item(trans);
352
      trans.randomize() with {
353
        _mode       == text;
354
        _spacetype1 != wrong_space;
355
        _spacetype2 != wrong_space;
356
        length_data == 1;
357
        _eoltype    == wrong_eol;
358
        _command    == write;
359
        _reqinc     == no;
360
        _arbit      == accept;
361
      } ;
362
      finish_item(trans);
363
    endtask:body
364
  endclass:seq_1p12
365
 
366
 
367
  // 1.13 Apply UART Write request using wrong prefix
368
  class seq_1p13 extends uart_base_sequence;
369
 
370
    `uvm_object_utils(seq_1p13)
371
 
372
    function new (string name = "seq_1p13");
373
      super.new(name);
374
    endfunction:new
375
 
376
    virtual task body ();
377
      start_item(trans);
378
      trans.randomize() with {
379
        _mode       == wrong_mode_text;
380
        _spacetype1 != wrong_space;
381
        _spacetype2 != wrong_space;
382
        length_data == 1;
383
        _eoltype    != wrong_eol;
384
        _command    == write;
385
        _reqinc     == no;
386
        _arbit      == accept;
387
      } ;
388
      finish_item(trans);
389
    endtask:body
390
  endclass:seq_1p13
391
 
392
//-------------------------------------------------------------------------------------------------
393 2 HanySalah
//
394 3 HanySalah
//                                    READ IN TEXT MODE
395 2 HanySalah
//
396 3 HanySalah
//-------------------------------------------------------------------------------------------------
397 2 HanySalah
 
398
  // 2.1 Apply UART read request using capital R
399
  class seq_2p1 extends uart_base_sequence;
400
 
401
    `uvm_object_utils(seq_2p1)
402
 
403
    function new (string name = "seq_2p1");
404
      super.new(name);
405
    endfunction:new
406
 
407
    virtual task body ();
408
      start_item(trans);
409
      trans.randomize() with {
410
        _mode       == text;
411
        _spacetype1 != wrong_space;
412
        _spacetype2 != wrong_space;
413
        length_data == 1;
414
        _eoltype    != wrong_eol;
415
        _command    == read;
416
        _reqinc     == no;
417
        _arbit      == accept;
418
        _chartype   == cap;
419
      } ;
420
      finish_item(trans);
421
    endtask:body
422
  endclass:seq_2p1
423
 
424
 
425
  // 2.2 Apply UART read request using small r
426
  class seq_2p2 extends uart_base_sequence;
427
 
428
    `uvm_object_utils(seq_2p2)
429
 
430
    function new (string name = "seq_2p2");
431
      super.new(name);
432
    endfunction:new
433
 
434
    virtual task body ();
435
      start_item(trans);
436
      trans.randomize() with {
437
        _mode       == text;
438
        _spacetype1 != wrong_space;
439
        _spacetype2 != wrong_space;
440
        length_data == 1;
441
        _eoltype    != wrong_eol;
442
        _command    == read;
443
        _reqinc     == no;
444
        _arbit      == accept;
445
        _chartype   == smal;
446
      } ;
447
      finish_item(trans);
448
    endtask:body
449
  endclass:seq_2p2
450
 
451
 
452
  // 2.3 Apply UART read request using single space only
453
  class seq_2p3 extends uart_base_sequence;
454
 
455
    `uvm_object_utils(seq_2p3)
456
 
457
    function new (string name = "seq_2p3");
458
      super.new(name);
459
    endfunction:new
460
 
461
    virtual task body ();
462
      start_item(trans);
463
      trans.randomize() with {
464
        _mode       == text;
465
        _spacetype1 == single;
466
        _spacetype2 == single;
467
        length_data == 1;
468
        _eoltype    != wrong_eol;
469
        _command    == read;
470
        _reqinc     == no;
471
        _arbit      == accept;
472
      } ;
473
      finish_item(trans);
474
    endtask:body
475
  endclass:seq_2p3
476
 
477
 
478
  // 2.4 Apply UART read request using tab only.
479
  class seq_2p4 extends uart_base_sequence;
480
 
481
    `uvm_object_utils(seq_2p4)
482
 
483
    function new (string name = "seq_2p4");
484
      super.new(name);
485
    endfunction:new
486
 
487
    virtual task body ();
488
      start_item(trans);
489
      trans.randomize() with {
490
        _mode       == text;
491
        _spacetype1 == tab;
492
        _spacetype2 == tab;
493
        length_data == 1;
494
        _eoltype    != wrong_eol;
495
        _command    == read;
496
        _reqinc     == no;
497
        _arbit      == accept;
498
      } ;
499
      finish_item(trans);
500
    endtask:body
501
  endclass:seq_2p4
502
 
503
 
504
  // 2.5 Apply UART read request using both single space and tab.
505
  class seq_2p5 extends uart_base_sequence;
506
 
507
    `uvm_object_utils(seq_2p5)
508
 
509
    function new (string name = "seq_2p5");
510
      super.new(name);
511
    endfunction:new
512
 
513
    virtual task body ();
514
      start_item(trans);
515
      trans.randomize() with {
516
        _mode       == text;
517
        _spacetype1 != wrong_space;
518
        _spacetype2 != wrong_space;
519
        _spacetype2 != _spacetype1;
520
        length_data == 1;
521
        _eoltype    != wrong_eol;
522
        _command    == read;
523
        _reqinc     == no;
524
        _arbit      == accept;
525
      } ;
526
      finish_item(trans);
527
    endtask:body
528
  endclass:seq_2p5
529
 
530
 
531
  // 2.6 Apply UART read request using one wrong space.
532
  class seq_2p6 extends uart_base_sequence;
533
 
534
    `uvm_object_utils(seq_2p6)
535
 
536
    function new (string name = "seq_2p6");
537
      super.new(name);
538
    endfunction:new
539
 
540
    virtual task body ();
541
      start_item(trans);
542
      trans.randomize() with {
543
        _mode       == text;
544
        (_spacetype1 == wrong_space) -> (_spacetype2 inside {tab, single});
545
        (_spacetype1 != wrong_space) -> (_spacetype2 == wrong_space);
546
        length_data == 1;
547
        _eoltype    != wrong_eol;
548
        _command    == read;
549
        _reqinc     == no;
550
        _arbit      == accept;
551
      } ;
552
      finish_item(trans);
553
    endtask:body
554
  endclass:seq_2p6
555
 
556
 
557
  // 2.7 Apply UART read request using two wrong spaces
558
  class seq_2p7 extends uart_base_sequence;
559
 
560
    `uvm_object_utils(seq_2p7)
561
 
562
    function new (string name = "seq_2p7");
563
      super.new(name);
564
    endfunction:new
565
 
566
    virtual task body ();
567
      start_item(trans);
568
      trans.randomize() with {
569
        _mode       == text;
570
        _spacetype1 == wrong_space;
571
        _spacetype2 == wrong_space;
572
        length_data == 1;
573
        _eoltype    != wrong_eol;
574
        _command    == read;
575
        _reqinc     == no;
576
        _arbit      == accept;
577
      } ;
578
      finish_item(trans);
579
    endtask:body
580
  endclass:seq_2p7
581
 
582
 
583
  // 2.8 Apply UART read request to address 0
584
  class seq_2p8 extends uart_base_sequence;
585
 
586
    `uvm_object_utils(seq_2p8)
587
 
588
    function new (string name = "seq_2p8");
589
      super.new(name);
590
    endfunction:new
591
 
592
    virtual task body ();
593
      start_item(trans);
594
      trans.randomize() with {
595
        _mode       == text;
596
        _spacetype1 != wrong_space;
597
        _spacetype2 != wrong_space;
598
        length_data == 1;
599
        _eoltype    != wrong_eol;
600
        _command    == read;
601
        address     == 16'b0;
602
        _reqinc     == no;
603
        _arbit      == accept;
604
      } ;
605
      finish_item(trans);
606
    endtask:body
607
  endclass:seq_2p8
608
 
609
 
610
  // 2.9 Apply UART read request to full range address
611
  class seq_2p9 extends uart_base_sequence;
612
 
613
    `uvm_object_utils(seq_2p9)
614
 
615
    function new (string name = "seq_2p9");
616
      super.new(name);
617
    endfunction:new
618
 
619
    virtual task body ();
620
      start_item(trans);
621
      trans.randomize() with {
622
        _mode       == text;
623
        _spacetype1 != wrong_space;
624
        _spacetype2 != wrong_space;
625
        length_data == 1;
626
        _eoltype    != wrong_eol;
627
        _command    == read;
628 3 HanySalah
        address     == 16'hFFFF;
629 2 HanySalah
        _reqinc     == no;
630
        _arbit      == accept;
631
      } ;
632
      finish_item(trans);
633
    endtask:body
634
  endclass:seq_2p9
635
 
636
 
637
  // 2.10 Apply UART read request with data equal 0.
638
  class seq_2p10 extends uart_base_sequence;
639
 
640
    `uvm_object_utils(seq_2p10)
641
 
642
    function new (string name = "seq_2p10");
643
      super.new(name);
644
    endfunction:new
645
 
646
    virtual task body ();
647
      start_item(trans);
648
      trans.randomize() with {
649
        _mode       == text;
650
        _spacetype1 != wrong_space;
651
        _spacetype2 != wrong_space;
652
        length_data == 1;
653
        _eoltype    != wrong_eol;
654
        _command    == read;
655
        _data [0]   == 8'b0;
656
        _reqinc     == no;
657
        _arbit      == accept;
658
      } ;
659
      finish_item(trans);
660
    endtask:body
661
  endclass:seq_2p10
662
 
663
 
664
  // 2.11 Apply UART read request with full range data.
665
  class seq_2p11 extends uart_base_sequence;
666
 
667
    `uvm_object_utils(seq_2p11)
668
 
669
    function new (string name = "seq_2p11");
670
      super.new(name);
671
    endfunction:new
672
 
673
    virtual task body ();
674
      start_item(trans);
675
      trans.randomize() with {
676
        _mode       == text;
677
        _spacetype1 != wrong_space;
678
        _spacetype2 != wrong_space;
679
        length_data == 1;
680
        _eoltype    != wrong_eol;
681
        _command    == read;
682 3 HanySalah
        _data [0]   == 8'hff;
683 2 HanySalah
        _reqinc     == no;
684
        _arbit      == accept;
685
      } ;
686
      finish_item(trans);
687
    endtask:body
688
  endclass:seq_2p11
689
 
690 3 HanySalah
 
691
  // 2.12 Apply UART read request using different EOL character.
692
  class seq_2p12 extends uart_base_sequence;
693
 
694
    `uvm_object_utils(seq_2p12)
695
 
696
    function new (string name = "seq_2p12");
697
      super.new(name);
698
    endfunction:new
699
 
700
    virtual task body ();
701
      start_item(trans);
702
      trans.randomize() with {
703
        _mode       == text;
704
        _spacetype1 != wrong_space;
705
        _spacetype2 != wrong_space;
706
        length_data == 1;
707
        _eoltype    == wrong_eol;
708
        _command    == read;
709
        _reqinc     == no;
710
        _arbit      == accept;
711
      } ;
712
      finish_item(trans);
713
    endtask:body
714
  endclass:seq_2p12
715
 
716
 
717
  // 2.13 Apply UART Read request using wrong prefix
718
  class seq_2p13 extends uart_base_sequence;
719
 
720
    `uvm_object_utils(seq_2p13)
721
 
722
    function new (string name = "seq_2p13");
723
      super.new(name);
724
    endfunction:new
725
 
726
    virtual task body ();
727
      start_item(trans);
728
      trans.randomize() with {
729
        _mode       == wrong_mode_text;
730
        _spacetype1 != wrong_space;
731
        _spacetype2 != wrong_space;
732
        length_data == 1;
733
        _eoltype    != wrong_eol;
734
        _command    == read;
735
        _reqinc     == no;
736
        _arbit      == accept;
737
      } ;
738
      finish_item(trans);
739
    endtask:body
740
  endclass:seq_2p13
741
 
742
//-------------------------------------------------------------------------------------------------
743 2 HanySalah
//
744 3 HanySalah
//                                    NOP IN COMMAND MODE
745 2 HanySalah
//
746 3 HanySalah
//-------------------------------------------------------------------------------------------------
747 2 HanySalah
 
748
  // 3.1 Apply UART NOP command with acknowledge request and right command
749
  //     mode prefix
750
  class seq_3p1 extends uart_base_sequence;
751
 
752
    `uvm_object_utils(seq_3p1)
753
 
754
    function new (string name = "seq_3p1");
755
      super.new(name);
756
    endfunction:new
757
 
758
    virtual task body ();
759
      start_item(trans);
760
      trans.randomize() with {
761
        _mode       == binary;
762
        _command    == nop;
763
        (length_data > 1) -> (_reqinc == yes);
764
        _arbit      == accept;
765
        _reqack     == yes;
766
      } ;
767
      finish_item(trans);
768
    endtask:body
769
  endclass:seq_3p1
770
 
771
  // 3.2 Apply UART NOP command with acknowledge request and wrong command
772
  //     mode prefix
773
  class seq_3p2 extends uart_base_sequence;
774
 
775
    `uvm_object_utils(seq_3p2)
776
 
777
    function new (string name = "seq_3p2");
778
      super.new(name);
779
    endfunction:new
780
 
781
    virtual task body ();
782
      start_item(trans);
783
      trans.randomize() with {
784 3 HanySalah
        _mode       == wrong_mode_bin;
785 2 HanySalah
        _command    == nop;
786 3 HanySalah
        address     != 16'h0;
787 2 HanySalah
        (length_data > 1) -> (_reqinc == yes);
788
        _arbit      == accept;
789
        _reqack     == yes;
790
      } ;
791
      finish_item(trans);
792
    endtask:body
793
  endclass:seq_3p2
794
 
795
  // 3.3 Apply several UART NOP command to different locations with different
796
  //     data lengths
797
  class seq_3p3 extends uart_base_sequence;
798
 
799
    rand int unsigned num_of_comands;
800
 
801
    `uvm_object_utils(seq_3p3)
802
 
803
    function new (string name = "seq_3p3");
804
      super.new(name);
805
    endfunction:new
806
 
807
    constraint num_iter {
808
      num_of_comands inside {[1:5]};
809
    }
810
 
811
    virtual task body ();
812
      randomize();
813
      start_item(trans);
814
      repeat (num_of_comands)
815
        begin
816
        trans.randomize() with {
817
          _mode       == binary;
818
          _command    == nop;
819
          (length_data > 1) -> (_reqinc == yes);
820
          _arbit      == accept;
821
          _reqack     == yes;
822
        } ;
823
        end
824
      finish_item(trans);
825
    endtask:body
826
  endclass:seq_3p3
827
 
828
  // 4.1 Apply UART NOP command with non-acknowledge request and right command
829
  //     mode prefix
830
  class seq_4p1 extends uart_base_sequence;
831
 
832
    `uvm_object_utils(seq_4p1)
833
 
834
    function new (string name = "seq_4p1");
835
      super.new(name);
836
    endfunction:new
837
 
838
    virtual task body ();
839
      start_item(trans);
840
      trans.randomize() with {
841
        _mode       == binary;
842
        _command    == nop;
843
        (length_data > 1) -> (_reqinc == yes);
844
        _arbit      == accept;
845
        _reqack     == no;
846
      } ;
847
      finish_item(trans);
848
    endtask:body
849
  endclass:seq_4p1
850
 
851
  // 4.2 Apply UART NOP command with non-acknowledge request and wrong command
852
  //     mode prefix
853
  class seq_4p2 extends uart_base_sequence;
854
 
855
    `uvm_object_utils(seq_4p2)
856
 
857
    function new (string name = "seq_4p2");
858
      super.new(name);
859
    endfunction:new
860
 
861
    virtual task body ();
862
      start_item(trans);
863
      trans.randomize() with {
864 3 HanySalah
        _mode       == wrong_mode_bin;
865 2 HanySalah
        _command    == nop;
866 3 HanySalah
        address[15:7] != 8'h00;
867 2 HanySalah
        (length_data > 1) -> (_reqinc == yes);
868
        _arbit      == accept;
869
        _reqack     == no;
870
      } ;
871
      finish_item(trans);
872
    endtask:body
873
  endclass:seq_4p2
874
 
875
  // 4.3 Apply several UART NOP command to different locations with different
876
  //     data lengths and non-acknowledge request
877
  class seq_4p3 extends uart_base_sequence;
878
 
879
    rand int unsigned num_of_comands;
880
 
881
    `uvm_object_utils(seq_4p3)
882
 
883
    function new (string name = "seq_4p3");
884
      super.new(name);
885
    endfunction:new
886
 
887
    constraint num_iter {
888
      num_of_comands inside {[1:5]};
889
    }
890
 
891
    virtual task body ();
892
      randomize();
893
      start_item(trans);
894
      repeat (num_of_comands)
895
        begin
896
        trans.randomize() with {
897
          _mode       == binary;
898
          _command    == nop;
899
          (length_data > 1) -> (_reqinc == yes);
900
          _arbit      == accept;
901
          _reqack     == no;
902
        } ;
903
        end
904
      finish_item(trans);
905
    endtask:body
906
  endclass:seq_4p3
907
 
908 3 HanySalah
//-------------------------------------------------------------------------------------------------
909 2 HanySalah
//
910 3 HanySalah
//                                    WRITE IN COMMAND MODE
911 2 HanySalah
//
912 3 HanySalah
//-------------------------------------------------------------------------------------------------
913 2 HanySalah
 
914
  // 5.1 Apply UART write command with wrong prefix.
915
  class seq_5p1 extends uart_base_sequence;
916
 
917
    `uvm_object_utils(seq_5p1)
918
 
919
    function new (string name="seq_5p1");
920
      super.new(name);
921
    endfunction:new
922
 
923
    virtual task body ();
924
      start_item(trans);
925
      trans.randomize() with {
926 3 HanySalah
        _mode       == wrong_mode_bin;
927 2 HanySalah
        _command    == write;
928 3 HanySalah
        address[15:7] != 8'h00;
929 2 HanySalah
        (length_data > 1) -> (_reqinc == yes);
930
        _arbit      == accept;
931
      } ;
932
      finish_item(trans);
933
    endtask:body
934
  endclass:seq_5p1
935
 
936
  // 5.2 Apply UART write commands to different addresses.
937
  class seq_5p2 extends uart_base_sequence;
938
 
939
    rand int unsigned num_of_comands;
940
 
941
    `uvm_object_utils(seq_5p2)
942
 
943
    function new (string name="seq_5p2");
944
      super.new(name);
945
    endfunction:new
946
 
947
    constraint num_iter {
948
      num_of_comands inside {[1:5]};
949
    }
950
 
951
    virtual task body ();
952
      randomize();
953
      start_item(trans);
954
      repeat (num_of_comands)
955
        begin
956
        trans.randomize() with {
957
                _mode       == binary;
958
                _command    == write;
959
                (length_data > 1) -> (_reqinc == yes);
960
                _arbit      == accept;
961
              };
962
        end
963
      finish_item(trans);
964
    endtask:body
965
  endclass:seq_5p2
966
 
967
  // 5.3 Apply UART write commands with several data lengths
968
  class seq_5p3 extends uart_base_sequence;
969
 
970
    rand int unsigned num_of_comands;
971
 
972
    `uvm_object_utils(seq_5p3)
973
 
974
    function new (string name="seq_5p3");
975
      super.new(name);
976
    endfunction:new
977
 
978
    constraint num_iter {
979
      num_of_comands inside {[1:5]};
980
    }
981
 
982
    virtual task body ();
983
      randomize();
984
      start_item(trans);
985
      repeat (num_of_comands)
986
        begin
987
        trans.randomize() with {
988
                _mode       == binary;
989
                _command    == write;
990
                (length_data > 1) -> (_reqinc == yes);
991
                _arbit      == accept;
992
              } ;
993
        end
994
      finish_item(trans);
995
    endtask:body
996
  endclass:seq_5p3
997
 
998
  // 5.4 Apply UART write command to address 0 with random data.
999
  class seq_5p4 extends uart_base_sequence;
1000
 
1001
    `uvm_object_utils(seq_5p4)
1002
 
1003
    function new (string name="seq_5p4");
1004
      super.new(name);
1005
    endfunction:new
1006
 
1007
    virtual task body ();
1008
      start_item(trans);
1009
      trans.randomize() with {
1010
              _mode       == binary;
1011
              _command    == write;
1012
              address     == 16'b0;
1013
              (length_data > 1) -> (_reqinc == yes);
1014
              _arbit      == accept;
1015
            } ;
1016
      finish_item(trans);
1017
    endtask:body
1018
  endclass:seq_5p4
1019
 
1020
  // 5.5 Apply UART write command to address 0xFFFF with random data.
1021
  class seq_5p5 extends uart_base_sequence;
1022
 
1023
    `uvm_object_utils(seq_5p5)
1024
 
1025
    function new (string name="seq_5p5");
1026
      super.new(name);
1027
    endfunction:new
1028
 
1029
    virtual task body ();
1030
      start_item(trans);
1031
      trans.randomize() with {
1032
              _mode       == binary;
1033
              _command    == write;
1034 3 HanySalah
              address     == 16'hFFFF;
1035 2 HanySalah
              (length_data > 1) -> (_reqinc == yes);
1036
              _arbit      == accept;
1037
            } ;
1038
      finish_item(trans);
1039
    endtask:body
1040
  endclass:seq_5p5
1041
 
1042
  // 5.6 Apply UART write command with acknowledge request.
1043
  class seq_5p6 extends uart_base_sequence;
1044
 
1045
    `uvm_object_utils(seq_5p6)
1046
 
1047
    function new (string name="seq_5p6");
1048
      super.new(name);
1049
    endfunction:new
1050
 
1051
    virtual task body ();
1052
      start_item(trans);
1053
      trans.randomize() with {
1054
              _mode       == binary;
1055
              _command    == write;
1056
              (length_data > 1) -> (_reqinc == yes);
1057
              _arbit      == accept;
1058
              _reqack     == yes;
1059
            } ;
1060
      finish_item(trans);
1061
    endtask:body
1062
  endclass:seq_5p6
1063
 
1064
  // 5.7 Apply UART write command with non-acknowledge request.
1065
  class seq_5p7 extends uart_base_sequence;
1066
 
1067
    `uvm_object_utils(seq_5p7)
1068
 
1069
    function new (string name="seq_5p7");
1070
      super.new(name);
1071
    endfunction:new
1072
 
1073
    virtual task body ();
1074
      start_item(trans);
1075
      trans.randomize() with {
1076
              _mode       == binary;
1077
              _command    == write;
1078
              (length_data > 1) -> (_reqinc == yes);
1079
              _arbit      == accept;
1080
              _reqack     == no;
1081
            } ;
1082
      finish_item(trans);
1083
    endtask:body
1084
  endclass:seq_5p7
1085
 
1086
  // 5.8 Apply UART write command including single byte.
1087
  class seq_5p8 extends uart_base_sequence;
1088
 
1089
    `uvm_object_utils(seq_5p8)
1090
 
1091
    function new (string name="seq_5p8");
1092
      super.new(name);
1093
    endfunction:new
1094
 
1095
    virtual task body ();
1096
      start_item(trans);
1097
      trans.randomize() with {
1098
              _mode       == binary;
1099
              _command    == write;
1100
              length_data == 1;
1101
              (length_data > 1) -> (_reqinc == yes);
1102
              _arbit      == accept;
1103
            } ;
1104
      finish_item(trans);
1105
    endtask:body
1106
  endclass:seq_5p8
1107
 
1108
  // 5.9 Apply UART write command including non-incremental address bit.
1109
  class seq_5p9 extends uart_base_sequence;
1110
 
1111
    `uvm_object_utils(seq_5p9)
1112
 
1113
    function new (string name="seq_5p9");
1114
      super.new(name);
1115
    endfunction:new
1116
 
1117
    virtual task body ();
1118
      start_item(trans);
1119
      trans.randomize() with {
1120
              _mode       == binary;
1121
              _command    == write;
1122
              (length_data > 1) -> (_reqinc == yes);
1123
              _arbit      == accept;
1124
              _reqinc     == no;
1125
            } ;
1126
      finish_item(trans);
1127
    endtask:body
1128
  endclass:seq_5p9
1129
 
1130
  // 5.10 Apply UART write command including incremental address bit.
1131
  class seq_5p10 extends uart_base_sequence;
1132
 
1133
    `uvm_object_utils(seq_5p10)
1134
 
1135
    function new (string name="seq_5p10");
1136
      super.new(name);
1137
    endfunction:new
1138
 
1139
    virtual task body ();
1140
      start_item(trans);
1141
      trans.randomize() with {
1142
              _mode       == binary;
1143
              _command    == write;
1144
              (length_data > 1) -> (_reqinc == yes);
1145
              _arbit      == accept;
1146
              _reqinc     == yes;
1147
            } ;
1148
      finish_item(trans);
1149
    endtask:body
1150
  endclass:seq_5p10
1151
 
1152 3 HanySalah
//-------------------------------------------------------------------------------------------------
1153 2 HanySalah
//
1154 3 HanySalah
//                                    READ IN COMMAND MODE
1155 2 HanySalah
//
1156 3 HanySalah
//-------------------------------------------------------------------------------------------------
1157 2 HanySalah
 
1158
  // 6.1 Apply UART read command with wrong prefix.
1159
  class seq_6p1 extends uart_base_sequence;
1160
 
1161
    `uvm_object_utils(seq_6p1)
1162
 
1163
    function new (string name="seq_6p1");
1164
      super.new(name);
1165
    endfunction:new
1166
 
1167
    virtual task body ();
1168
      start_item(trans);
1169
      trans.randomize() with {
1170 3 HanySalah
        _mode       == wrong_mode_bin;
1171 2 HanySalah
        _command    == read;
1172 3 HanySalah
        address[15:7] != 8'h00;
1173 2 HanySalah
        (length_data > 1) -> (_reqinc == yes);
1174
        _arbit      == accept;
1175
      } ;
1176
      finish_item(trans);
1177
    endtask:body
1178
  endclass:seq_6p1
1179
 
1180
  // 6.2 Apply UART read commands to different addresses.
1181
  class seq_6p2 extends uart_base_sequence;
1182
 
1183
    rand int unsigned num_of_comands;
1184
 
1185
    `uvm_object_utils(seq_6p2)
1186
 
1187
    function new (string name="seq_6p2");
1188
      super.new(name);
1189
    endfunction:new
1190
 
1191
    constraint num_iter {
1192
      num_of_comands inside {[1:5]};
1193
    }
1194
 
1195
    virtual task body ();
1196
      randomize();
1197
      start_item(trans);
1198
      repeat (num_of_comands)
1199
        begin
1200
        trans.randomize() with {
1201
                _mode       == binary;
1202
                _command    == read;
1203
                (length_data > 1) -> (_reqinc == yes);
1204
                _arbit      == accept;
1205
              } ;
1206
        end
1207
      finish_item(trans);
1208
    endtask:body
1209
  endclass:seq_6p2
1210
 
1211
  // 6.3 Apply UART read commands with several data lengths
1212
  class seq_6p3 extends uart_base_sequence;
1213
 
1214
    rand int unsigned num_of_comands;
1215
 
1216
    `uvm_object_utils(seq_6p3)
1217
 
1218
    function new (string name="seq_6p3");
1219
      super.new(name);
1220
    endfunction:new
1221
 
1222
    constraint num_iter {
1223
      num_of_comands inside {[1:5]};
1224
    }
1225
 
1226
    virtual task body ();
1227
      randomize();
1228
      start_item(trans);
1229
      repeat (num_of_comands)
1230
        begin
1231
        trans.randomize() with {
1232
                _mode       == binary;
1233
                _command    == read;
1234
                (length_data > 1) -> (_reqinc == yes);
1235
                _arbit      == accept;
1236
              } ;
1237
        end
1238
      finish_item(trans);
1239
    endtask:body
1240
  endclass:seq_6p3
1241
 
1242
  // 6.4 Apply UART read command to address 0 with random data.
1243
  class seq_6p4 extends uart_base_sequence;
1244
 
1245
    `uvm_object_utils(seq_6p4)
1246
 
1247
    function new (string name="seq_6p4");
1248
      super.new(name);
1249
    endfunction:new
1250
 
1251
    virtual task body ();
1252
      start_item(trans);
1253
      trans.randomize() with {
1254
              _mode       == binary;
1255
              _command    == read;
1256
              address     == 16'b0;
1257
              (length_data > 1) -> (_reqinc == yes);
1258
              _arbit      == accept;
1259
            } ;
1260
      finish_item(trans);
1261
    endtask:body
1262
  endclass:seq_6p4
1263
 
1264
  // 6.5 Apply UART read command to address 0xFFFF with random data.
1265
  class seq_6p5 extends uart_base_sequence;
1266
 
1267
    `uvm_object_utils(seq_6p5)
1268
 
1269
    function new (string name="seq_6p5");
1270
      super.new(name);
1271
    endfunction:new
1272
 
1273
    virtual task body ();
1274
      start_item(trans);
1275
      trans.randomize() with {
1276
              _mode       == binary;
1277
              _command    == read;
1278 3 HanySalah
              address     == 16'hFFFF;
1279 2 HanySalah
              (length_data > 1) -> (_reqinc == yes);
1280
              _arbit      == accept;
1281
            } ;
1282
      finish_item(trans);
1283
    endtask:body
1284
  endclass:seq_6p5
1285
 
1286
  // 6.6 Apply UART read command with acknowledge request.
1287
  class seq_6p6 extends uart_base_sequence;
1288
 
1289
    `uvm_object_utils(seq_6p6)
1290
 
1291
    function new (string name="seq_6p6");
1292
      super.new(name);
1293
    endfunction:new
1294
 
1295
    virtual task body ();
1296
      start_item(trans);
1297
      trans.randomize() with {
1298
              _mode       == binary;
1299
              _command    == read;
1300
              (length_data > 1) -> (_reqinc == yes);
1301
              _arbit      == accept;
1302
              _reqack     == yes;
1303
            } ;
1304
      finish_item(trans);
1305
    endtask:body
1306
  endclass:seq_6p6
1307
 
1308
  // 6.7 Apply UART read command with non-acknowledge request.
1309
  class seq_6p7 extends uart_base_sequence;
1310
 
1311
    `uvm_object_utils(seq_6p7)
1312
 
1313
    function new (string name="seq_6p7");
1314
      super.new(name);
1315
    endfunction:new
1316
 
1317
    virtual task body ();
1318
      start_item(trans);
1319
      trans.randomize() with {
1320
              _mode       == binary;
1321
              _command    == read;
1322
              (length_data > 1) -> (_reqinc == yes);
1323
              _arbit      == accept;
1324
              _reqack     == no;
1325
            } ;
1326
      finish_item(trans);
1327
    endtask:body
1328
  endclass:seq_6p7
1329
 
1330
  // 6.8 Apply UART read command including single byte.
1331
  class seq_6p8 extends uart_base_sequence;
1332
 
1333
    `uvm_object_utils(seq_6p8)
1334
 
1335
    function new (string name="seq_6p8");
1336
      super.new(name);
1337
    endfunction:new
1338
 
1339
    virtual task body ();
1340
      start_item(trans);
1341
      trans.randomize() with {
1342
              _mode       == binary;
1343
              _command    == read;
1344
              length_data == 1;
1345
              (length_data > 1) -> (_reqinc == yes);
1346
              _arbit      == accept;
1347
            } ;
1348
      finish_item(trans);
1349
    endtask:body
1350
  endclass:seq_6p8
1351
 
1352
  // 6.9 Apply UART read command including non-incremental address bit.
1353
  class seq_6p9 extends uart_base_sequence;
1354
 
1355
    `uvm_object_utils(seq_6p9)
1356
 
1357
    function new (string name="seq_6p9");
1358
      super.new(name);
1359
    endfunction:new
1360
 
1361
    virtual task body ();
1362
      start_item(trans);
1363
      trans.randomize() with {
1364
              _mode       == binary;
1365
              _command    == read;
1366
              (length_data > 1) -> (_reqinc == yes);
1367
              _arbit      == accept;
1368
              _reqinc     == no;
1369
            } ;
1370
      finish_item(trans);
1371
    endtask:body
1372
  endclass:seq_6p9
1373
 
1374
  // 6.10 Apply UART read command including incremental address bit.
1375
  class seq_6p10 extends uart_base_sequence;
1376
 
1377
    `uvm_object_utils(seq_6p10)
1378
 
1379
    function new (string name="seq_6p10");
1380
      super.new(name);
1381
    endfunction:new
1382
 
1383
    virtual task body ();
1384
      start_item(trans);
1385
      trans.randomize() with {
1386
              _mode       == binary;
1387
              _command    == read;
1388
              (length_data > 1) -> (_reqinc == yes);
1389
              _arbit      == accept;
1390
              _reqinc     == yes;
1391
            } ;
1392
      finish_item(trans);
1393
    endtask:body
1394
  endclass:seq_6p10
1395
 
1396 3 HanySalah
//-------------------------------------------------------------------------------------------------
1397 2 HanySalah
//
1398 3 HanySalah
//                                     INTERNAL BUS
1399 2 HanySalah
//
1400 3 HanySalah
//-------------------------------------------------------------------------------------------------
1401 2 HanySalah
 
1402
  // 7.1 Apply UART read or write commands and give the UART the bus grant.
1403
  class seq_7p1 extends uart_base_sequence;
1404
 
1405
    `uvm_object_utils(seq_7p1)
1406
 
1407
    function new (string name="seq_7p1");
1408
      super.new(name);
1409
    endfunction:new
1410
 
1411
    virtual task body ();
1412
      start_item(trans);
1413
      trans.randomize() with {
1414
              _mode       == binary;
1415
              _command    inside {write,read};
1416
              (length_data > 1) -> (_reqinc == yes);
1417
              _arbit      == accept;
1418
              _reqinc     == yes;
1419
            } ;
1420
      finish_item(trans);
1421
    endtask:body
1422
  endclass:seq_7p1
1423
 
1424
  // 7.2 Apply UART read or write commands and give no agreement to access internal bus
1425
  class seq_7p2 extends uart_base_sequence;
1426
 
1427
    `uvm_object_utils(seq_7p2)
1428
 
1429
    function new (string name="seq_7p2");
1430
      super.new(name);
1431
    endfunction:new
1432
 
1433
    virtual task body ();
1434
      start_item(trans);
1435
      trans.randomize() with {
1436
              _mode       == binary;
1437
              _command    inside {write,read};
1438
              (length_data > 1) -> (_reqinc == yes);
1439
              _arbit      == declain;
1440
              _reqinc     == yes;
1441
            } ;
1442
      finish_item(trans);
1443
    endtask:body
1444 3 HanySalah
  endclass:seq_7p2
1445
 
1446
//-------------------------------------------------------------------------------------------------
1447
//
1448
//                                      INVALID COMMANDS
1449
//
1450
//-------------------------------------------------------------------------------------------------
1451
 
1452
  // 8.1 Apply Invalid UART command in form of write binary command.
1453
  class seq_8p1 extends uart_base_sequence;
1454
 
1455
    `uvm_object_utils(seq_8p1)
1456
 
1457
    function new (string name="seq_8p1");
1458
      super.new(name);
1459
    endfunction:new
1460
 
1461
    virtual task body ();
1462
      start_item(trans);
1463
      trans.randomize() with {
1464
              _mode       == binary;
1465
              _command    == invalid_write;
1466
              (length_data > 1) -> (_reqinc == yes);
1467
              _arbit      == accept;
1468
              _reqinc     == yes;
1469
            } ;
1470
      finish_item(trans);
1471
    endtask:body
1472
  endclass:seq_8p1
1473
 
1474
  // 8.2 Apply Invalid UART command in form of read binary command.
1475
  class seq_8p2 extends uart_base_sequence;
1476
 
1477
    `uvm_object_utils(seq_8p2)
1478
 
1479
    function new (string name="seq_8p2");
1480
      super.new(name);
1481
    endfunction:new
1482
 
1483
    virtual task body ();
1484
      start_item(trans);
1485
      trans.randomize() with {
1486
              _mode       == binary;
1487
              _command    == invalid_read;
1488
              (length_data > 1) -> (_reqinc == yes);
1489
              _arbit      == declain;
1490
              _reqinc     == yes;
1491
            } ;
1492
      finish_item(trans);
1493
    endtask:body
1494 14 HanySalah
  endclass:seq_8p2

powered by: WebSVN 2.1.0

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