ovm_ports.svh

Go to the documentation of this file.
00001 // $Id: ovm__ports_8svh-source.html,v 1.1 2008/10/07 21:54:47 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 // These classes REQUIRE a number of identical tlm interfaces for use in 
00024 // some IP
00025 //
00026 // For each tlm interface, there is a corresponding ovm_<if>_port.
00027 //
00028 // They all inherit from ovm_port_base< if > and implement if
00029 //
00030 // They implement if so that we can do things like p.put( t ),
00031 // p.get( p ) and p.peek( p ).
00032 //
00033 // In the case of a multiport, we need to use lookup_indexed_if eg :
00034 //
00035 // p.lookup_indexed_if( 3 ).put( t );
00036 //
00037 
00038 class ovm_blocking_put_port #( type T = int )
00039   extends ovm_port_base #( tlm_if_base #(T,T) );
00040   
00041   function new( string name , ovm_component parent ,
00042       int min_size = 1 , int max_size = 1 );
00043     
00044     super.new( name , parent ,
00045           OVM_PORT , 
00046           min_size , max_size );
00047     m_if_mask = `TLM_BLOCKING_PUT_MASK;
00048     m_if_name = "tlm_blocking_put";
00049 
00050   endfunction
00051   
00052   `BLOCKING_PUT_IMP( this.m_if , T , t )
00053 
00054 endclass 
00055 
00056 class ovm_nonblocking_put_port #( type T = int )
00057   extends ovm_port_base #( tlm_if_base #(T,T) );
00058   
00059   function new( string name , ovm_component parent ,
00060       int min_size = 1 , int max_size = 1 );
00061     
00062     super.new( name , parent ,
00063           OVM_PORT , 
00064           min_size , max_size );
00065     m_if_mask = `TLM_NONBLOCKING_PUT_MASK;
00066     m_if_name = "tlm_nonblocking_put";
00067 
00068   endfunction
00069   
00070   `NONBLOCKING_PUT_IMP( this.m_if , T , t )
00071 
00072 endclass
00073 
00074 class ovm_put_port #( type T = int )
00075   extends ovm_port_base #( tlm_if_base #(T,T) );
00076   
00077   function new( string name , ovm_component parent ,
00078       int min_size = 1 , int max_size = 1 );
00079     
00080     super.new( name , parent ,
00081           OVM_PORT ,
00082           min_size , max_size );
00083     m_if_mask = `TLM_PUT_MASK;  
00084     m_if_name = "tlm_put";
00085 
00086   endfunction
00087   
00088   `NONBLOCKING_PUT_IMP( this.m_if , T , t )
00089   `BLOCKING_PUT_IMP( this.m_if , T , t )
00090 
00091 endclass
00092 
00093 class ovm_blocking_get_port #( type T = int )
00094   extends ovm_port_base #( tlm_if_base #(T,T) );
00095   
00096   function new( string name , ovm_component parent ,
00097       int min_size = 1 , int max_size = 1 );
00098     
00099     super.new( name , parent ,
00100           OVM_PORT ,
00101           min_size , max_size );
00102     m_if_mask = `TLM_BLOCKING_GET_MASK;  
00103     m_if_name = "tlm_blocking_get";
00104  
00105   endfunction
00106   
00107   `BLOCKING_GET_IMP( this.m_if , T , t )
00108 
00109 endclass 
00110 
00111 class ovm_nonblocking_get_port #( type T = int )
00112   extends ovm_port_base #( tlm_if_base #(T,T) );
00113   
00114   function new( string name , ovm_component parent ,
00115       int min_size = 1 , int max_size = 1 );
00116     
00117     super.new( name , parent ,
00118           OVM_PORT ,
00119           min_size , max_size );
00120     m_if_mask = `TLM_NONBLOCKING_GET_MASK;  
00121     m_if_name = "tlm_nonblocking_get";
00122 
00123   endfunction
00124   
00125   `NONBLOCKING_GET_IMP( this.m_if , T , t )
00126 
00127 endclass
00128 
00129 class ovm_get_port #( type T = int )
00130   extends ovm_port_base #( tlm_if_base #(T,T) );
00131   
00132   function new( string name , ovm_component parent ,
00133       int min_size = 1 , int max_size = 1 );
00134 
00135     super.new( name , parent ,
00136           OVM_PORT ,
00137           min_size , max_size );
00138     m_if_mask = `TLM_GET_MASK;  
00139     m_if_name = "tlm_get";
00140 
00141   endfunction
00142   
00143   `NONBLOCKING_GET_IMP( this.m_if , T , t )
00144   `BLOCKING_GET_IMP( this.m_if , T , t )
00145 
00146 endclass 
00147 
00148 class ovm_blocking_peek_port #( type T = int )
00149   extends ovm_port_base #( tlm_if_base #(T,T) );
00150   
00151   function new( string name , ovm_component parent ,
00152       int min_size = 1 , int max_size = 1 );
00153     
00154     super.new( name , parent ,
00155           OVM_PORT ,
00156           min_size , max_size );
00157     m_if_mask = `TLM_BLOCKING_PEEK_MASK;  
00158     m_if_name = "tlm_blocking_peek";
00159  
00160   endfunction
00161   
00162   `BLOCKING_PEEK_IMP( this.m_if , T , t )
00163 
00164 endclass 
00165 
00166 class ovm_nonblocking_peek_port #( type T = int )
00167   extends ovm_port_base #( tlm_if_base #(T,T) );
00168   
00169   function new( string name , ovm_component parent ,
00170       int min_size = 1 , int max_size = 1 );
00171     
00172     super.new( name , parent ,
00173           OVM_PORT ,
00174           min_size , max_size );
00175     m_if_mask = `TLM_NONBLOCKING_PEEK_MASK;  
00176     m_if_name = "tlm_nonblocking_peek";
00177 
00178   endfunction
00179   
00180   `NONBLOCKING_PEEK_IMP( this.m_if , T , t )
00181 
00182 endclass
00183 
00184 class ovm_peek_port #( type T = int )
00185   extends ovm_port_base #( tlm_if_base #(T,T) );
00186   
00187   function new( string name , ovm_component parent ,
00188       int min_size = 1 , int max_size = 1 );
00189 
00190     super.new( name , parent ,
00191           OVM_PORT ,
00192           min_size , max_size );
00193     m_if_mask = `TLM_PEEK_MASK;  
00194     m_if_name = "tlm_peek";
00195 
00196   endfunction
00197   
00198   `NONBLOCKING_PEEK_IMP( this.m_if , T , t )
00199   `BLOCKING_PEEK_IMP( this.m_if , T , t )
00200 
00201 endclass 
00202 
00203 
00204 class ovm_blocking_get_peek_port #( type T = int )
00205   extends ovm_port_base #( tlm_if_base #(T,T) );
00206   
00207   function new( string name , ovm_component parent ,
00208       int min_size = 1 , int max_size = 1 );
00209     
00210     super.new( name , parent ,
00211           OVM_PORT ,
00212           min_size , max_size );
00213     m_if_mask = `TLM_BLOCKING_GET_PEEK_MASK;  
00214     m_if_name = "tlm_blocking_get_peek";
00215 
00216   endfunction
00217   
00218   `BLOCKING_GET_IMP( this.m_if , T , t )
00219   `BLOCKING_PEEK_IMP( this.m_if , T , t )
00220 
00221 endclass 
00222 
00223 class ovm_nonblocking_get_peek_port #( type T = int )
00224   extends ovm_port_base #( tlm_if_base #(T,T) );
00225   
00226   function new( string name , ovm_component parent ,
00227       int min_size = 1 , int max_size = 1 );
00228     
00229     super.new( name , parent ,
00230           OVM_PORT ,
00231           min_size , max_size );
00232     m_if_mask = `TLM_NONBLOCKING_GET_PEEK_MASK;  
00233     m_if_name = "tlm_nonblocking_get_peek";
00234 
00235   endfunction
00236   
00237   `NONBLOCKING_GET_IMP( this.m_if , T , t )
00238   `NONBLOCKING_PEEK_IMP( this.m_if , T , t )
00239 
00240 endclass
00241 
00242 class ovm_get_peek_port #( type T = int )
00243   extends ovm_port_base #( tlm_if_base #(T,T) );
00244   
00245   function new( string name , ovm_component parent ,
00246       int min_size = 1 , int max_size = 1 );
00247     
00248     super.new( name , parent ,
00249           OVM_PORT ,
00250           min_size , max_size );
00251     m_if_mask = `TLM_GET_PEEK_MASK;  
00252     m_if_name = "tlm_get_peek";
00253 
00254   endfunction
00255   
00256   `NONBLOCKING_GET_IMP( this.m_if , T , t )
00257   `BLOCKING_GET_IMP( this.m_if , T , t )
00258   
00259   `NONBLOCKING_PEEK_IMP( this.m_if , T , t )
00260   `BLOCKING_PEEK_IMP( this.m_if , T , t )
00261 
00262 endclass 
00263 
00264 class ovm_blocking_master_port #( type REQ = int , type RSP = int )
00265   extends ovm_port_base #( tlm_if_base #(REQ, RSP) );
00266   
00267   function new( string name , ovm_component parent ,
00268       int min_size = 1 , int max_size = 1 );
00269 
00270     super.new( name , parent ,
00271           OVM_PORT ,
00272           min_size , max_size );
00273     m_if_mask = `TLM_BLOCKING_MASTER_MASK;  
00274     m_if_name = "tlm_blocking_master";
00275 
00276   endfunction
00277   
00278   `BLOCKING_PUT_IMP( this.m_if , REQ , t ) // req
00279 
00280   `BLOCKING_GET_IMP( this.m_if , RSP , t ) // rsp
00281   `BLOCKING_PEEK_IMP( this.m_if , RSP , t ) // rsp
00282 
00283 endclass 
00284 
00285 class ovm_nonblocking_master_port #( type REQ = int , type RSP = int )
00286   extends ovm_port_base #( tlm_if_base #(REQ, RSP) );
00287   
00288   function new( string name , ovm_component parent ,
00289       int min_size = 1 , int max_size = 1 );
00290 
00291     super.new( name , parent ,
00292           OVM_PORT ,
00293           min_size , max_size );
00294     m_if_mask = `TLM_NONBLOCKING_MASTER_MASK;  
00295     m_if_name = "tlm_nonblocking_master";
00296 
00297   endfunction
00298   
00299   `NONBLOCKING_PUT_IMP( this.m_if , REQ , t ) // req
00300 
00301   `NONBLOCKING_GET_IMP( this.m_if , RSP , t ) // rsp
00302   `NONBLOCKING_PEEK_IMP( this.m_if , RSP , t ) // rsp
00303 
00304 endclass 
00305 
00306 class ovm_master_port #( type REQ = int , type RSP = int )
00307   extends ovm_port_base #( tlm_if_base #(REQ, RSP) );
00308   
00309   function new( string name , ovm_component parent ,
00310       int min_size = 1 , int max_size = 1 );
00311     
00312     super.new( name , parent ,
00313           OVM_PORT ,
00314           min_size , max_size );
00315     m_if_mask = `TLM_MASTER_MASK;  
00316     m_if_name = "tlm_master";
00317 
00318   endfunction
00319   
00320   `BLOCKING_PUT_IMP( this.m_if , REQ , t ) // req
00321   `NONBLOCKING_PUT_IMP( this.m_if , REQ , t ) // req
00322 
00323   `BLOCKING_GET_IMP( this.m_if , RSP , t ) // rsp
00324   `BLOCKING_PEEK_IMP( this.m_if , RSP , t ) // rsp
00325   `NONBLOCKING_GET_IMP( this.m_if , RSP , t ) // rsp
00326   `NONBLOCKING_PEEK_IMP( this.m_if , RSP , t ) // rsp
00327 
00328 endclass
00329 
00330 class ovm_blocking_slave_port #( type REQ = int , type RSP = int )
00331   extends ovm_port_base #( tlm_if_base #(RSP, REQ) );
00332   
00333   function new( string name , ovm_component parent ,
00334       int min_size = 1 , int max_size = 1 );
00335     
00336     super.new( name , parent ,
00337           OVM_PORT ,
00338           min_size , max_size );
00339     m_if_mask = `TLM_BLOCKING_SLAVE_MASK;  
00340     m_if_name = "tlm_blocking_slave";
00341 
00342   endfunction
00343   
00344   `BLOCKING_PUT_IMP( this.m_if , RSP , t ) // rsp
00345 
00346   `BLOCKING_GET_IMP( this.m_if , REQ , t ) // req
00347   `BLOCKING_PEEK_IMP( this.m_if , REQ , t ) // req
00348 
00349 endclass 
00350 
00351 class ovm_nonblocking_slave_port #( type REQ = int , type RSP = int )
00352   extends ovm_port_base #( tlm_if_base #(RSP, REQ) );
00353   
00354   function new( string name , ovm_component parent ,
00355       int min_size = 1 , int max_size = 1 );
00356     
00357     super.new( name , parent ,
00358           OVM_PORT ,
00359           min_size , max_size );
00360     m_if_mask = `TLM_NONBLOCKING_SLAVE_MASK;  
00361     m_if_name = "tlm_nonblocking_slave";
00362 
00363   endfunction
00364   
00365   `NONBLOCKING_PUT_IMP( this.m_if , RSP , t ) // rsp
00366 
00367   `NONBLOCKING_GET_IMP( this.m_if , REQ , t ) // req
00368   `NONBLOCKING_PEEK_IMP( this.m_if , REQ , t ) // req
00369 
00370 endclass 
00371 
00372 class ovm_slave_port #( type REQ = int , type RSP = int )
00373   extends ovm_port_base #( tlm_if_base #(RSP, REQ) );
00374   
00375   function new( string name , ovm_component parent ,
00376       int min_size = 1 , int max_size = 1 );
00377     
00378     super.new( name , parent ,
00379           OVM_PORT ,
00380           min_size , max_size );
00381     m_if_mask = `TLM_SLAVE_MASK;  
00382     m_if_name = "tlm_slave";
00383 
00384   endfunction
00385   
00386   `BLOCKING_PUT_IMP( this.m_if , RSP , t ) // rsp
00387   `NONBLOCKING_PUT_IMP( this.m_if , RSP , t ) // rsp
00388 
00389   `BLOCKING_GET_IMP( this.m_if , REQ , t ) // req
00390   `BLOCKING_PEEK_IMP( this.m_if , REQ , t ) // req
00391   `NONBLOCKING_GET_IMP( this.m_if , REQ , t ) // req
00392   `NONBLOCKING_PEEK_IMP( this.m_if , REQ , t ) // req
00393 
00394 endclass
00395 
00396 class ovm_blocking_transport_port #( type REQ = int , type RSP = int )
00397   extends ovm_port_base #( tlm_if_base #(REQ, RSP) );
00398   
00399   function new( string name , ovm_component parent ,
00400       int min_size = 1 , int max_size = 1 );
00401     
00402     super.new( name , parent ,
00403           OVM_PORT ,
00404           min_size , max_size );
00405     m_if_mask = `TLM_BLOCKING_TRANSPORT_MASK;  
00406     m_if_name = "tlm_blocking_transport";
00407 
00408   endfunction
00409 
00410   `BLOCKING_TRANSPORT_IMP( this.m_if, REQ, RSP, req, rsp)
00411 
00412 endclass
00413 
00414 
00415 class ovm_nonblocking_transport_port #( type REQ = int , type RSP = int )
00416   extends ovm_port_base #( tlm_if_base #(REQ, RSP) );
00417   
00418   function new( string name , ovm_component parent ,
00419       int min_size = 1 , int max_size = 1 );
00420     
00421     super.new( name , parent ,
00422           OVM_PORT ,
00423           min_size , max_size );
00424     m_if_mask = `TLM_NONBLOCKING_TRANSPORT_MASK;  
00425     m_if_name = "tlm_nonblocking_transport";
00426 
00427   endfunction
00428 
00429   `NONBLOCKING_TRANSPORT_IMP( this.m_if, REQ, RSP, req, rsp)
00430 
00431 endclass
00432 
00433 class ovm_transport_port #( type REQ = int , type RSP = int )
00434   extends ovm_port_base #( tlm_if_base #(REQ, RSP) );
00435   
00436   function new( string name , ovm_component parent ,
00437       int min_size = 1 , int max_size = 1 );
00438     
00439     super.new( name , parent ,
00440           OVM_PORT ,
00441           min_size , max_size );
00442     m_if_mask = `TLM_TRANSPORT_MASK;  
00443     m_if_name = "tlm_transport";
00444 
00445   endfunction
00446 
00447   `BLOCKING_TRANSPORT_IMP( this.m_if, REQ, RSP, req, rsp)
00448   `NONBLOCKING_TRANSPORT_IMP( this.m_if, REQ, RSP, req, rsp)
00449 
00450 endclass
00451 
00452 
00453 class ovm_analysis_port #( type T = int )
00454   extends ovm_port_base #( tlm_if_base #(T,T) );
00455 
00456   typedef ovm_port_base #( tlm_if_base #(T,T) ) port_type;
00457 
00458   //
00459   // You must specify a parent - there is no default value
00460   //
00461   // In modules, the parent must be null
00462   //
00463   
00464   function new( string name , ovm_component parent );
00465     
00466     // check parent is 0 to facilitate hybrid
00467     super.new( name , parent ,
00468           OVM_PORT ,
00469           0 , OVM_UNBOUNDED_CONNECTIONS );
00470     m_if_mask = `TLM_ANALYSIS_MASK;  
00471     m_if_name = "tlm_analysis";
00472 
00473   endfunction
00474 
00475   //
00476   // analysis port differs from all other ports
00477   //
00478   // it broadcasts to ALL connections simultaneously, not one by one
00479   //
00480   
00481   function void write( input T t );
00482     tlm_if_base #( T, T ) tif;
00483   
00484     for( int i = 0; i < this.size(); i++ ) begin
00485       tif = this.lookup_indexed_if( i );
00486       assert( tif != null );
00487       tif.write( t );
00488     end 
00489   endfunction
00490 
00491   // for backwards compatibility with 2.0
00492   function void register( tlm_if_base #(T,T) _if );
00493     connect_to_if( _if );
00494   endfunction
00495 
00496   virtual function void connect( port_type provider );
00497     string s;
00498 // ASM MODIFIED - no reference to m_env any more, so drop the check right now.
00499 //                this will need to be examined.
00500 //    if( m_connector.m_env != null || m_connector.is_removed() ) begin
00501     /*if( m_connector.is_removed() ) begin
00502       // if we're in a ovm_env, do the connect normally
00503       super.connect( provider );
00504       return;
00505     end
00506     */
00507 
00508     // otherwise, we register the provider itself    
00509     
00510     if( !m_connector.check_types( provider.m_connector ) ) begin
00511     
00512       $sformat( s , "Cannot connect %s to %s" ,
00513       m_connector.get_full_name() , 
00514       provider.m_connector.get_full_name() );
00515  
00516       m_connector.ovm_report_error( s_connection_error_id , s );
00517       
00518       // unless action assoiated with s_connection_error_id determines
00519       // otherwise, make best attempt to complete connection
00520       
00521     end
00522   
00523     m_connector.update_connection_lists( provider.m_connector );
00524   
00525     m_if = null;
00526 
00527   endfunction
00528     
00529 endclass

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