00001 // $Id: ovm_pair.svh 1 2008-03-05 02:42:30Z seanoboyle $ 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 `ifndef OVM_PAIR_SVH 00023 `define OVM_PAIR_SVH 00024 00025 // 00026 // paramterized pair classes 00027 // 00028 00029 class ovm_class_pair #( type T1 = int , 00030 type T2 = T1 ) 00031 00032 extends ovm_transaction; 00033 00034 typedef ovm_class_pair #( T1 , T2 ) this_type; 00035 00036 T1 first; 00037 T2 second; 00038 00039 function new( input T1 f = null , input T2 s = null ); 00040 if( f == null ) begin 00041 first = new; 00042 end 00043 else begin 00044 first = f; 00045 end 00046 if( s == null ) begin 00047 second = new; 00048 end 00049 else begin 00050 second = s; 00051 end 00052 endfunction 00053 00054 function string convert2string; 00055 string s; 00056 00057 $sformat( s , "pair : %s , %s" , 00058 first.convert2string() , 00059 second.convert2string() ); 00060 00061 return s; 00062 endfunction 00063 00064 function bit comp( this_type t ); 00065 return t.first.comp( first ) && t.second.comp( second ); 00066 endfunction 00067 00068 function void copy( input this_type t ); 00069 first.copy( t.first ); 00070 second.copy( t.second ); 00071 endfunction 00072 00073 function ovm_object clone(); 00074 this_type t; 00075 t = new; 00076 t.copy( this ); 00077 return t; 00078 endfunction 00079 00080 endclass 00081 00082 class ovm_built_in_pair #( type T1 = int , 00083 type T2 = T1 ) 00084 00085 extends ovm_transaction; 00086 00087 typedef ovm_built_in_pair #( T1 , T2 ) this_type; 00088 00089 T1 first; 00090 T2 second; 00091 00092 function new( input T1 f = null , input T2 s = null ); 00093 //Matches AVM implementation, but seems wrong to me. 00094 first = f; 00095 second = s; 00096 endfunction 00097 00098 virtual function string convert2string; 00099 string s; 00100 `ifndef INCA 00101 $sformat( s , "built-in pair : %p , %p" , 00102 first , 00103 second ); 00104 `else 00105 $sformat( s , "built-in pair : " , 00106 first , " , ", 00107 second ); 00108 `endif 00109 00110 return s; 00111 endfunction 00112 00113 function bit comp( this_type t ); 00114 return t.first == first && t.second == second; 00115 endfunction 00116 00117 function void copy( input this_type t ); 00118 first = t.first; 00119 second = t.second; 00120 endfunction 00121 00122 function ovm_object clone(); 00123 this_type t; 00124 t = new; 00125 t.copy( this ); 00126 return t; 00127 endfunction 00128 00129 endclass 00130 00131 `endif // OVM_PAIR_SVH
![]() Intelligent Design Verification Project: OVM, Revision: 1.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.6 Sun Sep 21 13:53:50 2008 |