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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [axi4_lib/] [sim/] [src/] [legacy/] [axi4_models/] [axi4_models_pkg.sv] - Blame information for rev 50

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

Line No. Rev Author Line
1 45 qaztronic
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// Copyright (C) 2015 Authors and OPENCORES.ORG                 ////
4
////                                                              ////
5
//// This source file may be used and distributed without         ////
6
//// restriction provided that this copyright statement is not    ////
7
//// removed from the file and that any derivative work contains  ////
8
//// the original copyright notice and the associated disclaimer. ////
9
////                                                              ////
10
//// This source file is free software; you can redistribute it   ////
11
//// and/or modify it under the terms of the GNU Lesser General   ////
12
//// Public License as published by the Free Software Foundation; ////
13
//// either version 2.1 of the License, or (at your option) any   ////
14
//// later version.                                               ////
15
////                                                              ////
16
//// This source is distributed in the hope that it will be       ////
17
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
18
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
19
//// PURPOSE.  See the GNU Lesser General Public License for more ////
20
//// details.                                                     ////
21
////                                                              ////
22
//// You should have received a copy of the GNU Lesser General    ////
23
//// Public License along with this source; if not, download it   ////
24
//// from http://www.opencores.org/lgpl.shtml                     ////
25
////                                                              ////
26
//////////////////////////////////////////////////////////////////////
27
 
28
 
29
// --------------------------------------------------------------------
30
//
31
package axi4_models_pkg;
32
 
33
  // --------------------------------------------------------------------
34
  //
35
  virtual class axi4_channel_if_class #(A, N, I);
36
 
37
    virtual axi4_if  #(A, N, I) axi4_bus;
38
    event valid;
39
 
40
 
41
    // --------------------------------------------------------------------
42
    //
43
    pure virtual function void set_master_default;
44
    pure virtual function void set_slave_default;
