| 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 |
|
|
`define UVM_TLM_FIFO_TASK_ERROR "fifo channel task not implemented"
|
| 24 |
|
|
`define UVM_TLM_FIFO_FUNCTION_ERROR "fifo channel function not implemented"
|
| 25 |
|
|
|
| 26 |
|
|
class uvm_tlm_event;
|
| 27 |
|
|
event trigger;
|
| 28 |
|
|
endclass
|
| 29 |
|
|
|
| 30 |
|
|
//------------------------------------------------------------------------------
|
| 31 |
|
|
//
|
| 32 |
|
|
// CLASS: uvm_tlm_fifo_base #(T)
|
| 33 |
|
|
//
|
| 34 |
|
|
// This class is the base for . It defines the TLM exports
|
| 35 |
|
|
// through which all transaction-based FIFO operations occur. It also defines
|
| 36 |
|
|
// default implementations for each interface method provided by these exports.
|
| 37 |
|
|
//
|
| 38 |
|
|
// The interface methods provided by the and the
|
| 39 |
|
|
// are defined and described by . See the TLM Overview
|
| 40 |
|
|
// section for a general discussion of TLM interface definition and usage.
|
| 41 |
|
|
//
|
| 42 |
|
|
// Parameter type
|
| 43 |
|
|
//
|
| 44 |
|
|
// T - The type of transactions to be stored by this FIFO.
|
| 45 |
|
|
//
|
| 46 |
|
|
//------------------------------------------------------------------------------
|
| 47 |
|
|
|
| 48 |
|
|
virtual class uvm_tlm_fifo_base #(type T=int) extends uvm_component;
|
| 49 |
|
|
|
| 50 |
|
|
typedef uvm_tlm_fifo_base #(T) this_type;
|
| 51 |
|
|
|
| 52 |
|
|
// Port: put_export
|
| 53 |
|
|
//
|
| 54 |
|
|
// The ~put_export~ provides both the blocking and non-blocking put interface
|
| 55 |
|
|
// methods to any attached port:
|
| 56 |
|
|
//
|
| 57 |
|
|
//| task put (input T t)
|
| 58 |
|
|
//| function bit can_put ()
|
| 59 |
|
|
//| function bit try_put (input T t)
|
| 60 |
|
|
//
|
| 61 |
|
|
// Any ~put~ port variant can connect and send transactions to the FIFO via this
|
| 62 |
|
|
// export, provided the transaction types match. See
|
| 63 |
|
|
// for more information on each of the above interface methods.
|
| 64 |
|
|
|
| 65 |
|
|
uvm_put_imp #(T, this_type) put_export;
|
| 66 |
|
|
|
| 67 |
|
|
|
| 68 |
|
|
// Port: get_peek_export
|
| 69 |
|
|
//
|
| 70 |
|
|
// The ~get_peek_export~ provides all the blocking and non-blocking get and peek
|
| 71 |
|
|
// interface methods:
|
| 72 |
|
|
//
|
| 73 |
|
|
//| task get (output T t)
|
| 74 |
|
|
//| function bit can_get ()
|
| 75 |
|
|
//| function bit try_get (output T t)
|
| 76 |
|
|
//| task peek (output T t)
|
| 77 |
|
|
//| function bit can_peek ()
|
| 78 |
|
|
//| function bit try_peek (output T t)
|
| 79 |
|
|
//
|
| 80 |
|
|
// Any ~get~ or ~peek~ port variant can connect to and retrieve transactions from
|
| 81 |
|
|
// the FIFO via this export, provided the transaction types match. See
|
| 82 |
|
|
// for more information on each of the above interface
|
| 83 |
|
|
// methods.
|
| 84 |
|
|
|
| 85 |
|
|
uvm_get_peek_imp #(T, this_type) get_peek_export;
|
| 86 |
|
|
|
| 87 |
|
|
|
| 88 |
|
|
// Port: put_ap
|
| 89 |
|
|
//
|
| 90 |
|
|
// Transactions passed via ~put~ or ~try_put~ (via any port connected to the
|
| 91 |
|
|
// ) are sent out this port via its ~write~ method.
|
| 92 |
|
|
//
|
| 93 |
|
|
//| function void write (T t)
|
| 94 |
|
|
//
|
| 95 |
|
|
// All connected analysis exports and imps will receive put transactions.
|
| 96 |
|
|
// See for more information on the ~write~ interface
|
| 97 |
|
|
// method.
|
| 98 |
|
|
|
| 99 |
|
|
uvm_analysis_port #(T) put_ap;
|
| 100 |
|
|
|
| 101 |
|
|
|
| 102 |
|
|
// Port: get_ap
|
| 103 |
|
|
//
|
| 104 |
|
|
// Transactions passed via ~get~, ~try_get~, ~peek~, or ~try_peek~ (via any
|
| 105 |
|
|
// port connected to the ) are sent out this port via its
|
| 106 |
|
|
// ~write~ method.
|
| 107 |
|
|
//
|
| 108 |
|
|
//| function void write (T t)
|
| 109 |
|
|
//
|
| 110 |
|
|
// All connected analysis exports and imps will receive get transactions.
|
| 111 |
|
|
// See for more information on the ~write~ method.
|
| 112 |
|
|
|
| 113 |
|
|
uvm_analysis_port #(T) get_ap;
|
| 114 |
|
|
|
| 115 |
|
|
|
| 116 |
|
|
// The following are aliases to the above put_export.
|
| 117 |
|
|
|
| 118 |
|
|
uvm_put_imp #(T, this_type) blocking_put_export;
|
| 119 |
|
|
uvm_put_imp #(T, this_type) nonblocking_put_export;
|
| 120 |
|
|
|
| 121 |
|
|
// The following are all aliased to the above get_peek_export, which provides
|
| 122 |
|
|
// the superset of these interfaces.
|
| 123 |
|
|
|
| 124 |
|
|
uvm_get_peek_imp #(T, this_type) blocking_get_export;
|
| 125 |
|
|
uvm_get_peek_imp #(T, this_type) nonblocking_get_export;
|
| 126 |
|
|
uvm_get_peek_imp #(T, this_type) get_export;
|
| 127 |
|
|
|
| 128 |
|
|
uvm_get_peek_imp #(T, this_type) blocking_peek_export;
|
| 129 |
|
|
uvm_get_peek_imp #(T, this_type) nonblocking_peek_export;
|
| 130 |
|
|
uvm_get_peek_imp #(T, this_type) peek_export;
|
| 131 |
|
|
|
| 132 |
|
|
uvm_get_peek_imp #(T, this_type) blocking_get_peek_export;
|
| 133 |
|
|
uvm_get_peek_imp #(T, this_type) nonblocking_get_peek_export;
|
| 134 |
|
|
|
| 135 |
|
|
|
| 136 |
|
|
// Function: new
|
| 137 |
|
|
//
|
| 138 |
|
|
// The ~name~ and ~parent~ are the normal uvm_component constructor arguments.
|
| 139 |
|
|
// The ~parent~ should be ~null~ if the uvm_tlm_fifo is going to be used in a
|
| 140 |
|
|
// statically elaborated construct (e.g., a module). The ~size~ indicates the
|
| 141 |
|
|
// maximum size of the FIFO. A value of zero indicates no upper bound.
|
| 142 |
|
|
|
| 143 |
|
|
function new(string name, uvm_component parent = null);
|
| 144 |
|
|
super.new(name, parent);
|
| 145 |
|
|
|
| 146 |
|
|
put_export = new("put_export", this);
|
| 147 |
|
|
blocking_put_export = put_export;
|
| 148 |
|
|
nonblocking_put_export = put_export;
|
| 149 |
|
|
|
| 150 |
|
|
get_peek_export = new("get_peek_export", this);
|
| 151 |
|
|
blocking_get_peek_export = get_peek_export;
|
| 152 |
|
|
nonblocking_get_peek_export = get_peek_export;
|
| 153 |
|
|
blocking_get_export = get_peek_export;
|
| 154 |
|
|
nonblocking_get_export = get_peek_export;
|
| 155 |
|
|
get_export = get_peek_export;
|
| 156 |
|
|
blocking_peek_export = get_peek_export;
|
| 157 |
|
|
nonblocking_peek_export = get_peek_export;
|
| 158 |
|
|
peek_export = get_peek_export;
|
| 159 |
|
|
|
| 160 |
|
|
put_ap = new("put_ap", this);
|
| 161 |
|
|
get_ap = new("get_ap", this);
|
| 162 |
|
|
|
| 163 |
|
|
endfunction
|
| 164 |
|
|
|
| 165 |
|
|
//turn off auto config
|
| 166 |
|
|
function void build_phase(uvm_phase phase);
|
| 167 |
|
|
build(); //for backward compat, won't cause auto-config
|
| 168 |
|
|
return;
|
| 169 |
|
|
endfunction
|
| 170 |
|
|
|
| 171 |
|
|
virtual function void flush();
|
| 172 |
|
|
uvm_report_error("flush", `UVM_TLM_FIFO_FUNCTION_ERROR, UVM_NONE);
|
| 173 |
|
|
endfunction
|
| 174 |
|
|
|
| 175 |
|
|
virtual function int size();
|
| 176 |
|
|
uvm_report_error("size", `UVM_TLM_FIFO_FUNCTION_ERROR, UVM_NONE);
|
| 177 |
|
|
return 0;
|
| 178 |
|
|
endfunction
|
| 179 |
|
|
|
| 180 |
|
|
virtual task put(T t);
|
| 181 |
|
|
uvm_report_error("put", `UVM_TLM_FIFO_TASK_ERROR, UVM_NONE);
|
| 182 |
|
|
endtask
|
| 183 |
|
|
|
| 184 |
|
|
virtual task get(output T t);
|
| 185 |
|
|
uvm_report_error("get", `UVM_TLM_FIFO_TASK_ERROR, UVM_NONE);
|
| 186 |
|
|
endtask
|
| 187 |
|
|
|
| 188 |
|
|
virtual task peek(output T t);
|
| 189 |
|
|
uvm_report_error("peek", `UVM_TLM_FIFO_TASK_ERROR, UVM_NONE);
|
| 190 |
|
|
endtask
|
| 191 |
|
|
|
| 192 |
|
|
virtual function bit try_put(T t);
|
| 193 |
|
|
uvm_report_error("try_put", `UVM_TLM_FIFO_FUNCTION_ERROR, UVM_NONE);
|
| 194 |
|
|
return 0;
|
| 195 |
|
|
endfunction
|
| 196 |
|
|
|
| 197 |
|
|
virtual function bit try_get(output T t);
|
| 198 |
|
|
uvm_report_error("try_get", `UVM_TLM_FIFO_FUNCTION_ERROR, UVM_NONE);
|
| 199 |
|
|
return 0;
|
| 200 |
|
|
endfunction
|
| 201 |
|
|
|
| 202 |
|
|
virtual function bit try_peek(output T t);
|
| 203 |
|
|
uvm_report_error("try_peek", `UVM_TLM_FIFO_FUNCTION_ERROR, UVM_NONE);
|
| 204 |
|
|
return 0;
|
| 205 |
|
|
endfunction
|
| 206 |
|
|
|
| 207 |
|
|
virtual function bit can_put();
|
| 208 |
|
|
uvm_report_error("can_put", `UVM_TLM_FIFO_FUNCTION_ERROR, UVM_NONE);
|
| 209 |
|
|
return 0;
|
| 210 |
|
|
endfunction
|
| 211 |
|
|
|
| 212 |
|
|
virtual function bit can_get();
|
| 213 |
|
|
uvm_report_error("can_get", `UVM_TLM_FIFO_FUNCTION_ERROR, UVM_NONE);
|
| 214 |
|
|
return 0;
|
| 215 |
|
|
endfunction
|
| 216 |
|
|
|
| 217 |
|
|
virtual function bit can_peek();
|
| 218 |
|
|
uvm_report_error("can_peek", `UVM_TLM_FIFO_FUNCTION_ERROR, UVM_NONE);
|
| 219 |
|
|
return 0;
|
| 220 |
|
|
endfunction
|
| 221 |
|
|
|
| 222 |
|
|
virtual function uvm_tlm_event ok_to_put();
|
| 223 |
|
|
uvm_report_error("ok_to_put", `UVM_TLM_FIFO_FUNCTION_ERROR, UVM_NONE);
|
| 224 |
|
|
return null;
|
| 225 |
|
|
endfunction
|
| 226 |
|
|
|
| 227 |
|
|
virtual function uvm_tlm_event ok_to_get();
|
| 228 |
|
|
uvm_report_error("ok_to_get", `UVM_TLM_FIFO_FUNCTION_ERROR, UVM_NONE);
|
| 229 |
|
|
return null;
|
| 230 |
|
|
endfunction
|
| 231 |
|
|
|
| 232 |
|
|
virtual function uvm_tlm_event ok_to_peek();
|
| 233 |
|
|
uvm_report_error("ok_to_peek", `UVM_TLM_FIFO_FUNCTION_ERROR, UVM_NONE);
|
| 234 |
|
|
return null;
|
| 235 |
|
|
endfunction
|
| 236 |
|
|
|
| 237 |
|
|
virtual function bit is_empty();
|
| 238 |
|
|
uvm_report_error("is_empty", `UVM_TLM_FIFO_FUNCTION_ERROR, UVM_NONE);
|
| 239 |
|
|
return 0;
|
| 240 |
|
|
endfunction
|
| 241 |
|
|
|
| 242 |
|
|
virtual function bit is_full();
|
| 243 |
|
|
uvm_report_error("is_full", `UVM_TLM_FIFO_FUNCTION_ERROR);
|
| 244 |
|
|
return 0;
|
| 245 |
|
|
endfunction
|
| 246 |
|
|
|
| 247 |
|
|
virtual function int used();
|
| 248 |
|
|
uvm_report_error("used", `UVM_TLM_FIFO_FUNCTION_ERROR, UVM_NONE);
|
| 249 |
|
|
return 0;
|
| 250 |
|
|
endfunction
|
| 251 |
|
|
|
| 252 |
|
|
endclass
|