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 2

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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