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 5

Go to most recent revision | 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 3 HanySalah
      $display("reached here sequence @time=%0t ,, _mode = %p",$time,trans._mode);
768 2 HanySalah
      finish_item(trans);
769
    endtask:body
770
  endclass:seq_3p1
771
 
772
  // 3.2 Apply UART NOP command with acknowledge request and wrong command
773
  //     mode prefix
774
  class seq_3p2 extends uart_base_sequence;
775
 
776
    `uvm_object_utils(seq_3p2)
777
 
778
    function new (string name = "seq_3p2");
779
      super.new(name);
780
    endfunction:new
781
 
782
    virtual task body ();
783
      start_item(trans);
784
      trans.randomize() with {
785 3 HanySalah
        _mode       == wrong_mode_bin;
786 2 HanySalah
        _command    == nop;
787 3 HanySalah
        address     != 16'h0;
788 2 HanySalah
        (length_data > 1) -> (_reqinc == yes);
789
        _arbit      == accept;
790
        _reqack     == yes;
791
      } ;
792
      finish_item(trans);
793
    endtask:body
794
  endclass:seq_3p2
795
 
796
  // 3.3 Apply several UART NOP command to different locations with different
797
  //     data lengths
798
  class seq_3p3 extends uart_base_sequence;
799
 
800
    rand int unsigned num_of_comands;
801
 
802
    `uvm_object_utils(seq_3p3)
803
 
804
    function new (string name = "seq_3p3");
805
      super.new(name);
806
    endfunction:new
807
 
808
    constraint num_iter {
809
      num_of_comands inside {[1:5]};
810
    }
811
 
812
    virtual task body ();
813
      randomize();
814
      start_item(trans);
815
      repeat (num_of_comands)
816
        begin
817
        trans.randomize() with {
818
          _mode       == binary;
819
          _command    == nop;
820
          (length_data > 1) -> (_reqinc == yes);
821
          _arbit      == accept;
822
          _reqack     == yes;
823
        } ;
824
        end
825
      finish_item(trans);
826
    endtask:body
827
  endclass:seq_3p3
828
 
829
  // 4.1 Apply UART NOP command with non-acknowledge request and right command
830
  //     mode prefix
831
  class seq_4p1 extends uart_base_sequence;
832
 
833
    `uvm_object_utils(seq_4p1)
834
 
835
    function new (string name = "seq_4p1");
836
      super.new(name);
837
    endfunction:new
838
 
839
    virtual task body ();
840
      start_item(trans);
841
      trans.randomize() with {
842
        _mode       == binary;
843
        _command    == nop;
844
        (length_data > 1) -> (_reqinc == yes);
845
        _arbit      == accept;
846
        _reqack     == no;
847
      } ;
848
      finish_item(trans);
849
    endtask:body
850
  endclass:seq_4p1
851
 
852
  // 4.2 Apply UART NOP command with non-acknowledge request and wrong command
853
  //     mode prefix
854
  class seq_4p2 extends uart_base_sequence;
855
 
856
    `uvm_object_utils(seq_4p2)
857
 
858
    function new (string name = "seq_4p2");
859
      super.new(name);
860
    endfunction:new
861
 
862
    virtual task body ();
863
      start_item(trans);
864
      trans.randomize() with {
865 3 HanySalah
        _mode       == wrong_mode_bin;
866 2 HanySalah
        _command    == nop;
867 3 HanySalah
        address[15:7] != 8'h00;
868 2 HanySalah
        (length_data > 1) -> (_reqinc == yes);
869
        _arbit      == accept;
870
        _reqack     == no;
871
      } ;
872
      finish_item(trans);
873
    endtask:body
874
  endclass:seq_4p2
875
 
876
  // 4.3 Apply several UART NOP command to different locations with different
877
  //     data lengths and non-acknowledge request
878
  class seq_4p3 extends uart_base_sequence;
879
 
880
    rand int unsigned num_of_comands;
881
 
