00001 // $Id: ovm__algorithmic__comparator_8svh-source.html,v 1.1 2008/10/07 21:54:20 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 class ovm_algorithmic_comparator #( type BEFORE = int , 00036 type AFTER = int , 00037 type TRANSFORMER = int ) 00038 extends ovm_component; 00039 00040 const static string type_name = "ovm_algorithmic_comparator #(BEFORE,AFTER,TRANSFORMER)"; 00041 00042 typedef ovm_algorithmic_comparator #( BEFORE , 00043 AFTER , 00044 TRANSFORMER ) this_type; 00045 00046 // before_export and after_export are the analysis exports 00047 // for the two streams of data 00048 00049 ovm_analysis_export #( AFTER ) after_export; 00050 ovm_analysis_imp #( BEFORE , this_type ) before_export; 00051 00052 local ovm_in_order_class_comparator #( AFTER ) comp; 00053 local TRANSFORMER m_transformer; 00054 00055 // The constructor takes a handle to an externally 00056 // constructed transformer, a compulsory name and an 00057 // optional parent. 00058 // 00059 // The transformer class must have a function called 00060 // transform of signature after transform( input before b ); 00061 // 00062 // We create an instance of the transformer ( rather than 00063 // making it a genuine policy class with a static 00064 // transform method ) because we may need to do reset and 00065 // configuration on the transformer itself. 00066 00067 function new( TRANSFORMER transformer , 00068 string name , 00069 ovm_component parent ); 00070 00071 super.new( name , parent ); 00072 00073 m_transformer = transformer; 00074 comp = new("comp" , this ); 00075 00076 before_export = new("before_analysis_export" , this ); 00077 after_export = new("after_analysis_export" , this ); 00078 endfunction 00079 00080 virtual function string get_type_name(); 00081 return type_name; 00082 endfunction 00083 00084 virtual function void connect(); 00085 after_export.connect( comp.after_export ); 00086 endfunction 00087 00088 function void write( input BEFORE b ); 00089 comp.before_export.write( m_transformer.transform( b ) ); 00090 endfunction 00091 00092 endclass : ovm_algorithmic_comparator
![]() 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:23:29 2008 |