00001 // $Id: ovm__policies_8svh-source.html,v 1.1 2008/10/07 21:54:54 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_POLICIES_SVH 00023 `define OVM_POLICIES_SVH 00024 00025 // comp, convert and clone policy classes for built in types 00026 // and classes. 00027 // 00028 // These are for passing in as parameters to standard 00029 // components such as tlm_fifo and in_order_comparator 00030 // 00031 00032 // 00033 // Built in type comparator, converter and clone 00034 // 00035 00036 //---------------------------------------------------------------------- 00037 // CLASS ovm_built_in_comp 00038 //---------------------------------------------------------------------- 00039 class ovm_built_in_comp #( type T = int ); 00040 00041 static function bit comp( input T a , input T b ); 00042 return a == b; 00043 endfunction 00044 00045 endclass 00046 00047 //---------------------------------------------------------------------- 00048 // CLASS ovm_built_in_converter 00049 //---------------------------------------------------------------------- 00050 class ovm_built_in_converter #( type T = int ); 00051 00052 static function string convert2string( input T t ); 00053 string s; 00054 $sformat( s , "%p" , t ); 00055 return s; 00056 endfunction 00057 00058 endclass 00059 00060 //---------------------------------------------------------------------- 00061 // class ovm_built_in_clone 00062 //---------------------------------------------------------------------- 00063 class ovm_built_in_clone #( type T = int ); 00064 00065 static function T clone( input T from ); 00066 return from; 00067 endfunction 00068 00069 endclass 00070 00071 // 00072 // Class comparator, converter, clone 00073 // 00074 // Assumes comp, converter and clone functions in all classes 00075 // 00076 00077 //---------------------------------------------------------------------- 00078 // CLASS ovm_class_comp 00079 //---------------------------------------------------------------------- 00080 class ovm_class_comp #( type T = int ); 00081 00082 static function bit comp( input T a , input T b ); 00083 return a.comp( b ); 00084 endfunction 00085 00086 endclass 00087 00088 //---------------------------------------------------------------------- 00089 // CLASS ovm_class_converter 00090 //---------------------------------------------------------------------- 00091 class ovm_class_converter #( type T = int ); 00092 00093 static function string convert2string( input T t ); 00094 return t.convert2string(); 00095 endfunction 00096 00097 endclass 00098 00099 //---------------------------------------------------------------------- 00100 // CLASS ovm_class_clone 00101 //---------------------------------------------------------------------- 00102 class ovm_class_clone #( type T = int ); 00103 00104 static function ovm_object clone( input T from ); 00105 return from.clone(); 00106 endfunction 00107 00108 endclass 00109 00110 `endif // OVM_POLICIES_SVH
![]() 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 |