882
    `uvm_object_utils(seq_4p3)
883
 
884
    function new (string name = "seq_4p3");
885
      super.new(name);
886
    endfunction:new
887
 
888
    constraint num_iter {
889
      num_of_comands inside {[1:5]};
890
    }
891
 
892
    virtual task body ();
893
      randomize();
894
      start_item(trans);
895
      repeat (num_of_comands)
896
        begin
897
        trans.randomize() with {
898
          _mode       == binary;
899
          _command    == nop;
900
          (length_data > 1) -> (_reqinc == yes);
901
          _arbit      == accept;
902
          _reqack     == no;
903
        } ;
904
        end
905
      finish_item(trans);
906
    endtask:body
907
  endclass:seq_4p3
908
 
909 3 HanySalah
//-------------------------------------------------------------------------------------------------
910 2 HanySalah
//
911 3 HanySalah
//                                    WRITE IN COMMAND MODE
912 2 HanySalah
//
913 3 HanySalah
//-------------------------------------------------------------------------------------------------
914 2 HanySalah
 
915
  // 5.1 Apply UART write command with wrong prefix.
916
  class seq_5p1 extends uart_base_sequence;
917
 
918
    `uvm_object_utils(seq_5p1)
919
 
920
    function new (string name="seq_5p1");
921
      super.new(name);
922
    endfunction:new
923
 
924
    virtual task body ();
925
      start_item(trans);
926
      trans.randomize() with {
927 3 HanySalah
        _mode       == wrong_mode_bin;
928 2 HanySalah
        _command    == write;
929 3 HanySalah
        address[15:7] != 8'h00;
930 2 HanySalah
        (length_data > 1) -> (_reqinc == yes);
931
        _arbit      == accept;
932
      } ;
933
      finish_item(trans);
934
    endtask:body
935
  endclass:seq_5p1
936
 
937
  // 5.2 Apply UART write commands to different addresses.
938
  class seq_5p2 extends uart_base_sequence;
939
 
940
    rand int unsigned num_of_comands;
941
 
942
    `uvm_object_utils(seq_5p2)
943
 
944
    function new (string name="seq_5p2");
945
      super.new(name);
946
    endfunction:new
947
 
948
    constraint num_iter {
949
      num_of_comands inside {[1:5]};
950
    }
951
 
952
    virtual task body ();
953
      randomize();
954
      start_item(trans);
955
      repeat (num_of_comands)
956
        begin
957
        trans.randomize() with {
958
                _mode       == binary;
959
                _command    == write;
960
                (length_data > 1) -> (_reqinc == yes);
961
                _arbit      == accept;
962
              };
963
        end
964
      finish_item(trans);
965
    endtask:body
966
  endclass:seq_5p2
967
 
968
  // 5.3 Apply UART write commands with several data lengths
969
  class seq_5p3 extends uart_base_sequence;
970
 
971
    rand int unsigned num_of_comands;
972
 
973
    `uvm_object_utils(seq_5p3)
974
 
975
    function new (string name="seq_5p3");
976
      super.new(name);
977
    endfunction:new
978
 
979
    constraint num_iter {
980
      num_of_comands inside {[1:5]};
981
    }
982
 
983
    virtual task body ();
984
      randomize();
985
      start_item(trans);
986
      repeat (num_of_comands)
987
        begin
988
        trans.randomize() with {
989
                _mode       == binary;
990
                _command    == write;
991
                (length_data > 1) -> (_reqinc == yes);
992
                _arbit      == accept;
993
              } ;
994
        end
995
      finish_item(trans);
996
    endtask:body
997
  endclass:seq_5p3
998
 
999
  // 5.4 Apply UART write command to address 0 with random data.
1000
  class seq_5p4 extends uart_base_sequence;
1001
 
1002
    `uvm_object_utils(seq_5p4)
1003
 
1004
    function new (string name="seq_5p4");
1005
      super.new(name);
1006
    endfunction:new
1007
 
1008
    virtual task body ();
1009
      start_item(trans);
1010
      trans.randomize() with {
1011
              _mode       == binary;
1012
              _command    == write;
1013
              address     == 16'b0;
1014
              (length_data > 1) -> (_reqinc == yes);
1015
              _arbit      == accept;
1016
            } ;
1017
      finish_item(trans);
1018
    endtask:body
1019
  endclass:seq_5p4
1020
 
1021
  // 5.5 Apply UART write command to address 0xFFFF with random data.
1022
  class seq_5p5 extends uart_base_sequence;
1023
 
1024
    `uvm_object_utils(seq_5p5)
