ovm_pair.svh

Go to the documentation of this file.
00001 // $Id: ovm__pair_8svh-source.html,v 1.1 2008/10/07 21:54:58 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 `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, input T2 s);
00093     first = f;
00094     second = s;
00095   endfunction  
00096   
00097   virtual function string convert2string;
00098     string s;
00099 `ifndef INCA
00100     $sformat( s , "built-in pair : %p , %p" ,
00101          first ,
00102          second );
00103 `else
00104     $sformat( s , "built-in pair : " ,
00105          first , " , ",
00106          second );
00107 `endif
00108 
00109     return s;
00110   endfunction
00111 
00112   function bit comp( this_type t );
00113     return t.first == first && t.second == second;
00114   endfunction
00115 
00116   function void copy( input this_type t );
00117     first = t.first;
00118     second = t.second;
00119   endfunction
00120   
00121   function ovm_object clone();
00122     this_type t;
00123     t = new(first,second);
00124     return t;
00125   endfunction
00126 
00127 endclass
00128 
00129 `endif // OVM_PAIR_SVH

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