00001 // $Id: a00221.html,v 1.1 2009/01/07 19:29:45 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 // This is the algorithmic comparator class. 00024 // 00025 // It compares two different streams of data of types BEFORE 00026 // and AFTER. 00027 // 00028 // The TRANSFORMER is a functor class which has a single 00029 // method function AFTER transform( input BEFORE b ) - 00030 // typically used to encapsulate an algorithm of some sort. 00031 // 00032 // Matches and mistmatches are reported into terms of AFTER 00033 // transactions 00034 // 00035 // Unlike other comparators, the ovm_algorithmic_comparator can not be 00036 // registered with the ovm_factory because its constructor is 00037 // non-conforming. To register with the factory, a component's 00038 // constructor must declare its first two arguments as: 00039 // 00040 // function new (string name, ovm_component parent, ...) 00041 00042 class ovm_algorithmic_comparator #( type BEFORE = int , 00043 type AFTER = int , 00044 type TRANSFORMER = int ) 00045 extends ovm_component; 00046 00047 const static string type_name = "ovm_algorithmic_comparator #(BEFORE,AFTER,TRANSFORMER)"; 00048 00049 typedef ovm_algorithmic_comparator #( BEFORE , 00050 AFTER , 00051 TRANSFORMER ) this_type; 00052 00053 00054 // before_export and after_export are the analysis exports 00055 // for the two streams of data 00056 00057 ovm_analysis_export #( AFTER ) after_export; 00058 ovm_analysis_imp #( BEFORE , this_type ) before_export; 00059 00060 local ovm_in_order_class_comparator #( AFTER ) comp; 00061 local TRANSFORMER m_transformer; 00062 00063 // The constructor takes a handle to an externally 00064 // constructed transformer, a compulsory name and an 00065 // optional parent. 00066 // 00067 // The transformer class must have a function called 00068 // transform of signature after transform( input before b ); 00069 // 00070 // We create an instance of the transformer ( rather than 00071 // making it a genuine policy class with a static 00072 // transform method ) because we may need to do reset and 00073 // configuration on the transformer itself. 00074 00075 function new( TRANSFORMER transformer, 00076 string name , 00077 ovm_component parent ); 00078 00079 super.new( name , parent ); 00080 00081 m_transformer = transformer; 00082 comp = new("comp" , this ); 00083 00084 before_export = new("before_analysis_export" , this ); 00085 after_export = new("after_analysis_export" , this ); 00086 endfunction 00087 00088 virtual function string get_type_name(); 00089 return type_name; 00090 endfunction 00091 00092 virtual function void connect(); 00093 after_export.connect( comp.after_export ); 00094 endfunction 00095 00096 function void write( input BEFORE b ); 00097 comp.before_export.write( m_transformer.transform( b ) ); 00098 endfunction 00099 00100 endclass : ovm_algorithmic_comparator
![]() Intelligent Design Verification Project: OVM, Revision: 2.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.5 Wed Jan 7 19:27:17 2009 |