1025
 
1026
    function new (string name="seq_5p5");
1027
      super.new(name);
1028
    endfunction:new
1029
 
1030
    virtual task body ();
1031
      start_item(trans);
1032
      trans.randomize() with {
1033
              _mode       == binary;
1034
              _command    == write;
1035 3 HanySalah
              address     == 16'hFFFF;
1036 2 HanySalah
              (length_data > 1) -> (_reqinc == yes);
1037
              _arbit      == accept;
1038
            } ;
1039
      finish_item(trans);
1040
    endtask:body
1041
  endclass:seq_5p5
1042
 
1043
  // 5.6 Apply UART write command with acknowledge request.
1044
  class seq_5p6 extends uart_base_sequence;
1045
 
1046
    `uvm_object_utils(seq_5p6)
1047
 
1048
    function new (string name="seq_5p6");
1049
      super.new(name);
1050
    endfunction:new
1051
 
1052
    virtual task body ();
1053
      start_item(trans);
1054
      trans.randomize() with {
1055
              _mode       == binary;
1056
              _command    == write;
1057
              (length_data > 1) -> (_reqinc == yes);
1058
              _arbit      == accept;
1059
              _reqack     == yes;
1060
            } ;
1061
      finish_item(trans);
1062
    endtask:body
1063
  endclass:seq_5p6
1064
 
1065
  // 5.7 Apply UART write command with non-acknowledge request.
1066
  class seq_5p7 extends uart_base_sequence;
1067
 
1068
    `uvm_object_utils(seq_5p7)
1069
 
1070
    function new (string name="seq_5p7");
1071
      super.new(name);
1072
    endfunction:new
1073
 
1074
    virtual task body ();
1075
      start_item(trans);
1076
      trans.randomize() with {
1077
              _mode       == binary;
1078
              _command    == write;
1079
              (length_data > 1) -> (_reqinc == yes);
1080
              _arbit      == accept;
1081
              _reqack     == no;
1082
            } ;
1083
      finish_item(trans);
1084
    endtask:body
1085
  endclass:seq_5p7
1086
 
1087
  // 5.8 Apply UART write command including single byte.
1088
  class seq_5p8 extends uart_base_sequence;
1089
 
1090
    `uvm_object_utils(seq_5p8)
1091
 
1092
    function new (string name="seq_5p8");
1093
      super.new(name);
1094
    endfunction:new
1095
 
1096
    virtual task body ();
1097
      start_item(trans);
1098
      trans.randomize() with {
1099
              _mode       == binary;
1100
              _command    == write;
1101
              length_data == 1;
1102
              (length_data > 1) -> (_reqinc == yes);
1103
              _arbit      == accept;
1104
            } ;
1105
      finish_item(trans);
1106
    endtask:body
1107
  endclass:seq_5p8
1108
 
1109
  // 5.9 Apply UART write command including non-incremental address bit.
1110
  class seq_5p9 extends uart_base_sequence;
1111
 
1112
    `uvm_object_utils(seq_5p9)
1113
 
1114
    function new (string name="seq_5p9");
1115
      super.new(name);
1116
    endfunction:new
1117
 
1118
    virtual task body ();
1119
      start_item(trans);
1120
      trans.randomize() with {
1121
              _mode       == binary;
1122
              _command    == write;
1123
              (length_data > 1) -> (_reqinc == yes);
1124
              _arbit      == accept;
1125
              _reqinc     == no;
1126
            } ;
1127
      finish_item(trans);
1128
    endtask:body
1129
  endclass:seq_5p9
1130
 
1131
  // 5.10 Apply UART write command including incremental address bit.
1132
  class seq_5p10 extends uart_base_sequence;
1133
 