45
    pure virtual function void copy(axi4_channel_if_class #(A, N, I) from);
46
    pure virtual function void copy_if;
47
    pure virtual function void drive_if;
48
    pure virtual function void set_ready(bit value);
49
    pure virtual function bit is_valid;
50
    pure virtual function void set_valid(bit value);
51
    pure virtual function bit is_ready;
52
    pure virtual function bit is_transfer;
53
 
54
 
55
    //--------------------------------------------------------------------
56
    function new(virtual axi4_if  #(A, N, I) axi4_bus);
57
      this.axi4_bus = axi4_bus;
58
    endfunction: new
59
 
60
 
61
  // --------------------------------------------------------------------
62
  //
63
  endclass: axi4_channel_if_class
64
 
65
 
66
  // --------------------------------------------------------------------
67
  //
68
  class axi4_channel_sink_q_class  #(A, N, I, type T = logic);
69
 
70
    virtual axi4_if #(A, N, I) axi4_bus;
71
    T c_if_h;
72
    int q_size;
73
    mailbox #(T) q;
74
 
75
 
76
    // --------------------------------------------------------------------
77
    //
78
    function automatic void run_q;
79
      int result;
80
      c_if_h.set_ready(1'b1);
81
 
82
      fork
83
        forever
84
          @(axi4_bus.cb_s)
85
          begin
86
            if(c_if_h.is_transfer)
87
            begin
88
              result = q.try_put(c_if_h);
89
              if(result == 0)
90
                $error;
91
 
92
              c_if_h.copy_if();
93
              c_if_h = new(axi4_bus);
94
            end
95
 
96
            if(q.num >= q_size)
97
              c_if_h.set_ready(1'b0);
98
            else
99
              c_if_h.set_ready(1'b1);
100
          end
101
      join_none
102
    endfunction: run_q
103
 
104
 
105
    //--------------------------------------------------------------------
106
    function new( virtual axi4_if #(A, N, I) axi4_bus, int q_size);
107
      this.axi4_bus = axi4_bus;
108
      this.q_size   = q_size;
109
      this.q        = new(q_size);
110
      this.c_if_h   = new(axi4_bus);
111
    endfunction: new
112
 
113
 
114
  // --------------------------------------------------------------------
115
  //
116
  endclass: axi4_channel_sink_q_class
117
 
118
 
119
  // --------------------------------------------------------------------
120
  //
121
  class axi4_channel_source_q_class  #(A, N, I, type T = logic);
122
 
123
    virtual axi4_if #(A, N, I) axi4_bus;
124
    T c_if_h;
125
    int q_size;
126
    mailbox #(T) q;
127
 
128
 
129
    // --------------------------------------------------------------------
130
    //
131
    function automatic void run_q;
132
      int result;
133
      c_if_h.set_valid(1'b0);
134
 
135
      fork
136
        forever
137
          @(axi4_bus.cb_s)
138
          begin
139
            if(c_if_h.is_transfer)
140
            begin
141
              result = q.try_get(c_if_h);
142
              if(result == 0)
143
                $stop;
144
            end
145
 
146
            result = q.try_peek(c_if_h);
147
            if(result == 0)
148
              c_if_h.set_valid(1'b0);
149
            else
150
            begin
151
              c_if_h.set_valid(1'b1);
152
              c_if_h.drive_if();
153
            end
154
          end
155
      join_none
156
    endfunction: run_q
157
 
158
 
159
    //--------------------------------------------------------------------
160
    function new(virtual axi4_if #(A, N, I) axi4_bus, int q_size);
161
      this.axi4_bus = axi4_bus;
162
      this.q_size   = q_size;
163
      this.q        = new(q_size);
164
      this.c_if_h   = new(axi4_bus);
165
    endfunction: new
166
 
167
 
168
  // --------------------------------------------------------------------
169
  //
170
  endclass: axi4_channel_source_q_class
171
 
172
 
173
  // --------------------------------------------------------------------
174
  //
175
  class axi4_aw_if_class #(A, N, I)
176
    extends axi4_channel_if_class #(A, N, I);
177
 
178
    logic [(A-1):0]    awaddr;
179
    logic [1:0]        awburst;
180
    logic [(I-1):0]    awid;
181
    logic [7:0]        awlen;
182
    logic [2:0]        awsize;
183
    logic [3:0]        awcache;
184
    logic              awlock;
185
    logic [2:0]        awprot;
186
    logic [3:0]        awqos;
187
    logic [3:0]        awregion;
188
 
189
 
190
    // --------------------------------------------------------------------
191
    //
192
    function void set_master_default;
193
      axi4_bus.cb_m.awvalid <= 0;
194
    endfunction: set_master_default
195
 
196
 
197
    // --------------------------------------------------------------------
198
    //
199
    function void set_slave_default;
200
      axi4_bus.cb_s.awready <= 0;
201
    endfunction: set_slave_default
202
 
203
 
204
    // --------------------------------------------------------------------
205
    //
206
    function void copy(axi4_channel_if_class #(A, N, I) from);
207
      axi4_aw_if_class #(A, N, I) child;
208
      $cast(child, from);
209
      awaddr    = child.awaddr;
210
      awburst   = child.awburst;
211
      awid      = child.awid;
212
      awlen     = child.awlen;
213
      awsize    = child.awsize;
214
      awcache   = child.awcache;
215
      awlock    = child.awlock;
216
      awprot    = child.awprot;
217
      awqos     = child.awqos;
218
      awregion  = child.awregion;
219
    endfunction: copy
220
 
221
 
222
    // --------------------------------------------------------------------
223
    //
224
    function void copy_if;
225
      awaddr    = axi4_bus.cb_s.awaddr;
226
      awburst   = axi4_bus.cb_s.awburst;
227
      awid      = axi4_bus.cb_s.awid;
228
      awlen     = axi4_bus.cb_s.awlen;
229
      awsize    = axi4_bus.cb_s.awsize;
230
      awcache   = axi4_bus.cb_s.awcache;
231
      awlock    = axi4_bus.cb_s.awlock;
232
      awprot    = axi4_bus.cb_s.awprot;
233
      awqos     = axi4_bus.cb_s.awqos;
234
      awregion  = axi4_bus.cb_s.awregion;
235
    endfunction: copy_if
236
 
237
 
238
    // --------------------------------------------------------------------
239
    //
240
    function void drive_if;
241
      axi4_bus.cb_m.awaddr    <= awaddr;
242
      axi4_bus.cb_m.awburst   <= awburst;
243
      axi4_bus.cb_m.awid      <= awid;
244
      axi4_bus.cb_m.awlen     <= awlen;
245
      axi4_bus.cb_m.awsize    <= awsize;
246
      axi4_bus.cb_m.awcache   <= awcache;
247
      axi4_bus.cb_m.awlock    <= awlock;
248
      axi4_bus.cb_m.awprot    <= awprot;
249
      axi4_bus.cb_m.awqos     <= awqos;
250
      axi4_bus.cb_m.awregion  <= awregion;
251
    endfunction: drive_if
252
 
253
 
254
    // --------------------------------------------------------------------
255
    //
256
    function void set_ready(bit value);
257
      axi4_bus.cb_s.awready <= value;
258
    endfunction: set_ready
259
 
260
 
261
    // --------------------------------------------------------------------
262
    //
263
    function bit is_valid;
264
      return(axi4_bus.cb_s.awvalid);
265
    endfunction: is_valid
266
 
267
 
268
    // --------------------------------------------------------------------
269
    //
270
    function void set_valid(bit value);
271
      axi4_bus.cb_m.awvalid <= value;
272
    endfunction: set_valid
273
 
274
 
275
    // --------------------------------------------------------------------
276
    //
277
    function bit is_ready;
278
      return(axi4_bus.cb_m.awready);
279
    endfunction: is_ready
280
 
281
 
282
    // --------------------------------------------------------------------
283
    //
284
    function bit is_transfer;
285
      return(axi4_bus.cb_m.awready & axi4_bus.cb_s.awvalid);
286
    endfunction: is_transfer
287
 
288
 
289
    //--------------------------------------------------------------------
290
    function new(virtual axi4_if  #(A, N, I) axi4_bus);
291
      super.new(axi4_bus);
292
    endfunction: new
293
 
294
  // --------------------------------------------------------------------
295
  //
296
  endclass: axi4_aw_if_class
297
 
298
 
299
  // --------------------------------------------------------------------
300
  //
301
  class axi4_ar_if_class #(A, N, I)
302
    extends axi4_channel_if_class #(A, N, I);
303
 
304
    logic [(A-1):0]    araddr;
305
    logic [1:0]        arburst;
306
    logic [(I-1):0]    arid;
307
    logic [7:0]        arlen;
308
    logic [2:0]        arsize;
309
    logic [3:0]        arcache;
310
    logic              arlock;
311
    logic [2:0]        arprot;
312
    logic [3:0]        arqos;
313
    logic [3:0]        arregion;
314
 
315
 
316
    // --------------------------------------------------------------------
317
    //
318
    virtual function void set_master_default;
319
      axi4_bus.cb_m.arvalid <= 0;
320
    endfunction: set_master_default
321
 
322
 
323
    // --------------------------------------------------------------------
324
    //
325
    virtual function void set_slave_default;
326
      axi4_bus.cb_s.arready <= 0;
327
    endfunction: set_slave_default
328
 
329
 
330
    // --------------------------------------------------------------------
331
    //
332
    virtual function void copy(axi4_channel_if_class #(A, N, I) from);
333
      axi4_ar_if_class #(A, N, I) child;
334
      $cast(child, from);
335
      araddr    = child.araddr;
336
      arburst   = child.arburst;
337
      arid      = child.arid;
338
      arlen     = child.arlen;
339
      arsize    = child.arsize;
340
      arcache   = child.arcache;
341
      arlock    = child.arlock;
342
      arprot    = child.arprot;
343
      arqos     = child.arqos;
344
      arregion  = child.arregion;
345
    endfunction: copy
346
 
347
 
348
    // --------------------------------------------------------------------
349
    //
350
    virtual function void copy_if;
351
      araddr    = axi4_bus.cb_s.araddr;
352
      arburst   = axi4_bus.cb_s.arburst;
353
      arid      = axi4_bus.cb_s.arid;
354
      arlen     = axi4_bus.cb_s.arlen;
355
      arsize    = axi4_bus.cb_s.arsize;
356
      arcache   = axi4_bus.cb_s.arcache;
357
      arlock    = axi4_bus.cb_s.arlock;
358
      arprot    = axi4_bus.cb_s.arprot;
359
      arqos     = axi4_bus.cb_s.arqos;
360
      arregion  = axi4_bus.cb_s.arregion;
361
    endfunction: copy_if
362
 
363
 
364
    // --------------------------------------------------------------------
365
    //
366
    virtual function void drive_if;
367
      axi4_bus.cb_m.araddr    <= araddr;
368
      axi4_bus.cb_m.arburst   <= arburst;
369
      axi4_bus.cb_m.arid      <= arid;
370
      axi4_bus.cb_m.arlen     <= arlen;
371
      axi4_bus.cb_m.arsize    <= arsize;
372
      axi4_bus.cb_m.arcache   <= arcache;
373
      axi4_bus.cb_m.arlock    <= arlock;
374
      axi4_bus.cb_m.arprot    <= arprot;
375
      axi4_bus.cb_m.arqos     <= arqos;
376
      axi4_bus.cb_m.arregion  <= arregion;
377
    endfunction: drive_if
378
 
379
 
380
    // --------------------------------------------------------------------
381
    //
382
    virtual function void set_ready(bit value);
383
      axi4_bus.cb_s.arready <= value;
384
    endfunction: set_ready
385
 
386
 
387
    // --------------------------------------------------------------------
388
    //
389
    virtual function bit is_valid;
390
      return(axi4_bus.cb_s.arvalid);
391
    endfunction: is_valid
392
 
393
 
394
    // --------------------------------------------------------------------
395
    //
396
    function void set_valid(bit value);
397
      axi4_bus.cb_m.arvalid <= value;
398
    endfunction: set_valid
399
 
400
 
401
    // --------------------------------------------------------------------
402
    //
403
    function bit is_ready;
404
      return(axi4_bus.cb_m.arready);
405
    endfunction: is_ready
406
 
407
 
408
    // --------------------------------------------------------------------
409
    //
410
    function bit is_transfer;
411
      return(axi4_bus.cb_m.arready & axi4_bus.cb_s.arvalid);
412
    endfunction: is_transfer
413
 
414
 
415
    //--------------------------------------------------------------------
416
    function new(virtual axi4_if  #(A, N, I) axi4_bus);
417
      super.new(axi4_bus);
418
    endfunction: new
419
 
420
 
421
  // --------------------------------------------------------------------
422
  //
423
  endclass: axi4_ar_if_class
424
 
425
 
426
  // --------------------------------------------------------------------
427
  //
428
  class axi4_w_if_class #(A, N, I)
429
    extends axi4_channel_if_class #(A, N, I);
430
 
431
    logic [(8*N)-1:0]  wdata;
432
    logic [(I-1):0]    wid;
433
    logic              wlast;
434
    logic [N-1:0]      wstrb;
435
 
436
 
437
    // --------------------------------------------------------------------
438
    //
439
    function void set_master_default;
440
      axi4_bus.cb_m.wvalid <= 0;
441
    endfunction: set_master_default
442
 
443
 
444
    // --------------------------------------------------------------------
445
    //
446
    function void set_slave_default;
447
      axi4_bus.cb_s.wready <= 0;
448
    endfunction: set_slave_default
449
 
450
 
451
    // --------------------------------------------------------------------
452
    //
453
    function void copy(axi4_channel_if_class #(A, N, I) from);
454
      axi4_w_if_class #(A, N, I) child;
455
      $cast(child, from);
456
      wdata = child.wdata;
457
      wid   = child.wid;
458
      wlast = child.wlast;
459
      wstrb = child.wstrb;
460
    endfunction: copy
461
 
462
 
463
    // --------------------------------------------------------------------
464
    //
465
    function void copy_if;
466
      wdata = axi4_bus.cb_s.wdata;
467
      wid   = axi4_bus.cb_s.wid;
468
      wlast = axi4_bus.cb_s.wlast;
469
      wstrb = axi4_bus.cb_s.wstrb;
470
    endfunction: copy_if
471
 
472
 
473
    // --------------------------------------------------------------------
474
    //
475
    function void drive_if;
476
      axi4_bus.cb_m.wdata <= wdata;
477
      axi4_bus.cb_m.wid   <= wid;
478
      axi4_bus.cb_m.wlast <= wlast;
479
      axi4_bus.cb_m.wstrb <= wstrb;
480
    endfunction: drive_if
481
 
482
 
483
    // --------------------------------------------------------------------
484
    //
485
    function void set_ready(bit value);
486
        axi4_bus.cb_s.wready <= value;
487
    endfunction: set_ready
488
 
489
 
490
    // --------------------------------------------------------------------
491
    //
492
    function bit is_valid;
493
      return(axi4_bus.cb_s.wvalid);
494
    endfunction: is_valid
495
 
496
 
497
    // --------------------------------------------------------------------
498
    //
499
    function void set_valid(bit value);
500
      axi4_bus.cb_m.wvalid <= value;
501
    endfunction: set_valid
502
 
503
 
504
    // --------------------------------------------------------------------
505
    //
506
    function bit is_ready;
507
      return(axi4_bus.cb_m.wready);
508
    endfunction: is_ready
509
 
510
 
511
    // --------------------------------------------------------------------
512
    //
513
    function bit is_transfer;
514
      return(axi4_bus.cb_m.wready & axi4_bus.cb_s.wvalid);
515
    endfunction: is_transfer
516
 
517
 
518
    //--------------------------------------------------------------------
519
    function new(virtual axi4_if  #(A, N, I) axi4_bus);
520
      super.new(axi4_bus);
521
    endfunction: new
522
 
523
  // --------------------------------------------------------------------
524
  //
525
  endclass: axi4_w_if_class
526
 
527
 
528
  // --------------------------------------------------------------------
529
  //
530
  class axi4_b_if_class #(A, N, I)
531
    extends axi4_channel_if_class #(A, N, I);
532
 
533
    logic [(I-1):0] bid;
534
    logic [1:0]     bresp;
535
 
536
 
537
    // --------------------------------------------------------------------
538
    //
539
    function void set_master_default;
540
      axi4_bus.cb_m.bready <= 0;
541
    endfunction: set_master_default
542
 
543
 
544
    // --------------------------------------------------------------------
545
    //
546
    function void set_slave_default;
547
      axi4_bus.cb_s.bvalid <= 0;
548
    endfunction: set_slave_default
549
 
550
 
551
    // --------------------------------------------------------------------
552
    //
553
    function void copy(axi4_channel_if_class #(A, N, I) from);
554
      axi4_b_if_class #(A, N, I) child;
555
      $cast(child, from);
556
      bid   = child.bid;
557
      bresp = child.bresp;
558
    endfunction: copy
559
 
560
 
561
    // --------------------------------------------------------------------
562
    //
563
    function void copy_if;
564
      bid   = axi4_bus.cb_m.bid;
565
      bresp = axi4_bus.cb_m.bresp;
566
    endfunction: copy_if
567
 
568
 
569
    // --------------------------------------------------------------------
570
    //
571
    function void drive_if;
572
      axi4_bus.cb_s.bid   <= bid;
573
      axi4_bus.cb_s.bresp <= bresp;
574
    endfunction: drive_if
575
 
576
 
577
    // --------------------------------------------------------------------
578
    //
579
    function void set_ready(bit value);
580
      axi4_bus.cb_m.bready <= value;
581
    endfunction: set_ready
582
 
583
 
584
    // --------------------------------------------------------------------
585
    //
586
    function bit is_valid;
587
      return(axi4_bus.cb_m.bvalid);
588
    endfunction: is_valid
589
 
590
 
591
    // --------------------------------------------------------------------
592
    //
593
    function void set_valid(bit value);
594
      axi4_bus.cb_s.bvalid <= value;
595
    endfunction: set_valid
596
 
597
 
598
    // --------------------------------------------------------------------
599
    //
600
    function bit is_ready;
601
      return(axi4_bus.cb_s.bready);
602
    endfunction: is_ready
603
 
604
 
605
    // --------------------------------------------------------------------
606
    //
607
    function bit is_transfer;
608
      return(axi4_bus.cb_s.bready & axi4_bus.cb_m.bvalid);
609
    endfunction: is_transfer
610
 
611
 
612
    //--------------------------------------------------------------------
613
    function new(virtual axi4_if  #(A, N, I) axi4_bus);
614
      super.new(axi4_bus);
615
    endfunction: new
616
 
617
  // --------------------------------------------------------------------
618
  //
619
  endclass: axi4_b_if_class
620
 
621
  // --------------------------------------------------------------------
622
  //
623
  class axi4_r_if_class #(A, N, I)
624
    extends axi4_channel_if_class #(A, N, I);
625
 
626
    logic [(8*N)-1:0] rdata;
627
    logic [(I-1):0]   rid;
628
    logic             rlast;
629
    logic [1:0]       rresp;
630
 
631
 
632
    // --------------------------------------------------------------------
633
    //
634
    function void set_master_default;
635
      axi4_bus.cb_m.rready <= 0;
636
    endfunction: set_master_default
637
 
638
 
639
    // --------------------------------------------------------------------
640
    //
641
    function void set_slave_default;
642
      axi4_bus.cb_s.rvalid <= 0;
643
    endfunction: set_slave_default
644
 
645
 
646
    // --------------------------------------------------------------------
647
    //
648
    function void copy(axi4_channel_if_class #(A, N, I) from);
649
      axi4_r_if_class #(A, N, I) child;
650
      $cast(child, from);
651
      rdata = child.rdata;
652
      rid   = child.rid;
653
      rlast = child.rlast;
654
      rresp = child.rresp;
655
    endfunction: copy
656
 
657
 
658
    // --------------------------------------------------------------------
659
    //
660
    function void copy_if;
661
      rdata = axi4_bus.cb_m.rdata;
662
      rid   = axi4_bus.cb_m.rid;
663
      rlast = axi4_bus.cb_m.rlast;
664
      rresp = axi4_bus.cb_m.rresp;
665
    endfunction: copy_if
666
 
667
 
668
    // --------------------------------------------------------------------
669
    //
670
    function void drive_if;
671
      axi4_bus.cb_s.rdata <= rdata;
672
      axi4_bus.cb_s.rid   <= rid;
673
      axi4_bus.cb_s.rlast <= rlast;
674
      axi4_bus.cb_s.rresp <= rresp;
675
    endfunction: drive_if
676
 
677
 
678
    // --------------------------------------------------------------------
679
    //
680
    function void set_ready(bit value);
681
      axi4_bus.cb_m.rready <= value;
682
    endfunction: set_ready
683
 
684
 
685
    // --------------------------------------------------------------------
686
    //
687
    function bit is_valid;
688
      return(axi4_bus.cb_m.rvalid);
689
    endfunction: is_valid
690
 
691
 
692
    // --------------------------------------------------------------------
693
    //
694
    function void set_valid(bit value);
695
      axi4_bus.cb_s.rvalid <= value;
696
    endfunction: set_valid
697
 
698
 
699
    // --------------------------------------------------------------------
700
    //
701
    function bit is_ready;
702
      return(axi4_bus.cb_s.rready);
703
    endfunction: is_ready
704
 
705
 
706
    // --------------------------------------------------------------------
707
    //
708
    function bit is_transfer;
709
      return(axi4_bus.cb_s.rready & axi4_bus.cb_m.rvalid);
710
    endfunction: is_transfer
711
 
712
 
713
    //--------------------------------------------------------------------
714
    function new(virtual axi4_if  #(A, N, I) axi4_bus);
715
      super.new(axi4_bus);
716
    endfunction: new
717
 
718
  // --------------------------------------------------------------------
719
  //
720
  endclass: axi4_r_if_class
721
 
722
 
723
  // --------------------------------------------------------------------
724
  //
725
  virtual class axi4_master_model_class #(A, N, I);
726
 
727
    virtual axi4_if #(A, N, I) axi4_m;
728
    axi4_aw_if_class #(A, N, I) aw_if_h;
729
    axi4_channel_source_q_class #(A, N, I, axi4_aw_if_class #(A, N, I)) aw_q_h;
730
    axi4_w_if_class #(A, N, I) w_if_h;
731
    axi4_channel_source_q_class #(A, N, I, axi4_w_if_class #(A, N, I)) w_q_h;
732
    axi4_b_if_class #(A, N, I) b_if_h;
733
    axi4_channel_sink_q_class #(A, N, I, axi4_b_if_class #(A, N, I)) b_q_h;
734
    axi4_ar_if_class #(A, N, I) ar_if_h;
735
    axi4_channel_source_q_class #(A, N, I, axi4_ar_if_class #(A, N, I)) ar_q_h;
736
    axi4_r_if_class #(A, N, I) r_if_h;
737
    axi4_channel_sink_q_class #(A, N, I, axi4_r_if_class #(A, N, I)) r_q_h;
738
 
739
 
740
    // --------------------------------------------------------------------
741
    //
742
    pure virtual task run_model;
743
 
744
 
745
    //--------------------------------------------------------------------
746
    function new(virtual axi4_if  #(A, N, I) axi4_m);
747
      this.axi4_m = axi4_m;
748
      this.aw_if_h = new(axi4_m);
749
      aw_if_h.set_master_default();
750
      this.w_if_h = new(axi4_m);
751
      w_if_h.set_master_default();
752
      this.b_if_h = new(axi4_m);
753
      b_if_h.set_master_default();
754
      this.ar_if_h = new(axi4_m);
755
      ar_if_h.set_master_default();
756
      this.r_if_h = new(axi4_m);
757
      r_if_h.set_master_default();
758
 
759
      fork
760
        run_model();
761
      join_none
762
    endfunction: new
763
 
764
 
765
  // --------------------------------------------------------------------
766
  //
767
  endclass: axi4_master_model_class
768
 
769
 
770
  // --------------------------------------------------------------------
771
  //
772
  virtual class axi4_slave_model_class #(A, N, I);
773
 
774
    virtual axi4_if #(A, N, I) axi4_s;
775
    axi4_aw_if_class #(A, N, I) aw_if_h;
776
    axi4_channel_sink_q_class #(A, N, I, axi4_aw_if_class #(A, N, I)) aw_q_h;
777
    axi4_w_if_class #(A, N, I) w_if_h;
778
    axi4_channel_sink_q_class #(A, N, I, axi4_w_if_class #(A, N, I)) w_q_h;
779
    axi4_b_if_class #(A, N, I) b_if_h;
780
    axi4_channel_source_q_class #(A, N, I, axi4_b_if_class #(A, N, I)) b_q_h;
781
    axi4_ar_if_class #(A, N, I) ar_if_h;
782
    axi4_channel_sink_q_class #(A, N, I, axi4_ar_if_class #(A, N, I)) ar_q_h;
783
    axi4_r_if_class #(A, N, I) r_if_h;
784
    axi4_channel_source_q_class #(A, N, I, axi4_r_if_class #(A, N, I)) r_q_h;
785
 
786
 
787
    // --------------------------------------------------------------------
788
    //
789
    pure virtual task run_model;
790
 
791
 
792
    //--------------------------------------------------------------------
793
    function new(virtual axi4_if  #(A, N, I) axi4_s);
794
 
795
      this.axi4_s = axi4_s;
796
      this.aw_if_h = new(axi4_s);
797
      aw_if_h.set_slave_default();
798
      this.w_if_h = new(axi4_s);
799
      w_if_h.set_slave_default();
800
      this.b_if_h = new(axi4_s);
801
      b_if_h.set_slave_default();
802
      this.ar_if_h = new(axi4_s);
803
      ar_if_h.set_slave_default();
804
      this.r_if_h = new(axi4_s);
805
      r_if_h.set_slave_default();
806
 
807
      fork
808
        run_model();
809
      join_none
810
    endfunction: new
811
 
812
 
813
  // --------------------------------------------------------------------
814
  //
815
  endclass: axi4_slave_model_class
816
 
817
 
818
// --------------------------------------------------------------------
819
//
820
endpackage: axi4_models_pkg
821
 
822
 

powered by: WebSVN 2.1.0

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