Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

_scv_ext_comp.h

Go to the documentation of this file.
00001 //  -*- C++ -*- <this line is for emacs to recognize it as C++ code>
00002 /*****************************************************************************
00003 
00004   The following code is derived, directly or indirectly, from the SystemC
00005   source code Copyright (c) 1996-2002 by all Contributors.
00006   All Rights reserved.
00007 
00008   The contents of this file are subject to the restrictions and limitations
00009   set forth in the SystemC Open Source License Version 2.3 (the "License");
00010   You may not use this file except in compliance with such restrictions and
00011   limitations. You may obtain instructions on how to receive a copy of the
00012   License at http://www.systemc.org/. Software distributed by Contributors
00013   under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
00014   ANY KIND, either express or implied. See the License for the specific
00015   language governing rights and limitations under the License.
00016 
00017  *****************************************************************************/
00018 
00019 /*****************************************************************************
00020 
00021   _scv_ext_comp.h -- A collection of general code to implement the
00022  introspection facility.  This file includes the files "_scv_ext_*.h".
00023 
00024   Original Authors (Cadence Design Systems, Inc):
00025   Norris Ip, Dean Shea, John Rose, Jasvinder Singh, William Paulsen,
00026   John Pierce, Rachida Kebichi, Ted Elkind, David Bailey
00027   2002-09-23
00028 
00029  *****************************************************************************/
00030 
00031 /*****************************************************************************
00032 
00033   MODIFICATION LOG - modifiers, enter your name, affiliation, date and
00034   changes you are making here.
00035 
00036       Name, Affiliation, Date:
00037   Description of Modification:
00038 
00039  *****************************************************************************/
00040 
00041 // ----------------------------------------
00042 // macro for common inlined check for _is_dynamic()
00043 // ----------------------------------------
00044 #define _SCV_CHECK_DYNAMIC(feature,return_statement)                                   \
00045 if (!this->_is_dynamic()) {                                                                 \
00046   _scv_message::message(_scv_message::INTROSPECTION_INVALID_DYNAMIC_EXTENSIONS,#feature); \
00047   return_statement;                                                                   \
00048 }
00049 
00050 // ----------------------------------------
00051 // error message
00052 // ----------------------------------------
00053 #define _SCV_RW_ERROR(feature,type,obj)                                                                     \
00054   _scv_message::message(_scv_message::INTROSPECTION_INVALID_READ_WRITE,#feature,#type,#obj,this->get_name()) \
00055 
00056 // forward declaration
00057 class _scv_constraint_data;
00058 
00059 // ----------------------------------------
00060 // common data objects for dynamic extensions 
00061 // ----------------------------------------
00062 class _scv_dynamic_data {
00063 public:
00064   _scv_dynamic_data() 
00065     : undefined_(true),
00066       disable_randomization_(false),
00067       cdata_(NULL),
00068       dist_(NULL),
00069       _next_id(0)
00070   {}
00071   ~_scv_dynamic_data();
00072 
00073   // used in extensions "rand" only
00074   bool undefined_;
00075   bool disable_randomization_;
00076   _scv_constraint_data* cdata_;
00077   void * dist_;
00078 
00079   // used in extension "callbacks" only
00080   typedef scv_extension_callbacks_if::callback_base callback_base;
00081   int _next_id;
00082   list<callback_base*> _callbacks;
00083   void execute_callbacks(scv_extensions_if *, scv_extensions_if::callback_reason);
00084 };
00085 
00086 #ifdef _SCV_INTROSPECTION_ONLY
00087 #include <stdio.h>
00088 #endif
00089 
00090 inline string _scv_ext_util_get_string(int i) {
00091   char tmp[128];
00092   sprintf(tmp,"%d",i);
00093   return tmp;
00094 }
00095 
00096 inline const char * _scv_ext_util_get_name(const char* format, const char* name, int N) {
00097   static char tmp[1024];
00098   sprintf(tmp, format, name, N);
00099   return strdup(tmp);
00100 }
00101 
00102 inline const char * _scv_ext_util_get_name(const char* format, const char* name) {
00103   static char tmp[1024];
00104   sprintf(tmp, format, name);
00105   return strdup(tmp); 
00106 }
00107 
00108 // ----------------------------------------
00109 // others
00110 // ----------------------------------------
00111 #ifdef SYSTEMC_H
00112 #define _SCV_SYSTEMC_BASIC_TYPE_SPECIALIZATION() \
00113   _SCV_COMPONENT(sc_string); \
00114   _SCV_COMPONENT_1(sc_bit); \
00115   _SCV_COMPONENT_1(sc_logic); \
00116   _SCV_COMPONENT_N(sc_int); \
00117   _SCV_COMPONENT_N(sc_uint); \
00118   _SCV_COMPONENT_N(sc_bigint); \
00119   _SCV_COMPONENT_N(sc_biguint); \
00120   _SCV_COMPONENT_N(sc_bv); \
00121   _SCV_COMPONENT_N(sc_lv); \
00122   _SCV_COMPONENT(sc_signed); \
00123   _SCV_COMPONENT(sc_unsigned); \
00124   _SCV_COMPONENT(sc_int_base); \
00125   _SCV_COMPONENT(sc_uint_base); \
00126   _SCV_COMPONENT(sc_lv_base); \
00127   _SCV_COMPONENT(sc_bv_base); \
00128 
00129 // SCV_COMPONENT_N(tag,sc_fixed);          
00130 // SCV_COMPONENT_N(tag,sc_ufixed);           
00131 
00132 #else
00133 #define _SCV_SYSTEMC_BASIC_TYPE_SPECIALIZATION()
00134 #endif
00135 
00136 #define _SCV_BASIC_TYPE_SPECIALIZATION()\
00137 _SCV_COMPONENT(bool);                   \
00138 _SCV_COMPONENT(char);                   \
00139 _SCV_COMPONENT(unsigned char);    \
00140 _SCV_COMPONENT(short);      \
00141 _SCV_COMPONENT(unsigned short);   \
00142 _SCV_COMPONENT(int);      \
00143 _SCV_COMPONENT(unsigned int);   \
00144 _SCV_COMPONENT(long);     \
00145 _SCV_COMPONENT(unsigned long);    \
00146 _SCV_COMPONENT(long long);    \
00147 _SCV_COMPONENT(unsigned long long); \
00148 _SCV_COMPONENT(float);      \
00149 _SCV_COMPONENT(double);     \
00150 _SCV_COMPONENT(string);     \
00151 _SCV_COMPONENT_N(test_uint);    \
00152 _SCV_SYSTEMC_BASIC_TYPE_SPECIALIZATION()\
00153 
00154 // implementation details
00155 #include "scv/_scv_ext_util.h"
00156 #include "scv/_scv_ext_type.h"
00157 #include "scv/_scv_ext_rw.h"
00158 #include "scv/_scv_ext_rand.h"
00159 #include "scv/_scv_ext_callbacks.h"
00160 
00161 #undef _SCV_SYSTEMC_BASIC_TYPE_SPECIALIZATION
00162 #undef _SCV_BASIC_TYPE_SPECIALIZATION
00163 

Generated on Fri Jan 14 08:28:55 2005 for SystemC2.1beta11(excludingMSLib)(IncludingSCV)\nProvidedby:www.openverificationfoundation.org by doxygen1.2.18