1134
    `uvm_object_utils(seq_5p10)
1135
 
1136
    function new (string name="seq_5p10");
1137
      super.new(name);
1138
    endfunction:new
1139
 
1140
    virtual task body ();
1141
      start_item(trans);
1142
      trans.randomize() with {
1143
              _mode       == binary;
1144
              _command    == write;
1145
              (length_data > 1) -> (_reqinc == yes);
1146
              _arbit      == accept;
1147
              _reqinc     == yes;
1148
            } ;
1149
      finish_item(trans);
1150
    endtask:body
1151
  endclass:seq_5p10
1152
 
1153 3 HanySalah
//-------------------------------------------------------------------------------------------------
1154 2 HanySalah
//
1155 3 HanySalah
//                                    READ IN COMMAND MODE
1156 2 HanySalah
//
1157 3 HanySalah
//-------------------------------------------------------------------------------------------------
1158 2 HanySalah
 
1159
  // 6.1 Apply UART read command with wrong prefix.
1160
  class seq_6p1 extends uart_base_sequence;
1161
 
1162
    `uvm_object_utils(seq_6p1)
1163
 
1164
    function new (string name="seq_6p1");
1165
      super.new(name);
1166
    endfunction:new
1167
 
1168
    virtual task body ();
1169
      start_item(trans);
1170
      trans.randomize() with {
1171 3 HanySalah
        _mode       == wrong_mode_bin;
1172 2 HanySalah
        _command    == read;
1173 3 HanySalah
        address[15:7] != 8'h00;
1174 2 HanySalah
        (length_data > 1) -> (_reqinc == yes);
1175
        _arbit      == accept;
1176
      } ;
1177
      finish_item(trans);
1178
    endtask:body
1179
  endclass:seq_6p1
1180
 
1181
  // 6.2 Apply UART read commands to different addresses.
1182
  class seq_6p2 extends uart_base_sequence;
1183
 
1184
    rand int unsigned num_of_comands;
1185
 
1186
    `uvm_object_utils(seq_6p2)
1187
 
1188
    function new (string name="seq_6p2");
1189
      super.new(name);
1190
    endfunction:new
1191
 
1192
    constraint num_iter {
1193
      num_of_comands inside {[1:5]};
1194
    }
1195
 
1196
    virtual task body ();
1197
      randomize();
1198
      start_item(trans);
1199
      repeat (num_of_comands)
1200
        begin
1201
        trans.randomize() with {
1202
                _mode       == binary;
1203
                _command    == read;
1204
                (length_data > 1) -> (_reqinc == yes);
1205
                _arbit      == accept;
1206
              } ;
1207
        end
1208
      finish_item(trans);
1209
    endtask:body
1210
  endclass:seq_6p2
1211
 
1212
  // 6.3 Apply UART read commands with several data lengths
1213
  class seq_6p3 extends uart_base_sequence;
1214
 
1215
    rand int unsigned num_of_comands;
1216
 
1217
    `uvm_object_utils(seq_6p3)
1218
 
1219
    function new (string name="seq_6p3");
1220
      super.new(name);
1221
    endfunction:new
1222
 
1223
    constraint num_iter {
1224
      num_of_comands inside {[1:5]};
1225
    }
1226
 
1227
    virtual task body ();
1228
      randomize();
1229
      start_item(trans);
1230
      repeat (num_of_comands)
1231
        begin
1232
        trans.randomize() with {
1233
                _mode       == binary;
1234
                _command    == read;
1235
                (length_data > 1) -> (_reqinc == yes);
1236
                _arbit      == accept;
1237
              } ;
1238
        end
1239
      finish_item(trans);
1240
    endtask:body
1241
  endclass:seq_6p3
1242
 
1243
  // 6.4 Apply UART read command to address 0 with random data.
1244
  class seq_6p4 extends uart_base_sequence;
1245
 
1246
    `uvm_object_utils(seq_6p4)
1247
 
1248
    function new (string name="seq_6p4");
1249
      super.new(name);
1250
    endfunction:new
1251
 
1252
    virtual task body ();
1253
      start_item(trans);
1254
      trans.randomize() with {
1255
              _mode       == binary;
1256
              _command    == read;
1257
              address     == 16'b0;
1258
              (length_data > 1) -> (_reqinc == yes);
1259
              _arbit      == accept;
1260
            } ;
1261
      finish_item(trans);
1262
    endtask:body
1263
  endclass:seq_6p4
1264
 
1265
  // 6.5 Apply UART read command to address 0xFFFF with random data.
1266
  class seq_6p5 extends uart_base_sequence;
1267
 
1268
    `uvm_object_utils(seq_6p5)
