00001 // $Id: a00300.html,v 1.1 2009/01/07 19:29:45 alex.marin Exp $ 00002 //---------------------------------------------------------------------- 00003 // Copyright 2007-2008 Mentor Graphics Corporation 00004 // Copyright 2007-2008 Cadence Design Systems, Inc. 00005 // All Rights Reserved Worldwide 00006 // 00007 // Licensed under the Apache License, Version 2.0 (the 00008 // "License"); you may not use this file except in 00009 // compliance with the License. You may obtain a copy of 00010 // the License at 00011 // 00012 // http://www.apache.org/licenses/LICENSE-2.0 00013 // 00014 // Unless required by applicable law or agreed to in 00015 // writing, software distributed under the License is 00016 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 00017 // CONDITIONS OF ANY KIND, either express or implied. See 00018 // the License for the specific language governing 00019 // permissions and limitations under the License. 00020 //---------------------------------------------------------------------- 00021 00022 00023 // 00024 // These IMP macros define implementations of the ovm_*_port, ovm_*_export, 00025 // and ovm_*_imp ports. 00026 // 00027 00028 00029 //--------------------------------------------------------------- 00030 // Macros for implementations of OVM ports and exports 00031 00032 /* 00033 `define BLOCKING_PUT_IMP(imp, TYPE, arg) \ 00034 task put (TYPE arg); \ 00035 if (m_imp_list.size()) == 0) begin \ 00036 ovm_report_error("Port Not Bound","Blocking put to unbound port will wait forever."); 00037 @imp; 00038 end 00039 if (bcast_mode) begin \ 00040 if (m_imp_list.size()) > 1) \ 00041 fork 00042 begin 00043 foreach (m_imp_list[index]) \ 00044 fork \ 00045 automatic int i = index; \ 00046 begin m_imp_list[i].put(arg); end \ 00047 join_none \ 00048 wait fork; \ 00049 end \ 00050 join \ 00051 else \ 00052 m_imp_list[0].put(arg); \ 00053 end \ 00054 else \ 00055 if (imp != null) \ 00056 imp.put(arg); \ 00057 endtask \ 00058 00059 `define NONBLOCKING_PUT_IMP(imp, TYPE, arg) \ 00060 function bit try_put(input TYPE arg); \ 00061 if (bcast_mode) begin \ 00062 if (!can_put()) \ 00063 return 0; \ 00064 foreach (m_imp_list[index]) \ 00065 void'(m_imp_list[index].try_put(arg)); \ 00066 return 1; \ 00067 end \ 00068 if (imp != null) \ 00069 return imp.try_put(arg)); \ 00070 return 0; \ 00071 endfunction \ 00072 \ 00073 function bit can_put(); \ 00074 if (bcast_mode) begin \ 00075 if (m_imp_list.size()) begin \ 00076 foreach (m_imp_list[index]) begin \ 00077 if (!m_imp_list[index].can_put() \ 00078 return 0; \ 00079 end \ 00080 return 1; \ 00081 end \ 00082 return 0; \ 00083 end \ 00084 if (imp != null) \ 00085 return imp.can_put(); \ 00086 return 0; \ 00087 endfunction 00088 00089 */ 00090 00091 //----------------------------------------------------------------------- 00092 // TLM imp implementations 00093 00094 `define BLOCKING_PUT_IMP(imp, TYPE, arg) \ 00095 task put (TYPE arg); \ 00096 imp.put(arg); \ 00097 endtask 00098 00099 `define NONBLOCKING_PUT_IMP(imp, TYPE, arg) \ 00100 function bit try_put (TYPE arg); \ 00101 return imp.try_put(arg); \ 00102 endfunction \ 00103 function bit can_put(); \ 00104 return imp.can_put(); \ 00105 endfunction 00106 00107 `define BLOCKING_GET_IMP(imp, TYPE, arg) \ 00108 task get (output TYPE arg); \ 00109 imp.get(arg); \ 00110 endtask 00111 00112 `define NONBLOCKING_GET_IMP(imp, TYPE, arg) \ 00113 function bit try_get (output TYPE arg); \ 00114 return imp.try_get(arg); \ 00115 endfunction \ 00116 function bit can_get(); \ 00117 return imp.can_get(); \ 00118 endfunction 00119 00120 `define BLOCKING_PEEK_IMP(imp, TYPE, arg) \ 00121 task peek (output TYPE arg); \ 00122 imp.peek(arg); \ 00123 endtask 00124 00125 `define NONBLOCKING_PEEK_IMP(imp, TYPE, arg) \ 00126 function bit try_peek (output TYPE arg); \ 00127 return imp.try_peek(arg); \ 00128 endfunction \ 00129 function bit can_peek(); \ 00130 return imp.can_peek(); \ 00131 endfunction 00132 00133 `define BLOCKING_TRANSPORT_IMP(imp, REQ, RSP, req_arg, rsp_arg) \ 00134 task transport (REQ req_arg, output RSP rsp_arg); \ 00135 imp.transport(req_arg, rsp_arg); \ 00136 endtask 00137 00138 `define NONBLOCKING_TRANSPORT_IMP(imp, REQ, RSP, req_arg, rsp_arg) \ 00139 function bit nb_transport (REQ req_arg, output RSP rsp_arg); \ 00140 return imp.nb_transport(req_arg, rsp_arg); \ 00141 endfunction 00142 00143 `define PUT_IMP(imp, TYPE, arg) \ 00144 `BLOCKING_PUT_IMP(imp, TYPE, arg) \ 00145 `NONBLOCKING_PUT_IMP(imp, TYPE, arg) 00146 00147 `define GET_IMP(imp, TYPE, arg) \ 00148 `BLOCKING_GET_IMP(imp, TYPE, arg) \ 00149 `NONBLOCKING_GET_IMP(imp, TYPE, arg) 00150 00151 `define PEEK_IMP(imp, TYPE, arg) \ 00152 `BLOCKING_PEEK_IMP(imp, TYPE, arg) \ 00153 `NONBLOCKING_PEEK_IMP(imp, TYPE, arg) 00154 00155 `define BLOCKING_GET_PEEK_IMP(imp, TYPE, arg) \ 00156 `BLOCKING_GET_IMP(imp, TYPE, arg) \ 00157 `BLOCKING_PEEK_IMP(imp, TYPE, arg) 00158 00159 `define NONBLOCKING_GET_PEEK_IMP(imp, TYPE, arg) \ 00160 `NONBLOCKING_GET_IMP(imp, TYPE, arg) \ 00161 `NONBLOCKING_PEEK_IMP(imp, TYPE, arg) 00162 00163 `define GET_PEEK_IMP(imp, TYPE, arg) \ 00164 `BLOCKING_GET_PEEK_IMP(imp, TYPE, arg) \ 00165 `NONBLOCKING_GET_PEEK_IMP(imp, TYPE, arg) 00166 00167 `define TRANSPORT_IMP(imp, REQ, RSP, req_arg, rsp_arg) \ 00168 `BLOCKING_TRANSPORT_IMP(imp, REQ, RSP, req_arg, rsp_arg) \ 00169 `NONBLOCKING_TRANSPORT_IMP(imp, REQ, RSP, req_arg, rsp_arg) 00170 00171 00172 00173 `define TLM_GET_TYPE_NAME(NAME) \ 00174 virtual function string get_type_name(); \ 00175 return NAME; \ 00176 endfunction 00177 00178 `define OVM_PORT_COMMON(MASK,TYPE_NAME) \ 00179 function new (string name, ovm_component parent, \ 00180 int min_size=1, int max_size=1); \ 00181 super.new (name, parent, OVM_PORT, min_size, max_size); \ 00182 m_if_mask = MASK; \ 00183 endfunction \ 00184 `TLM_GET_TYPE_NAME(TYPE_NAME) 00185 00186 `define OVM_SEQ_PORT(MASK,TYPE_NAME) \ 00187 function new (string name, ovm_component parent, \ 00188 int min_size=0, int max_size=1); \ 00189 super.new (name, parent, OVM_PORT, min_size, max_size); \ 00190 m_if_mask = MASK; \ 00191 endfunction \ 00192 `TLM_GET_TYPE_NAME(TYPE_NAME) 00193 00194 `define OVM_EXPORT_COMMON(MASK,TYPE_NAME) \ 00195 function new (string name, ovm_component parent, \ 00196 int min_size=1, int max_size=1); \ 00197 super.new (name, parent, OVM_EXPORT, min_size, max_size); \ 00198 m_if_mask = MASK; \ 00199 endfunction \ 00200 `TLM_GET_TYPE_NAME(TYPE_NAME) 00201 00202 `define OVM_IMP_COMMON(MASK,TYPE_NAME,IMP) \ 00203 local IMP m_imp; \ 00204 function new (string name, IMP imp); \ 00205 super.new (name, imp, OVM_IMPLEMENTATION, 1, 1); \ 00206 m_imp = imp; \ 00207 m_if_mask = MASK; \ 00208 endfunction \ 00209 `TLM_GET_TYPE_NAME(TYPE_NAME) 00210 00211 `define OVM_MS_IMP_COMMON(MASK,TYPE_NAME) \ 00212 local this_req_type m_req_imp; \ 00213 local this_rsp_type m_rsp_imp; \ 00214 function new (string name, this_imp_type imp, \ 00215 this_req_type req_imp = null, this_rsp_type rsp_imp = null); \ 00216 super.new (name, imp, OVM_IMPLEMENTATION, 1, 1); \ 00217 if(req_imp==null) $cast(req_imp, imp); \ 00218 if(rsp_imp==null) $cast(rsp_imp, imp); \ 00219 m_req_imp = req_imp; \ 00220 m_rsp_imp = rsp_imp; \ 00221 m_if_mask = MASK; \ 00222 endfunction \ 00223 `TLM_GET_TYPE_NAME(TYPE_NAME) 00224
![]() Intelligent Design Verification Project: OVM, Revision: 2.0.1 |
Copyright (c) 2008 Intelligent Design Verification. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included here: http://www.intelligentdv.com/licenses/fdl.txt |
![]() Doxygen Version: 1.5.5 Wed Jan 7 19:27:18 2009 |