tlm_ifs.svh

Go to the documentation of this file.
00001 // $Id: tlm__ifs_8svh-source.html,v 1.1 2008/10/07 21:54:53 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 // TLM Interfaces
00024 //
00025 
00026 // The unidirectional  TLM interfaces are divided into put, get and peek
00027 // interfaces, and blocking, nonblocking and combined interfaces.
00028 // 
00029 // A blocking call always succeeds, but may need to consume time to do
00030 // so. As a result, these  methods must be tasks
00031 //
00032 // A nonblocking call may not suceed, but consumes no time. As a result,
00033 // these methods are functions.
00034 //
00035 // The difference between get and peek is that get consumes the data
00036 // while peek does not. So successive calls to peek within the same
00037 // delta cycle are guaranteed to return the same value.
00038 //
00039 // The transport interface is a bidirectional blocking interface used
00040 // when the request and response are tightly coupled in a one to one
00041 // relationship.
00042 
00043 `define TASK_ERROR "TLM interface task not implemented"
00044 `define FUNCTION_ERROR "TLM interface function not implemented"
00045 
00046 virtual class tlm_if_base #(type T1=int, type T2=int) extends ovm_report_object;
00047 
00048   virtual task put( input T1 t );
00049     ovm_report_error("put", `TASK_ERROR);
00050   endtask
00051 
00052   virtual task get( output T2 t );
00053     ovm_report_error("get", `TASK_ERROR);
00054   endtask
00055 
00056   virtual task peek( output T2 t );
00057     ovm_report_error("peek", `TASK_ERROR);
00058   endtask
00059 
00060   virtual function bit try_put( input T1 t );
00061     ovm_report_error("try_put", `FUNCTION_ERROR);
00062     return 0;
00063   endfunction
00064 
00065   virtual function bit can_put();
00066     ovm_report_error("can_put", `FUNCTION_ERROR);
00067     return 0;
00068   endfunction
00069 
00070   virtual function bit try_get( output T2 t );
00071     ovm_report_error("try_get", `FUNCTION_ERROR);
00072     return 0;
00073   endfunction
00074 
00075   virtual function bit can_get();
00076     ovm_report_error("can_get", `FUNCTION_ERROR);
00077     return 0;
00078   endfunction
00079 
00080   virtual function bit try_peek( output T2 t );
00081     ovm_report_error("try_peek", `FUNCTION_ERROR);
00082     return 0;
00083   endfunction
00084 
00085   virtual function bit can_peek();
00086     ovm_report_error("can_ppeek", `FUNCTION_ERROR);
00087     return 0;
00088   endfunction
00089 
00090   virtual task transport( input T1 req , output T2 rsp );
00091     ovm_report_error("transport", `TASK_ERROR);
00092   endtask
00093 
00094   virtual function bit nb_transport(input T1 req, output T2 rsp);
00095     ovm_report_error("nb_transport", `FUNCTION_ERROR);
00096     return 0;
00097   endfunction
00098 
00099   virtual function void write( input T1 t );
00100     ovm_report_error("write", `FUNCTION_ERROR);
00101   endfunction
00102 
00103 endclass
00104 
00105 // blocking interfaces
00106 
00107 virtual class tlm_blocking_put_if #( type T = int ) extends tlm_if_base #(T, T);
00108   virtual task put( input T t );   endtask
00109 endclass
00110 `define TLM_BLOCKING_PUT_MASK (1<<0)
00111 
00112 virtual class tlm_blocking_get_if #( type T = int ) extends tlm_if_base #(T, T);
00113   virtual task get( output T t );  endtask
00114 endclass
00115 `define TLM_BLOCKING_GET_MASK (1<<1)
00116 
00117 virtual class tlm_blocking_peek_if #( type T = int ) extends tlm_if_base #(T, T);
00118   virtual task peek( output T t );  endtask
00119 endclass
00120 `define TLM_BLOCKING_PEEK_MASK (1<<2)
00121 
00122 virtual class tlm_blocking_get_peek_if #( type T = int ) extends tlm_if_base #(T, T);
00123    virtual task get( output T t );   endtask
00124    virtual task peek( output T t );  endtask
00125 endclass
00126 `define TLM_BLOCKING_GET_PEEK_MASK (`TLM_BLOCKING_GET_MASK | `TLM_BLOCKING_PEEK_MASK)
00127 
00128 // non blocking interfaces
00129 
00130 virtual class tlm_nonblocking_put_if #( type T = int ) extends tlm_if_base #(T, T);
00131 virtual function bit try_put( input T t ); return 0; endfunction
00132   virtual function bit can_put();          return 0; endfunction
00133 endclass
00134 `define TLM_NONBLOCKING_PUT_MASK (1<<3)
00135 
00136 virtual class tlm_nonblocking_get_if #( type T = int ) extends tlm_if_base #(T, T);
00137   virtual function bit try_get( output T t ); return 0; endfunction
00138 virtual function bit can_get();             return 0; endfunction
00139 endclass
00140 `define TLM_NONBLOCKING_GET_MASK (1<<4)
00141 
00142 virtual class tlm_nonblocking_peek_if #( type T = int ) extends tlm_if_base #(T, T);
00143   virtual function bit try_peek( output T t ); return 0; endfunction
00144   virtual function bit can_peek();             return 0; endfunction
00145 endclass
00146 `define TLM_NONBLOCKING_PEEK_MASK (1<<5)
00147 
00148 virtual class tlm_nonblocking_get_peek_if #( type T = int ) extends tlm_if_base #(T, T);
00149   virtual function bit try_get( output T t );  return 0; endfunction
00150   virtual function bit can_get();              return 0; endfunction
00151   virtual function bit try_peek( output T t ); return 0; endfunction
00152   virtual function bit can_peek();             return 0; endfunction
00153 endclass
00154 `define TLM_NONBLOCKING_GET_PEEK_MASK (`TLM_NONBLOCKING_GET_MASK | `TLM_NONBLOCKING_GET_MASK)
00155 
00156 // combined interfaces
00157 
00158 virtual class tlm_put_if #( type T = int ) extends tlm_if_base #(T, T);
00159   virtual task put( input T t );             endtask
00160   virtual function bit try_put( input T t ); return 0; endfunction
00161   virtual function bit can_put();            return 0; endfunction
00162 endclass
00163 `define TLM_PUT_MASK (`TLM_BLOCKING_PUT_MASK | `TLM_NONBLOCKING_PUT_MASK)
00164 
00165 virtual class tlm_get_if #( type T = int ) extends tlm_if_base #(T, T);
00166   virtual task get( output T t );             endtask
00167   virtual function bit try_get( output T t ); return 0; endfunction
00168   virtual function bit can_get();             return 0; endfunction
00169 endclass
00170 `define TLM_GET_MASK (`TLM_BLOCKING_GET_MASK | `TLM_NONBLOCKING_GET_MASK)
00171 
00172 virtual class tlm_peek_if #( type T = int ) extends tlm_if_base #(T, T);
00173   virtual task peek( output T t );             endtask
00174   virtual function bit try_peek( output T t ); return 0; endfunction
00175   virtual function bit can_peek();             return 0; endfunction
00176 endclass
00177 `define TLM_PEEK_MASK (`TLM_BLOCKING_PEEK_MASK | `TLM_NONBLOCKING_PEEK_MASK)
00178 
00179 virtual class tlm_get_peek_if #( type T = int ) extends tlm_if_base #(T, T);
00180   virtual task get( output T t );             endtask
00181   virtual function bit try_get( output T t ); return 0; endfunction
00182   virtual function bit can_get();             return 0; endfunction
00183 
00184   virtual task peek( output T t );  endtask
00185   virtual function bit try_peek( output T t ); return 0; endfunction
00186   virtual function bit can_peek(); return 0; endfunction
00187 endclass
00188 `define TLM_GET_PEEK_MASK (`TLM_GET_MASK | `TLM_PEEK_MASK)
00189 
00190 // bidirectional interfaces
00191 
00192 virtual class tlm_blocking_master_if #( type REQ = int ,
00193           type RSP = int ) extends tlm_if_base #(REQ, RSP);
00194   
00195   virtual task put( input REQ t );  endtask
00196   virtual task get( output RSP t );  endtask
00197   virtual task peek( output RSP t  );  endtask
00198 endclass
00199 `define TLM_BLOCKING_MASTER_MASK (`TLM_BLOCKING_GET_MASK | `TLM_BLOCKING_GET_MASK | `TLM_BLOCKING_PEEK_MASK)
00200 
00201 virtual class tlm_nonblocking_master_if #( type REQ = int,  type RSP = int )
00202   extends tlm_if_base #(REQ, RSP);
00203   
00204   virtual function bit try_put( input REQ t ); return 0; endfunction
00205   virtual function bit can_put(); return 0; endfunction
00206 
00207   virtual function bit try_get( output RSP t ); return 0; endfunction
00208   virtual function bit can_get(); return 0; endfunction
00209 
00210   virtual function bit try_peek( output RSP t ); return 0; endfunction
00211   virtual function bit can_peek(); return 0; endfunction
00212 endclass
00213 `define TLM_NONBLOCKING_MASTER_MASK (`TLM_NONBLOCKING_GET_MASK | `TLM_NONBLOCKING_GET_MASK | `TLM_NONBLOCKING_PEEK_MASK)
00214 
00215 virtual class tlm_master_if #( type REQ = int , type RSP = int )
00216   extends tlm_if_base #(REQ, RSP);
00217 
00218   virtual task put( REQ t );           endtask
00219   virtual function bit try_put( REQ t ); return 0; endfunction
00220   virtual function bit can_put(); return 0; endfunction
00221 
00222   virtual task get( output RSP t );                   endtask
00223   virtual function bit try_get( output RSP t ); return 0; endfunction
00224   virtual function bit can_get(); return 0; endfunction
00225 
00226   virtual task peek( output RSP t  );                 endtask
00227   virtual function bit try_peek( output RSP t ); return 0; endfunction
00228   virtual function bit can_peek(); return 0; endfunction
00229 endclass
00230 `define TLM_MASTER_MASK (`TLM_BLOCKING_MASTER_MASK | `TLM_NONBLOCKING_MASTER_MASK)
00231 
00232 virtual class tlm_blocking_slave_if #( type REQ = int ,
00233                type RSP = int ) extends tlm_if_base #(RSP, REQ);
00234   
00235   virtual task put( RSP t );           endtask
00236   virtual task get( output REQ t );    endtask
00237   virtual task peek( output REQ t  );  endtask
00238 endclass
00239 `define TLM_BLOCKING_SLAVE_MASK (`TLM_BLOCKING_GET_MASK | `TLM_BLOCKING_GET_MASK | `TLM_BLOCKING_PEEK_MASK)
00240 
00241 virtual class tlm_nonblocking_slave_if #( type REQ = int ,
00242                                           type RSP = int )
00243   extends tlm_if_base #(RSP, REQ);
00244   
00245   virtual function bit try_put( RSP t ); return 0; endfunction
00246   virtual function bit can_put(); return 0; endfunction
00247 
00248   virtual function bit try_get( output REQ t ); return 0; endfunction
00249   virtual function bit can_get(); return 0; endfunction
00250 
00251   virtual function bit try_peek( output REQ t ); return 0; endfunction
00252   virtual function bit can_peek(); return 0; endfunction
00253 endclass
00254 `define TLM_NONBLOCKING_SLAVE_MASK (`TLM_NONBLOCKING_GET_MASK | `TLM_NONBLOCKING_GET_MASK | `TLM_NONBLOCKING_PEEK_MASK)
00255 
00256 virtual class tlm_slave_if #( type REQ = int ,
00257                               type RSP = int )
00258   extends tlm_if_base #(RSP, REQ);
00259   
00260   virtual task put( input RSP t );  endtask
00261   virtual function bit try_put( input RSP t ); return 0; endfunction
00262   virtual function bit can_put(); return 0; endfunction
00263 
00264   virtual task get( output REQ t );  endtask
00265   virtual function bit try_get( output REQ t ); return 0; endfunction
00266   virtual function bit can_get(); return 0; endfunction
00267 
00268   virtual task peek( output REQ t  );  endtask
00269   virtual function bit try_peek( output REQ t ); return 0; endfunction
00270   virtual function bit can_peek(); return 0; endfunction
00271 endclass
00272 `define TLM_SLAVE_MASK (`TLM_BLOCKING_MASTER_MASK | `TLM_NONBLOCKING_MASTER_MASK)
00273 
00274 virtual class tlm_blocking_transport_if #( type REQ = int , type RSP = int )
00275   extends tlm_if_base #(REQ, RSP);
00276   
00277   virtual task transport( input REQ request, output RSP response );
00278   endtask
00279 
00280 endclass
00281 `define TLM_BLOCKING_TRANSPORT_MASK (1<<6)
00282 
00283 virtual class tlm_nonblocking_transport_if #( type REQ = int , type RSP = int )
00284   extends tlm_if_base #(REQ, RSP);
00285   
00286   virtual function bit nb_transport( input REQ req, output RSP rsp );
00287     return 0;
00288   endfunction
00289 
00290 endclass
00291 `define TLM_NONBLOCKING_TRANSPORT_MASK (1<<7)
00292 
00293 virtual class tlm_transport_if #( type REQ = int , type RSP = int )
00294   extends tlm_if_base #(REQ, RSP);
00295   
00296   virtual task transport( input REQ req, output RSP rsp );
00297   endtask
00298 
00299   virtual function bit nb_transport( input REQ req, output RSP rsp );
00300     return 0;
00301   endfunction
00302 
00303 endclass
00304 `define TLM_TRANSPORT_MASK (`TLM_BLOCKING_TRANSPORT_MASK | `TLM_NONBLOCKING_TRANSPORT_MASK)
00305 
00306 // The analysis interface allows no negotiation on the part of the
00307 // implementor of the write method.
00308 //
00309 // The implementor must implement write, and implement it with no waits
00310 // since it is a function.
00311 //
00312 // The analysis interface is used in analysis_port to connect monitors
00313 // to scoreboards and coverage objects
00314 
00315 virtual class analysis_if #( type T = int ) extends tlm_if_base #(T, T);
00316   virtual function void write( input T t ); endfunction
00317 endclass
00318 `define TLM_ANALYSIS_MASK (1<<7)
00319 

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:20:12 2008
Find a documentation bug? Report bugs to: bugs.intelligentdv.com Project: DoxygenFilterSV