1269
 
1270
    function new (string name="seq_6p5");
1271
      super.new(name);
1272
    endfunction:new
1273
 
1274
    virtual task body ();
1275
      start_item(trans);
1276
      trans.randomize() with {
1277
              _mode       == binary;
1278
              _command    == read;
1279 3 HanySalah
              address     == 16'hFFFF;
1280 2 HanySalah
              (length_data > 1) -> (_reqinc == yes);
1281
              _arbit      == accept;
1282
            } ;
1283
      finish_item(trans);
1284
    endtask:body
1285
  endclass:seq_6p5
1286
 
1287
  // 6.6 Apply UART read command with acknowledge request.
1288
  class seq_6p6 extends uart_base_sequence;
1289
 
1290
    `uvm_object_utils(seq_6p6)
1291
 
1292
    function new (string name="seq_6p6");
1293
      super.new(name);
1294
    endfunction:new
1295
 
1296
    virtual task body ();
1297
      start_item(trans);
1298
      trans.randomize() with {
1299
              _mode       == binary;
1300
              _command    == read;
1301
              (length_data > 1) -> (_reqinc == yes);
1302
              _arbit      == accept;
1303
              _reqack     == yes;
1304
            } ;
1305
      finish_item(trans);
1306
    endtask:body
1307
  endclass:seq_6p6
1308
 
1309
  // 6.7 Apply UART read command with non-acknowledge request.
1310
  class seq_6p7 extends uart_base_sequence;
1311
 
1312
    `uvm_object_utils(seq_6p7)
1313
 
1314
    function new (string name="seq_6p7");
1315
      super.new(name);
1316
    endfunction:new
1317
 
1318
    virtual task body ();
1319
      start_item(trans);
1320
      trans.randomize() with {
1321
              _mode       == binary;
1322
              _command    == read;
1323
              (length_data > 1) -> (_reqinc == yes);
1324
              _arbit      == accept;
1325
              _reqack     == no;
1326
            } ;
1327
      finish_item(trans);
1328
    endtask:body
1329
  endclass:seq_6p7
1330
 
1331
  // 6.8 Apply UART read command including single byte.
1332
  class seq_6p8 extends uart_base_sequence;
1333
 
1334
    `uvm_object_utils(seq_6p8)
1335
 
1336
    function new (string name="seq_6p8");
1337
      super.new(name);
1338
    endfunction:new
1339
 
1340
    virtual task body ();
1341
      start_item(trans);
1342
      trans.randomize() with {
1343
              _mode       == binary;
1344
              _command    == read;
1345
              length_data == 1;
1346
              (length_data > 1) -> (_reqinc == yes);
1347
              _arbit      == accept;
1348
            } ;
1349
      finish_item(trans);
1350
    endtask:body
1351
  endclass:seq_6p8
1352
 
1353
  // 6.9 Apply UART read command including non-incremental address bit.
1354
  class seq_6p9 extends uart_base_sequence;
1355
 
1356
    `uvm_object_utils(seq_6p9)
1357
 
1358
    function new (string name="seq_6p9");
1359
      super.new(name);
1360
    endfunction:new
1361
 
1362
    virtual task body ();
1363
      start_item(trans);
1364
      trans.randomize() with {
1365
              _mode       == binary;
1366
              _command    == read;
1367
              (length_data > 1) -> (_reqinc == yes);
1368
              _arbit      == accept;
1369
              _reqinc     == no;
1370
            } ;
1371
      finish_item(trans);
1372
    endtask:body
1373
  endclass:seq_6p9
1374
 
1375
  // 6.10 Apply UART read command including incremental address bit.
1376
  class seq_6p10 extends uart_base_sequence;
1377
 
