| 1 |
16 |
HanySalah |
//
|
| 2 |
|
|
//------------------------------------------------------------------------------
|
| 3 |
|
|
// Copyright 2007-2011 Mentor Graphics Corporation
|
| 4 |
|
|
// Copyright 2007-2010 Cadence Design Systems, Inc.
|
| 5 |
|
|
// Copyright 2010 Synopsys, Inc.
|
| 6 |
|
|
// All Rights Reserved Worldwide
|
| 7 |
|
|
//
|
| 8 |
|
|
// Licensed under the Apache License, Version 2.0 (the
|
| 9 |
|
|
// "License"); you may not use this file except in
|
| 10 |
|
|
// compliance with the License. You may obtain a copy of
|
| 11 |
|
|
// the License at
|
| 12 |
|
|
//
|
| 13 |
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
| 14 |
|
|
//
|
| 15 |
|
|
// Unless required by applicable law or agreed to in
|
| 16 |
|
|
// writing, software distributed under the License is
|
| 17 |
|
|
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
| 18 |
|
|
// CONDITIONS OF ANY KIND, either express or implied. See
|
| 19 |
|
|
// the License for the specific language governing
|
| 20 |
|
|
// permissions and limitations under the License.
|
| 21 |
|
|
//------------------------------------------------------------------------------
|
| 22 |
|
|
|
| 23 |
|
|
typedef class uvm_sequence_item;
|
| 24 |
|
|
|
| 25 |
|
|
//------------------------------------------------------------------------------
|
| 26 |
|
|
//
|
| 27 |
|
|
// CLASS: uvm_driver #(REQ,RSP)
|
| 28 |
|
|
//
|
| 29 |
|
|
// The base class for drivers that initiate requests for new transactions via
|
| 30 |
|
|
// a uvm_seq_item_pull_port. The ports are typically connected to the exports of
|
| 31 |
|
|
// an appropriate sequencer component.
|
| 32 |
|
|
//
|
| 33 |
|
|
// This driver operates in pull mode. Its ports are typically connected to the
|
| 34 |
|
|
// corresponding exports in a pull sequencer as follows:
|
| 35 |
|
|
//
|
| 36 |
|
|
//| driver.seq_item_port.connect(sequencer.seq_item_export);
|
| 37 |
|
|
//| driver.rsp_port.connect(sequencer.rsp_export);
|
| 38 |
|
|
//
|
| 39 |
|
|
// The ~rsp_port~ needs connecting only if the driver will use it to write
|
| 40 |
|
|
// responses to the analysis export in the sequencer.
|
| 41 |
|
|
//
|
| 42 |
|
|
//------------------------------------------------------------------------------
|
| 43 |
|
|
|
| 44 |
|
|
class uvm_driver #(type REQ=uvm_sequence_item,
|
| 45 |
|
|
type RSP=REQ) extends uvm_component;
|
| 46 |
|
|
|
| 47 |
|
|
|
| 48 |
|
|
// Port: seq_item_port
|
| 49 |
|
|
//
|
| 50 |
|
|
// Derived driver classes should use this port to request items from the
|
| 51 |
|
|
// sequencer. They may also use it to send responses back.
|
| 52 |
|
|
|
| 53 |
|
|
uvm_seq_item_pull_port #(REQ, RSP) seq_item_port;
|
| 54 |
|
|
|
| 55 |
|
|
uvm_seq_item_pull_port #(REQ, RSP) seq_item_prod_if; // alias
|
| 56 |
|
|
|
| 57 |
|
|
// Port: rsp_port
|
| 58 |
|
|
//
|
| 59 |
|
|
// This port provides an alternate way of sending responses back to the
|
| 60 |
|
|
// originating sequencer. Which port to use depends on which export the
|
| 61 |
|
|
// sequencer provides for connection.
|
| 62 |
|
|
|
| 63 |
|
|
uvm_analysis_port #(RSP) rsp_port;
|
| 64 |
|
|
|
| 65 |
|
|
REQ req;
|
| 66 |
|
|
RSP rsp;
|
| 67 |
|
|
|
| 68 |
|
|
// Function: new
|
| 69 |
|
|
//
|
| 70 |
|
|
// Creates and initializes an instance of this class using the normal
|
| 71 |
|
|
// constructor arguments for : ~name~ is the name of the
|
| 72 |
|
|
// instance, and ~parent~ is the handle to the hierarchical parent, if any.
|
| 73 |
|
|
|
| 74 |
|
|
function new (string name, uvm_component parent);
|
| 75 |
|
|
super.new(name, parent);
|
| 76 |
|
|
seq_item_port = new("seq_item_port", this);
|
| 77 |
|
|
rsp_port = new("rsp_port", this);
|
| 78 |
|
|
seq_item_prod_if = seq_item_port;
|
| 79 |
|
|
endfunction // new
|
| 80 |
|
|
|
| 81 |
|
|
const static string type_name = "uvm_driver #(REQ,RSP)";
|
| 82 |
|
|
|
| 83 |
|
|
virtual function string get_type_name ();
|
| 84 |
|
|
return type_name;
|
| 85 |
|
|
endfunction
|
| 86 |
|
|
|
| 87 |
|
|
endclass
|
| 88 |
|
|
|