tlm_defines.svh

Go to the documentation of this file.
00001 //----------------------------------------------------------------------
00002 //   Copyright 2007-2008 Mentor Graphics Corporation
00003 //   Copyright 2007-2008 Cadence Design Systems, Inc.
00004 //   All Rights Reserved Worldwide
00005 //
00006 //   Licensed under the Apache License, Version 2.0 (the
00007 //   "License"); you may not use this file except in
00008 //   compliance with the License.  You may obtain a copy of
00009 //   the License at
00010 //
00011 //       http://www.apache.org/licenses/LICENSE-2.0
00012 //
00013 //   Unless required by applicable law or agreed to in
00014 //   writing, software distributed under the License is
00015 //   distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
00016 //   CONDITIONS OF ANY KIND, either express or implied.  See
00017 //   the License for the specific language governing
00018 //   permissions and limitations under the License.
00019 //----------------------------------------------------------------------
00020 
00021 // The following macros: ovm_IF_imp_decl all users to create implemenation
00022 // classes which a predefined tlm interface but add a suffix to the 
00023 // implementation methods. This allows multiple interfaces of the same type
00024 // to be implemented in the same scope.
00025 //
00026 // For example:
00027 //
00028 // `ovm_blocking_put_imp_decl(_1)
00029 // `ovm_blocking_put_imp_decl(_2)
00030 // class my_put_imp#(type T=int) extends ovm_component;
00031 //    ovm_blocking_put_imp_1#(T) export1;
00032 //    ovm_blocking_put_imp_2#(T) export2;
00033 //    ...
00034 //    function void put_1 (input T t);
00035 //      //puts comming into export1
00036 //      ...
00037 //    endfunction
00038 //    function void put_2(input T t);
00039 //      //puts comming into export2
00040 //      ...
00041 //    endfunction
00042 // endclass
00043 
00044 // Note that the default, unsuffixed, implementations live in the file
00045 // tlm/ovm_imps.sv.
00046 
00047 `define ovm_blocking_put_imp_decl(SFX) \
00048 class ovm_blocking_put_imp``SFX #(type T=int, type IMP=int) \
00049   extends ovm_port_base #(tlm_if_base #(T,T)); \
00050   `OVM_IMP_COMMON(`TLM_BLOCKING_PUT_MASK,`"ovm_blocking_put_imp``SFX`",IMP) \
00051   `BLOCKING_PUT_IMP_SFX(SFX, m_imp, T, t) \
00052 endclass
00053 
00054 `define ovm_nonblocking_put_imp_decl(SFX) \
00055 class ovm_nonblocking_put_imp``SFX #(type T=int, type IMP=int) \
00056   extends ovm_port_base #(tlm_if_base #(T,T)); \
00057   `OVM_IMP_COMMON(`TLM_NONBLOCKING_PUT_MASK,`"ovm_nonblocking_put_imp``SFX`",IMP) \
00058   `NONBLOCKING_PUT_IMP_SFX( SFX, m_imp, T, t) \
00059 endclass
00060 
00061 `define ovm_put_imp_decl(SFX) \
00062 class ovm_put_imp #(type T=int, type IMP=int) \
00063   extends ovm_port_base #(tlm_if_base #(T,T)); \
00064   `OVM_IMP_COMMON(`TLM_PUT_MASK,`"ovm_put_imp``SFX`",IMP) \
00065   `PUT_IMP_SFX(SFX, m_imp, T, t) \
00066   `NONBLOCKING_PUT_IMP_SFX(SFX, m_imp, T, t) \
00067 endclass
00068 
00069 `define ovm_blocking_get_imp_decl(SFX) \
00070 class ovm_blocking_get_imp``SFX #(type T=int, type IMP=int) \
00071   extends ovm_port_base #(tlm_if_base #(T,T)); \
00072   `OVM_IMP_COMMON(`TLM_BLOCKING_GET_MASK,`"ovm_blocking_get_imp``SFX`",IMP) \
00073   `BLOCKING_GET_IMP_SFX(SFX, m_imp, T, t) \
00074 endclass
00075 
00076 `define ovm_nonblocking_get_imp_decl(SFX) \
00077 class ovm_nonblocking_get_imp``SFX #(type T=int, type IMP=int) \
00078   extends ovm_port_base #(tlm_if_base #(T,T)); \
00079   `OVM_IMP_COMMON(`TLM_NONBLOCKING_GET_MASK,`"ovm_nonblocking_get_imp``SFX`",IMP) \
00080   `NONBLOCKING_GET_IMP_SFX(SFX, m_imp, T, t) \
00081 endclass
00082 
00083 `define ovm_get_imp_decl(SFX) \
00084 class ovm_get_imp``SFX #(type T=int, type IMP=int) \
00085   extends ovm_port_base #(tlm_if_base #(T,T)); \
00086   `OVM_IMP_COMMON(`TLM_GET_MASK,`"ovm_get_imp``SFX`",IMP) \
00087   `BLOCKING_GET_IMP_SFX(SFX, m_imp, T, t) \
00088   `NONBLOCKING_GET_IMP_SFX(SFX, m_imp, T, t) \
00089 endclass
00090 
00091 `define ovm_blocking_peek_imp_decl(SFX) \
00092 class ovm_blocking_peek_imp``SFX #(type T=int, type IMP=int) \
00093   extends ovm_port_base #(tlm_if_base #(T,T)); \
00094   `OVM_IMP_COMMON(`TLM_BLOCKING_PEEK_MASK,`"ovm_blocking_peek_imp``SFX`",IMP) \
00095   `BLOCKING_PEEK_IMP_SFX(SFX, m_imp, T, t) \
00096 endclass 
00097 
00098 `define ovm_nonblocking_peek_imp_decl(SFX) \
00099 class ovm_nonblocking_peek_imp``SFX #(type T=int, type IMP=int) \
00100   extends ovm_port_base #(tlm_if_base #(T,T)); \
00101   `OVM_IMP_COMMON(`TLM_NONBLOCKING_PEEK_MASK,`"ovm_nonblocking_peek_imp``SFX`",IMP) \
00102   `NONBLOCKING_PEEK_IMP_SFX(SFX, m_imp, T, t) \
00103 endclass
00104 
00105 `define ovm_peek_imp_decl(SFX) \
00106 class ovm_peek_imp``SFX #(type T=int, type IMP=int) \
00107   extends ovm_port_base #(tlm_if_base #(T,T)); \
00108   `OVM_IMP_COMMON(`TLM_PEEK_MASK,`"ovm_peek_imp``SFX`",IMP) \
00109   `BLOCKING_PEEK_IMP_SFX(SFX, m_imp, T, t) \
00110   `NONBLOCKING_PEEK_IMP_SFX(SFX, m_imp, T, t) \
00111 endclass
00112 
00113 
00114 `define ovm_blocking_get_peek_imp_decl(SFX) \
00115 class ovm_blocking_get_peek_imp``SFX #(type T=int, type IMP=int) \
00116   extends ovm_port_base #(tlm_if_base #(T,T)); \
00117   `OVM_IMP_COMMON(`TLM_BLOCKING_GET_PEEK_MASK,`"ovm_blocking_get_peek_imp``SFX`",IMP) \
00118   `BLOCKING_GET_IMP_SFX(SFX, m_imp, T, t) \
00119   `BLOCKING_PEEK_IMP_SFX(SFX, m_imp, T, t) \
00120 endclass
00121 
00122 `define ovm_nonblocking_get_peek_imp_decl(SFX) \
00123 class ovm_nonblocking_get_peek_imp``SFX #(type T=int, type IMP=int) \
00124   extends ovm_port_base #(tlm_if_base #(T,T)); \
00125   `OVM_IMP_COMMON(`TLM_NONBLOCKING_GET_PEEK_MASK,`"ovm_nonblocking_get_peek_imp``SFX`",IMP) \
00126   `NONBLOCKING_GET_IMP_SFX(SFX, m_imp, T, t) \
00127   `NONBLOCKING_PEEK_IMP_SFX(SFX, m_imp, T, t) \
00128 endclass
00129 
00130 `define ovm_get_peek_imp_decl(SFX) \
00131 class ovm_get_peek_imp``SFX #(type T=int, type IMP=int) \
00132   extends ovm_port_base #(tlm_if_base #(T,T)); \
00133   `OVM_IMP_COMMON(`TLM_GET_PEEK_MASK,`"ovm_get_peek_imp``SFX`",IMP) \
00134   `BLOCKING_GET_IMP_SFX(SFX, m_imp, T, t) \
00135   `NONBLOCKING_GET_IMP_SFX(SFX, m_imp, T, t) \
00136   `BLOCKING_PEEK_IMP_SFX(SFX, m_imp, T, t) \
00137   `NONBLOCKING_PEEK_IMP_SFX(SFX, m_imp, T, t) \
00138 endclass
00139 
00140 `define ovm_blocking_master_imp_decl(SFX) \
00141 class ovm_blocking_master_imp``SFX #(type REQ=int, type RSP=int, type IMP=int, \
00142                                      type REQ_IMP=IMP, type RSP_IMP=IMP) \
00143   extends ovm_port_base #(tlm_if_base #(REQ, RSP)); \
00144   `OVM_MS_IMP_COMMON(`TLM_BLOCKING_MASTER_MASK,`"ovm_blocking_master_imp``SFX`") \
00145   \
00146   `BLOCKING_PUT_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
00147   \
00148   `BLOCKING_GET_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
00149   `BLOCKING_PEEK_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
00150   \
00151 endclass
00152 
00153 `define ovm_nonblocking_master_imp_decl(SFX) \
00154 class ovm_nonblocking_master_imp #(type REQ=int, type RSP=int, type IMP=int, \
00155                                    type REQ_IMP=IMP, type RSP_IMP=IMP) \
00156   extends ovm_port_base #(tlm_if_base #(REQ, RSP)); \
00157   `OVM_MS_IMP_COMMON(`TLM_NONBLOCKING_MASTER_MASK,`"ovm_nonblocking_master_imp``SFX`") \
00158   \
00159   `NONBLOCKING_PUT_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
00160   \
00161   `NONBLOCKING_GET_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
00162   `NONBLOCKING_PEEK_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
00163   \
00164 endclass
00165 
00166 `define ovm_master_imp_decl(SFX) \
00167 class ovm_master_imp``SFX #(type REQ=int, type RSP=int, type IMP=int, \
00168                             type REQ_IMP=IMP, type RSP_IMP=IMP) \
00169   extends ovm_port_base #(tlm_if_base #(REQ, RSP)); \
00170   `OVM_MS_IMP_COMMON(`TLM_MASTER_MASK,`"ovm_master_imp``SFX`") \
00171   \
00172   `BLOCKING_PUT_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
00173   `NONBLOCKING_PUT_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
00174   \
00175   `BLOCKING_GET_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
00176   `BLOCKING_PEEK_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
00177   `NONBLOCKING_GET_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
00178   `NONBLOCKING_PEEK_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
00179   \
00180 endclass
00181 
00182 `define ovm_blocking_slave_imp_decl(SFX) \
00183 class ovm_blocking_slave_imp``SFX #(type REQ=int, type RSP=int, type IMP=int, \
00184                                     type REQ_IMP=IMP, type RSP_IMP=IMP) \
00185   extends ovm_port_base #(tlm_if_base #(RSP, REQ)); \
00186   `OVM_MS_IMP_COMMON(`TLM_BLOCKING_SLAVE_MASK,`"ovm_blocking_slave_imp``SFX`") \
00187   \
00188   `BLOCKING_PUT_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
00189   \
00190   `BLOCKING_GET_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
00191   `BLOCKING_PEEK_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
00192   \
00193 endclass
00194 
00195 `define ovm_nonblocking_slave_imp_decl(SFX) \
00196 class ovm_nonblocking_slave_imp``SFX #(type REQ=int, type RSP=int, type IMP=int, \
00197                                        type REQ_IMP=IMP, type RSP_IMP=IMP) \
00198   extends ovm_port_base #(tlm_if_base #(RSP, REQ)); \
00199   `OVM_MS_IMP_COMMON(`TLM_NONBLOCKING_SLAVE_MASK,`"ovm_nonblocking_slave_imp``SFX`") \
00200   \
00201   `NONBLOCKING_PUT_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
00202   \
00203   `NONBLOCKING_GET_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
00204   `NONBLOCKING_PEEK_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
00205   \
00206 endclass
00207 
00208 `define ovm_slave_imp_decl(SFX) \
00209 class ovm_slave_imp``SFX #(type REQ=int, type RSP=int, type IMP=int, \
00210                            type REQ_IMP=IMP, type RSP_IMP=IMP) \
00211   extends ovm_port_base #(tlm_if_base #(RSP, REQ)); \
00212   `OVM_MS_IMP_COMMON(`TLM_SLAVE_MASK,`"ovm_slave_imp``SFX`") \
00213   \
00214   `BLOCKING_PUT_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
00215   `NONBLOCKING_PUT_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
00216   \
00217   `BLOCKING_GET_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
00218   `BLOCKING_PEEK_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
00219   `NONBLOCKING_GET_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
00220   `NONBLOCKING_PEEK_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
00221   \
00222 endclass
00223 
00224 `define ovm_blocking_transport_imp_decl(SFX) \
00225 class ovm_blocking_transport_imp``SFX #(type REQ=int, type RSP=int, type IMP=int) \
00226   extends ovm_port_base #(tlm_if_base #(REQ, RSP)); \
00227   `OVM_IMP_COMMON(`TLM_BLOCKING_TRANSPORT_MASK,`"ovm_blocking_transport_imp``SFX`",IMP) \
00228   `BLOCKING_TRANSPORT_IMP``SFX(SFX, m_imp, REQ, RSP, req, rsp) \
00229 endclass
00230 
00231 `define ovm_non_blocking_transport_imp_decl(SFX) \
00232 class ovm_nonblocking_transport_imp``SFX #(type REQ=int, type RSP=int, type IMP=int) \
00233   extends ovm_port_base #(tlm_if_base #(REQ, RSP)); \
00234   `OVM_IMP_COMMON(`TLM_NONBLOCKING_TRANSPORT_MASK,`"ovm_nonblocking_transport_imp``SFX`",IMP) \
00235   `NONBLOCKING_TRANSPORT_IMP_SFX(SFX, m_imp, REQ, RSP, req, rsp) \
00236 endclass
00237 
00238 `define ovm_transport_imp_decl(SFX) \
00239 class ovm_transport_imp`SFX #(type REQ=int, type RSP=int, type IMP=int) \
00240   extends ovm_port_base #(tlm_if_base #(REQ, RSP)); \
00241   `OVM_IMP_COMMON(`TLM_TRANSPORT_MASK,`"ovm_transport_imp``SFX`",IMP) \
00242   `BLOCKING_TRANSPORT_IMP_SFX(SFX, m_imp, REQ, RSP, req, rsp) \
00243   `NONBLOCKING_TRANSPORT_IMP_SFX(SFX, m_imp, REQ, RSP, req, rsp) \
00244 endclass
00245 
00246 `define ovm_analysis_imp_decl(SFX) \
00247 class ovm_analysis_imp``SFX #(type T=int, type IMP=int) \
00248   extends ovm_port_base #(tlm_if_base #(T,T)); \
00249   `OVM_IMP_COMMON(`TLM_ANALYSIS_MASK,`"ovm_analysis_imp``SFX`",IMP) \
00250   function void write( input T t); \
00251     m_imp.write``SFX( t); \
00252   endfunction \
00253   \
00254 endclass
00255 
00256 
00257 // These imps are used in ovm_*_port, ovm_*_export and ovm_*_imp, using suffixes
00258 //
00259 
00260 `define BLOCKING_PUT_IMP_SFX(SFX, imp, TYPE, arg) \
00261   task put( input TYPE arg); imp.put``SFX( arg); endtask
00262 
00263 `define BLOCKING_GET_IMP_SFX(SFX, imp, TYPE, arg) \
00264   task get( output TYPE arg); imp.get``SFX( arg); endtask
00265 
00266 `define BLOCKING_PEEK_IMP_SFX(SFX, imp, TYPE, arg) \
00267   task peek( output TYPE arg);imp.peek``SFX( arg); endtask
00268 
00269 `define NONBLOCKING_PUT_IMP_SFX(SFX, imp, TYPE, arg) \
00270   function bit try_put( input TYPE arg); \
00271     if( !imp.try_put``SFX( arg)) return 0; \
00272     return 1; \
00273   endfunction \
00274   function bit can_put(); return imp.can_put``SFX(); endfunction
00275 
00276 `define NONBLOCKING_GET_IMP_SFX(SFX, imp, TYPE, arg) \
00277   function bit try_get( output TYPE arg); \
00278     if( !imp.try_get``SFX( arg)) return 0; \
00279     return 1; \
00280   endfunction \
00281   function bit can_get(); return imp.can_get``SFX(); endfunction
00282 
00283 `define NONBLOCKING_PEEK_IMP_SFX(SFX, imp, TYPE, arg) \
00284   function bit try_peek( output TYPE arg); \
00285     if( !imp.try_peek``SFX( arg)) return 0; \
00286     return 1; \
00287   endfunction \
00288   function bit can_peek(); return imp.can_peek``SFX(); endfunction
00289 
00290 `define BLOCKING_TRANSPORT_IMP_SFX(SFX, imp, REQ, RSP, req_arg, rsp_arg) \
00291   task transport( input REQ req_arg, output RSP rsp_arg); \
00292     imp.transport``SFX(req_arg, rsp_arg); \
00293   endtask
00294 
00295 `define NONBLOCKING_TRANSPORT_IMP_SFX(SFX, imp, REQ, RSP, req_arg, rsp_arg) \
00296   function void nb_transport( input REQ req_arg, output RSP rsp_arg); \
00297     if(imp) imp.nb_transport``SFX(req_arg, rsp_arg); \
00298   endfunction
00299 

Intelligent Design Verification
Intelligent Design Verification
Project: OVM, Revision: 1.1.0
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
Doxygen Version: 1.4.6
Mon Sep 29 14:23:30 2008
Find a documentation bug? Report bugs to: bugs.intelligentdv.com Project: DoxygenFilterSV