1378
    `uvm_object_utils(seq_6p10)
1379
 
1380
    function new (string name="seq_6p10");
1381
      super.new(name);
1382
    endfunction:new
1383
 
1384
    virtual task body ();
1385
      start_item(trans);
1386
      trans.randomize() with {
1387
              _mode       == binary;
1388
              _command    == read;
1389
              (length_data > 1) -> (_reqinc == yes);
1390
              _arbit      == accept;
1391
              _reqinc     == yes;
1392
            } ;
1393
      finish_item(trans);
1394
    endtask:body
1395
  endclass:seq_6p10
1396
 
1397 3 HanySalah
//-------------------------------------------------------------------------------------------------
1398 2 HanySalah
//
1399 3 HanySalah
//                                     INTERNAL BUS
1400 2 HanySalah
//
1401 3 HanySalah
//-------------------------------------------------------------------------------------------------
1402 2 HanySalah
 
1403
  // 7.1 Apply UART read or write commands and give the UART the bus grant.
1404
  class seq_7p1 extends uart_base_sequence;
1405
 
1406
    `uvm_object_utils(seq_7p1)
1407
 
1408
    function new (string name="seq_7p1");
1409
      super.new(name);
1410
    endfunction:new
1411
 
1412
    virtual task body ();
1413
      start_item(trans);
1414
      trans.randomize() with {
1415
              _mode       == binary;
1416
              _command    inside {write,read};
1417
              (length_data > 1) -> (_reqinc == yes);
1418
              _arbit      == accept;
1419
              _reqinc     == yes;
1420
            } ;
1421
      finish_item(trans);
1422
    endtask:body
1423
  endclass:seq_7p1
1424
 
1425
  // 7.2 Apply UART read or write commands and give no agreement to access internal bus
1426
  class seq_7p2 extends uart_base_sequence;
1427
 
1428
    `uvm_object_utils(seq_7p2)
1429
 
1430
    function new (string name="seq_7p2");
1431
      super.new(name);
1432
    endfunction:new
1433
 
1434
    virtual task body ();
1435
      start_item(trans);
1436
      trans.randomize() with {
1437
              _mode       == binary;
1438
              _command    inside {write,read};
1439
              (length_data > 1) -> (_reqinc == yes);
1440
              _arbit      == declain;
1441
              _reqinc     == yes;
1442
            } ;
1443
      finish_item(trans);
1444
    endtask:body
1445 3 HanySalah
  endclass:seq_7p2
1446
 
1447
//-------------------------------------------------------------------------------------------------
1448
//
1449
//                                      INVALID COMMANDS
1450
//
1451
//-------------------------------------------------------------------------------------------------
1452
 
1453
  // 8.1 Apply Invalid UART command in form of write binary command.
1454
  class seq_8p1 extends uart_base_sequence;
1455
 
1456
    `uvm_object_utils(seq_8p1)
1457
 
1458
    function new (string name="seq_8p1");
1459
      super.new(name);
1460
    endfunction:new
1461
 
1462
    virtual task body ();
1463
      start_item(trans);
1464
      trans.randomize() with {
1465
              _mode       == binary;
1466
              _command    == invalid_write;
1467
              (length_data > 1) -> (_reqinc == yes);
1468
              _arbit      == accept;
1469
              _reqinc     == yes;
1470
            } ;
1471
      finish_item(trans);
1472
    endtask:body
1473
  endclass:seq_8p1
1474
 
1475
  // 8.2 Apply Invalid UART command in form of read binary command.
1476
  class seq_8p2 extends uart_base_sequence;
1477
 
1478
    `uvm_object_utils(seq_8p2)
1479
 
1480
    function new (string name="seq_8p2");
1481
      super.new(name);
1482
    endfunction:new
1483
 
1484
    virtual task body ();
1485
      start_item(trans);
1486
      trans.randomize() with {
1487
              _mode       == binary;
1488
              _command    == invalid_read;
1489
              (length_data > 1) -> (_reqinc == yes);
1490
              _arbit      == declain;
1491
              _reqinc     == yes;
1492
            } ;
1493
      finish_item(trans);
1494
    endtask:body
1495 5 HanySalah
  endclass:seq_8p2

powered by: WebSVN 2.1.0

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