1 |
16 |
HanySalah |
//
|
2 |
|
|
//------------------------------------------------------------------------------
|
3 |
|
|
// Copyright 2007-2011 Mentor Graphics Corporation
|
4 |
|
|
// Copyright 2007-2011 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 |
|
|
//------------------------------------------------------------------------------
|
24 |
|
|
//
|
25 |
|
|
// CLASS: uvm_push_driver #(REQ,RSP)
|
26 |
|
|
//
|
27 |
|
|
// Base class for a driver that passively receives transactions, i.e. does not
|
28 |
|
|
// initiate requests transactions. Also known as ~push~ mode. Its ports are
|
29 |
|
|
// typically connected to the corresponding ports in a push sequencer as follows:
|
30 |
|
|
//
|
31 |
|
|
//| push_sequencer.req_port.connect(push_driver.req_export);
|
32 |
|
|
//| push_driver.rsp_port.connect(push_sequencer.rsp_export);
|
33 |
|
|
//
|
34 |
|
|
// The ~rsp_port~ needs connecting only if the driver will use it to write
|
35 |
|
|
// responses to the analysis export in the sequencer.
|
36 |
|
|
//
|
37 |
|
|
//------------------------------------------------------------------------------
|
38 |
|
|
|
39 |
|
|
class uvm_push_driver #(type REQ=uvm_sequence_item,
|
40 |
|
|
type RSP=REQ) extends uvm_component;
|
41 |
|
|
|
42 |
|
|
// Port: req_export
|
43 |
|
|
//
|
44 |
|
|
// This export provides the blocking put interface whose default
|
45 |
|
|
// implementation produces an error. Derived drivers must override ~put~
|
46 |
|
|
// with an appropriate implementation (and not call super.put). Ports
|
47 |
|
|
// connected to this export will supply the driver with transactions.
|
48 |
|
|
|
49 |
|
|
uvm_blocking_put_imp #(REQ, uvm_push_driver #(REQ,RSP)) req_export;
|
50 |
|
|
|
51 |
|
|
// Port: rsp_port
|
52 |
|
|
//
|
53 |
|
|
// This analysis port is used to send response transactions back to the
|
54 |
|
|
// originating sequencer.
|
55 |
|
|
|
56 |
|
|
uvm_analysis_port #(RSP) rsp_port;
|
57 |
|
|
|
58 |
|
|
REQ req;
|
59 |
|
|
RSP rsp;
|
60 |
|
|
|
61 |
|
|
// Function: new
|
62 |
|
|
//
|
63 |
|
|
// Creates and initializes an instance of this class using the normal
|
64 |
|
|
// constructor arguments for : ~name~ is the name of the
|
65 |
|
|
// instance, and ~parent~ is the handle to the hierarchical parent, if any.
|
66 |
|
|
|
67 |
|
|
function new (string name, uvm_component parent);
|
68 |
|
|
super.new(name, parent);
|
69 |
|
|
req_export = new("req_export", this);
|
70 |
|
|
rsp_port = new("rsp_port", this);
|
71 |
|
|
endfunction
|
72 |
|
|
|
73 |
|
|
function void check_port_connections();
|
74 |
|
|
if (req_export.size() != 1)
|
75 |
|
|
uvm_report_fatal("Connection Error",
|
76 |
|
|
$sformatf("Must connect to seq_item_port(%0d)",
|
77 |
|
|
req_export.size()), UVM_NONE);
|
78 |
|
|
endfunction
|
79 |
|
|
|
80 |
|
|
virtual function void end_of_elaboration_phase(uvm_phase phase);
|
81 |
|
|
super.end_of_elaboration_phase(phase);
|
82 |
|
|
check_port_connections();
|
83 |
|
|
endfunction
|
84 |
|
|
|
85 |
|
|
virtual task put(REQ item);
|
86 |
|
|
uvm_report_fatal("UVM_PUSH_DRIVER", "Put task for push driver is not implemented", UVM_NONE);
|
87 |
|
|
endtask
|
88 |
|
|
|
89 |
|
|
const static string type_name = "uvm_push_driver #(REQ,RSP)";
|
90 |
|
|
|
91 |
|
|
virtual function string get_type_name ();
|
92 |
|
|
return type_name;
|
93 |
|
|
endfunction
|
94 |
|
|
|
95 |
|
|
endclass
|
96 |
|
|
|