ovm_algorithmic_comparator.svh

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

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