00001 // $Id: ovm__port__base_8svh-source.html,v 1.1 2008/10/07 21:54:43 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 `const string s_removed_id = "component has been removed"; 00023 `const string s_connect_id = "connect"; 00024 00025 //---------------------------------------------------------------------- 00026 // ovm_port_base 00027 // 00028 // ovm_port_base extends but does not implement IF 00029 // 00030 // IF is typically a TLM or analysis interface. This interface will 00031 // be implemented in ovm_<IF>_port, ovm_<IF>_export, or ovm_<IF>_imp. 00032 // 00033 // Mostly ovm_port_base delegates to m_connector. 00034 // 00035 //---------------------------------------------------------------------- 00036 virtual class ovm_port_base #(type IF = ovm_object) 00037 extends ovm_port_base_base #(IF); 00038 00039 typedef ovm_connector #( IF ) connector_type; 00040 typedef ovm_port_base #( IF ) this_type; 00041 00042 connector_type m_connector; 00043 int unsigned m_if_mask; 00044 string m_if_name; 00045 protected IF m_if; 00046 ovm_if_container #(IF) m_if_container; 00047 00048 function new( string name , ovm_component parent , 00049 ovm_port_type_e port_type , 00050 int min_size = 0 , int max_size = 1 ); 00051 set_name(name); 00052 m_connector = new( name, parent, port_type, 00053 min_size, max_size ); 00054 m_connector.port_h = this; 00055 m_if_container = m_connector.get_if_container(); 00056 00057 endfunction 00058 00059 // port->port, port->export/imp, export->export/imp connections 00060 00061 //-------------------------------------------------------------------- 00062 // connect 00063 //-------------------------------------------------------------------- 00064 function void connect( this_type provider ); 00065 string s; 00066 connector_type provider_connector; 00067 00068 // Check the provider interface mask against this (requirer) mask. 00069 // The provider must provide at least the set of interface functions 00070 // that the requirer requires. It may provide more, but that's the 00071 // minimumn needed for this connection. 00072 if( (provider.m_if_mask & m_if_mask) != m_if_mask) begin 00073 $sformat(s, "cannot connect provider of %s interface to a requirer of %s interface", 00074 provider.m_if_name, m_if_name); 00075 m_connector.ovm_report_error(s_connect_id, s); 00076 return; 00077 end 00078 00079 provider_connector = provider.m_connector; 00080 00081 /* 00082 if( m_connector.is_removed() ) begin 00083 00084 $sformat( s , "Ignoring attempted connection from %s to %s" , 00085 m_connector.get_full_name() , 00086 provider_connector.get_full_name() ); 00087 00088 m_connector.ovm_report_info( s_removed_id , s ); 00089 return; 00090 end 00091 00092 if( provider_connector.is_removed() ) begin 00093 00094 $sformat( s , "Ignoring attempted connection from %s to %s" , 00095 m_connector.get_full_name(), 00096 provider_connector.get_full_name() ); 00097 00098 provider_connector.ovm_report_info( s_removed_id , s ); 00099 00100 return; 00101 end 00102 */ 00103 00104 if( !m_connector.check_types( provider_connector ) || 00105 !m_connector.check_relationship( provider_connector ) ) begin 00106 00107 $sformat( s , "Cannot connect %s to %s" , 00108 m_connector.get_full_name(), 00109 provider_connector.get_full_name() ); 00110 00111 m_connector.ovm_report_error( s_connection_error_id , s ); 00112 00113 // unless action assoiated with s_connection_error_id determines 00114 // otherwise, make best attempt to complete connection 00115 00116 end 00117 00118 m_connector.update_connection_lists(provider_connector); 00119 00120 endfunction 00121 00122 //-------------------------------------------------------------------- 00123 // remove 00124 //-------------------------------------------------------------------- 00125 function void remove(); 00126 //m_connector.remove(); 00127 endfunction 00128 00129 //-------------------------------------------------------------------- 00130 // size 00131 //-------------------------------------------------------------------- 00132 function int size(); 00133 return m_if_container.size(); 00134 endfunction 00135 00136 //-------------------------------------------------------------------- 00137 // connect_to_if 00138 // 00139 // port/export -> old style if conenction 00140 //-------------------------------------------------------------------- 00141 function void connect_to_if( input IF _if ); 00142 assert( m_connector.add_if( _if ) ); 00143 endfunction 00144 00145 //-------------------------------------------------------------------- 00146 // lookup_indexed_if 00147 // 00148 // looks up ith index 00149 //-------------------------------------------------------------------- 00150 function IF lookup_indexed_if( int i = 0 ); 00151 return m_if_container.lookup_indexed_if( i ); 00152 endfunction 00153 00154 //-------------------------------------------------------------------- 00155 // set_if 00156 //-------------------------------------------------------------------- 00157 function void set_if(int i = 0); 00158 m_if = lookup_indexed_if(i); 00159 endfunction 00160 00161 //-------------------------------------------------------------------- 00162 // debug_connected_to 00163 // 00164 // recursive debug following RHS of requires->provides 00165 // end point is an imp 00166 //-------------------------------------------------------------------- 00167 function void debug_connected_to( int level = 0 , 00168 int max_level = -1 ); 00169 00170 m_connector.debug_connected_to( level , max_level ); 00171 00172 endfunction 00173 00174 //-------------------------------------------------------------------- 00175 // debug_provided_to 00176 // 00177 // recusrive debug following LHS of requires->provides 00178 // end point is a port 00179 //-------------------------------------------------------------------- 00180 function void debug_provided_to( int level = 0 , 00181 int max_level = -1 ); 00182 00183 m_connector.debug_provided_to( level , max_level ); 00184 00185 endfunction 00186 00187 `include "compatibility/urm_port_compatibility.svh" 00188 endclass
![]() 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 Version: 1.4.6 Mon Sep 29 14:20:12 2008 |