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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [PCIe/] [sim/] [src/] [RIFFA/] [riffa_rp_tx_driver.svh] - Blame information for rev 50

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 50 qaztronic
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// Copyright (C) 2019 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
class riffa_rp_tx_driver #(N) extends uvm_driver #(riffa_sequence_item);
29
  `uvm_component_param_utils(riffa_rp_tx_driver #(N))
30
 
31
  // --------------------------------------------------------------------
32
  virtual riffa_chnl_if #(N) vif;
33
 
34
  //--------------------------------------------------------------------
35
  function void set_default;
36
    vif.cb_rp_tx.rx <= 0;
37
    vif.cb_rp_tx.rx_last <= 'bx;
38
    vif.cb_rp_tx.rx_len <= 'bx;
39
    vif.cb_rp_tx.rx_off <= 'bx;
40
    vif.cb_rp_tx.rx_data <= 'bx;
41
    vif.cb_rp_tx.rx_data_valid <= 0;
42
  endfunction: set_default
43
 
44
  //--------------------------------------------------------------------
45
  virtual task run_phase(uvm_phase phase);
46
    riffa_sequence_item item;
47
    reg [(8*N)-1:0] rx_data;
48
    super.run_phase(phase);
49
 
50
    set_default();
51
 
52
    forever
53
    begin
54
      wait(~vif.rx_reset);
55
      seq_item_port.get_next_item(item);
56
 
57
      @(vif.cb_rp_tx);
58
      vif.cb_rp_tx.rx_len <= item.len;  // must be => 4
59
      vif.cb_rp_tx.rx_off <= item.off;
60
      vif.cb_rp_tx.rx_last <= item.last;
61
      vif.cb_rp_tx.rx <= 1;
62
 
63
      @(vif.cb_rp_tx iff vif.cb_rp_tx.rx_ack);
64
      vif.cb_rp_tx.rx_data_valid <= 1;
65
 
66
      for(int i = 0; i < item.beats; i++)
67
      begin
68
        {<
69
        vif.cb_rp_tx.rx_data <= rx_data;
70
        @(vif.cb_rp_tx iff vif.cb_rp_tx.rx_data_ren);
71
        // $display("^^^^^ %16.t | RX | %d | %h", $time, i, vif.cb_rp_tx.rx_data);
72
      end
73
 
74
      set_default();
75
      seq_item_port.item_done();
76
    end
77
  endtask : run_phase
78
 
79
  //--------------------------------------------------------------------
80
  function new(string name, uvm_component parent);
81
    super.new(name, parent);
82
  endfunction
83
 
84
// --------------------------------------------------------------------
85
endclass

powered by: WebSVN 2.1.0

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