teal_dictionary.svh

Go to the documentation of this file.
00001 /*
00002  Trusster Open Source License version 1.0a (TRUST)
00003  copyright (c) 2006 Mike Mintz and Robert Ekendahl.  All rights reserved. 
00004 
00005  Redistribution and use in source and binary forms, with or without modification, 
00006  are permitted provided that the following conditions are met: 
00007  
00008  * Redistributions of source code must retain the above copyright notice, 
00009  this list of conditions and the following disclaimer.
00010  * Redistributions in binary form must reproduce the above copyright notice, 
00011  this list of conditions and the following disclaimer in the documentation 
00012  and/or other materials provided with the distribution.
00013  * Redistributions in any form must be accompanied by information on how to obtain 
00014  complete source code for this software and any accompanying software that uses this software.
00015  The source code must either be included in the distribution or be available in a timely fashion for no more than 
00016  the cost of distribution plus a nominal fee, and must be freely redistributable under reasonable and no more 
00017  restrictive conditions. For an executable file, complete source code means the source code for all modules it 
00018  contains. It does not include source code for modules or files that typically accompany the major components 
00019  of the operating system on which the executable file runs.
00020  
00021 
00022  THIS SOFTWARE IS PROVIDED BY MIKE MINTZ AND ROBERT EKENDAHL ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 
00023  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, 
00024  OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL MIKE MINTZ AND ROBERT EKENDAHL OR ITS CONTRIBUTORS 
00025  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
00026  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
00027  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
00028  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
00029  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030  */
00031 
00032 //WARNING: This is not a stand-alone header file. It is intended to be used as part of teal.h
00033 
00034 
00035 ////////////////////////////////////////////////////////////////////////////
00036 ////////////////////////////////////////////////////////////////////////////
00037 ////////////////////////////////////////////////////////////////////////////
00038 ///////////////// Dictionary /////////////////
00039 ////////////////////////////////////////////////////////////////////////////
00040 ////////////////////////////////////////////////////////////////////////////
00041 ////////////////////////////////////////////////////////////////////////////
00042 
00043 class dictionary_impl;
00044    extern function string find_on_command_line (string name, string default_name);
00045    extern task read (string path);
00046    extern task clear ();
00047    extern function bit put (string name, string value, input bit replace_existing = 1);
00048    extern function string find (string name); 
00049    extern function integer find_integer (string name, integer default_value);
00050    local string lines_[string];
00051       local vout log_;
00052       extern function new ();
00053     extern local task process_file_ (string path);
00054        extern local function string teal_scan_plusargs (string name);
00055  endclass // dictionary_impl
00056 
00057 
00058    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00059    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00060    function automatic dictionary_impl dictionary_get ();
00061       static dictionary_impl lv;  //singleton
00062       if (lv == null) lv = new ();
00063       return (lv);
00064    endfunction
00065 
00066 
00067 //only seaches command line args. Useful to get a file name to start dictionary with.
00068    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00069    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00070 function string dictionary_find_on_command_line (string name, string default_name);
00071   dictionary_impl impl = dictionary_get ();
00072   return (impl.find_on_command_line (name, default_name));
00073 endfunction
00074 
00075    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00076    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00077 task dictionary_read (string path);
00078   dictionary_impl impl = dictionary_get ();
00079    impl.read (path);
00080 endtask
00081 
00082    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00083    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00084 //removes all entries
00085 task dictionary_clear ();
00086   dictionary_impl impl = dictionary_get ();
00087    impl.clear ();
00088 endtask
00089       
00090 
00091 parameter bit replace_entry = 1;
00092 parameter bit default_only = 0;
00093 
00094 //returns 1 if placed or overwritten
00095    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00096    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00097 function bit dictionary_put (string name, string value, input bit replace_existing = 1);
00098   dictionary_impl impl = dictionary_get ();
00099    return (impl.put (name, value, replace_existing));
00100 endfunction // bit
00101       
00102 
00103    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00104    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00105 function string dictionary_find (string name);  //returns "" if not found in constraints or command line
00106   dictionary_impl impl = dictionary_get ();
00107    return (impl.find (name));
00108 endfunction   
00109       
00110 
00111 //sets to default if not found
00112    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00113    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
00114 function automatic integer dictionary_find_integer (string name, integer default_value);
00115   dictionary_impl impl = dictionary_get ();
00116    return (impl.find_integer (name, default_value));
00117 endfunction   
00118 
00119 
00120 `include "teal_dictionary.sv"

Intelligent Design Verification
Intelligent Design Verification
Project: Teal&Truss, Revision: 1.62c
Copyright (c) 2008-2010 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.6.3
IDV SV Filter Version: 2.6.3
Sat Jun 19 12:13:42 2010
Find a documentation bug? Report bugs to: bugs.intelligentdv.com Project: DoxygenFilterSV