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

_scv_ext_rw.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_rw.h -- The implementation for the extension component "scv_tag_rw".
00022 
00023   Original Authors (Cadence Design Systems, Inc):
00024   Norris Ip, Dean Shea, John Rose, Jasvinder Singh, William Paulsen,
00025   John Pierce, Rachida Kebichi, Ted Elkind, David Bailey, Samir Agrawal
00026   2002-09-23
00027 
00028  *****************************************************************************/
00029 
00030 /*****************************************************************************
00031 
00032   MODIFICATION LOG - modifiers, enter your name, affiliation, date and
00033   changes you are making here.
00034 
00035       Name, Affiliation, Date:
00036   Description of Modification:
00037 
00038  *****************************************************************************/
00039 
00040 #include <assert.h>
00041 #include <string>
00042 
00043 // ----------------------------------------
00044 // this extension component introduces
00045 // several public methods for access when
00046 // type information is known.
00047 //
00048 // const T& scv_extensions<T>::read() const;
00049 // void scv_extensions<T>::write(const T&);
00050 //
00051 // ----------------------------------------
00052 
00053 // ----------------------------------------
00054 // default implementation of various interfaces
00055 // ----------------------------------------
00056 
00057 #ifdef SYSTEMC_H
00058 #define _SCV_DEFAULT_RW_SYSC \
00059   virtual void assign(const sc_bv_base& v) { assert(0); } \
00060   virtual void get_value(sc_bv_base& v) const { assert(0); } \
00061   virtual void assign(const sc_lv_base& v) { assert(0); } \
00062   virtual void get_value(sc_lv_base& v) const { assert(0); }
00063 #else
00064 #define _SCV_DEFAULT_RW_SYSC
00065 #endif
00066 #define _SCV_DEFAULT_RW \
00067   virtual void assign(bool) { assert(0); } \
00068   virtual void assign(char) { assert(0); } \
00069   virtual void assign(unsigned char) { assert(0); } \
00070   virtual void assign(short) { assert(0); }          \
00071   virtual void assign(unsigned short) { assert(0); }         \
00072   virtual void assign(int) { assert(0); }          \
00073   virtual void assign(unsigned) { assert(0); }           \
00074   virtual void assign(long) { assert(0); }           \
00075   virtual void assign(unsigned long) { assert(0); }        \
00076   virtual void assign(long long) { assert(0); }          \
00077   virtual void assign(unsigned long long) { assert(0); } \
00078   virtual void assign(float) { assert(0); }          \
00079   virtual void assign(double) { assert(0); }           \
00080   virtual void assign(const string&) { assert(0); }        \
00081   virtual void assign(const sc_string&) { assert(0); }         \
00082   virtual void assign(const char *) { assert(0); }         \
00083                      \
00084   virtual bool get_bool() const  { assert(0); return false; } \
00085   virtual long long get_integer() const  { assert(0); return 0; }    \
00086   virtual unsigned long long get_unsigned() const { assert(0); return 0; } \
00087   virtual double get_double() const { assert(0); return 0; }       \
00088   virtual sc_string get_string() const { assert(0); return sc_string(""); } \
00089                      \
00090   _SCV_DEFAULT_RW_SYSC                 \
00091 
00092 #ifdef SYSTEMC_H
00093 #define _SCV_INTROSPECTION_RW_FC_D_SYSC           \
00094   virtual void assign(const sc_bv_base& v); \
00095   virtual void get_value(sc_bv_base& v) const; \
00096   virtual void assign(const sc_lv_base& v); \
00097   virtual void get_value(sc_lv_base& v) const;
00098 #else
00099 #define _SCV_INTROSPECTION_RW_FC_D_SYSC
00100 #endif
00101 #define _SCV_INTROSPECTION_RW_FC_D \
00102   virtual void assign(bool); \
00103   virtual void assign(char); \
00104   virtual void assign(unsigned char); \
00105   virtual void assign(short); \
00106   virtual void assign(unsigned short); \
00107   virtual void assign(int); \
00108   virtual void assign(unsigned); \
00109   virtual void assign(long); \
00110   virtual void assign(unsigned long); \
00111   virtual void assign(long long); \
00112   virtual void assign(unsigned long long); \
00113   virtual void assign(float); \
00114   virtual void assign(double); \
00115   virtual void assign(const string&); \
00116   virtual void assign(const sc_string&); \
00117   virtual void assign(const char *); \
00118   \
00119   virtual bool get_bool() const; \
00120   virtual long long get_integer() const; \
00121   virtual unsigned long long get_unsigned() const; \
00122   virtual double get_double() const; \
00123   virtual sc_string get_string() const; \
00124   \
00125   _SCV_INTROSPECTION_RW_FC_D_SYSC \
00126 
00127 #define _SCV_IMPLEMENT_RW(type_id) \
00128   const type_id& read() const { return *_get_instance(); } \
00129   void write(const type_id& rhs) { *_get_instance() = rhs; this->trigger_value_change_cb(); } \
00130   void _set_instance(type_id * p) { _instance = p; _set_instance_core_wrap(p); } \
00131   void _set_as_field(_scv_extension_util_record * parent,              \
00132           type_id * p, const string& name) { \
00133     if (p) _set_instance(p); \
00134     else if ( ! this->_get_parent() ) { this->_set_parent(parent,name); parent->_add_field(this); } \
00135   } \
00136   type_id* _get_instance() const { return _instance; } \
00137   type_id* get_instance() { \
00138     _scv_message::message(_scv_message::INTROSPECTION_GET_INSTANCE_USAGE); \
00139     return _instance; \
00140   } \
00141   const type_id* get_instance() const { return _instance; } \
00142 
00143 #define _SCV_IMPLEMENT_RW_FULL(type_id) \
00144   _SCV_IMPLEMENT_RW(type_id); \
00145   virtual void _set_instance_core_wrap(void * p) {} \
00146   type_id * _instance; \
00147 
00148 // ----------------------------------------
00149 // specialization for records
00150 // ----------------------------------------
00151 template<typename T>
00152 class _scv_extension_rw_base
00153  : public _SCV_INTROSPECTION_BASE {
00154 public:
00155   _scv_extension_rw_base() {}
00156   virtual ~_scv_extension_rw_base() {}
00157 
00158 public: // public API for use only when full type information is available
00159   const T* get_instance() const { return _instance; }
00160   T* get_instance() { return _instance; }
00161   T* _get_instance() const { return _instance; }
00162 
00163 public: // internal API for implementation only
00164   void _set_instance(T* p) { _instance = p; _set_instance_core_wrap(p); }
00165   virtual void _set_instance_core_wrap(void* p) {}
00166   void _set_as_field(_scv_extension_util_record * parent, T* p,
00167         const string& name) {
00168     if (p) _set_instance(p);
00169     else if ( ! this->_get_parent() ) { this->_set_parent(parent,name); parent->_add_field(this); }
00170   }
00171 
00172 public:
00173   _SCV_DEFAULT_RW
00174   const T& read() { return *get_instance(); }
00175   void write(const T& rhs) { *_get_instance() = rhs; this->trigger_value_change_cb(); }
00176 
00177 public:
00178   T * _instance;
00179 };
00180 
00181 template<typename T>
00182 class scv_extension_rw
00183   : public _scv_extension_rw_base<T>
00184 {};
00185  
00186 //Rachida
00187 // ----------------------------------------
00188 // specialization for array
00189 // ----------------------------------------
00190 template<typename T, int N>
00191 class scv_extension_rw<T[N]>
00192   : public _SCV_INTROSPECTION_BASE2 {
00193   typedef T my_type[N];
00194 public:
00195   scv_extension_rw() {}
00196   virtual ~scv_extension_rw() {}
00197 
00198 public:
00199   _SCV_IMPLEMENT_RW_FULL(my_type)
00200   _SCV_INTROSPECTION_RW_FC_D
00201 };
00202 
00203 template<typename T, int N> void scv_extension_rw<T[N]>::assign(bool) {
00204   _SCV_RW_ERROR(assign,bool,array);
00205 }
00206 template<typename T, int N> void scv_extension_rw<T[N]>::assign(char) {
00207   _SCV_RW_ERROR(assign,char,array);
00208 }
00209 template<typename T, int N> void scv_extension_rw<T[N]>::assign(unsigned char) {
00210   _SCV_RW_ERROR(assign,unsigned char,array);
00211 }
00212 template<typename T, int N> void scv_extension_rw<T[N]>::assign(short) {
00213   _SCV_RW_ERROR(assign,short,array);
00214 }
00215 template<typename T, int N> void scv_extension_rw<T[N]>::assign(unsigned short) {
00216   _SCV_RW_ERROR(assign,unsigned short,array);
00217 }
00218 template<typename T, int N> void scv_extension_rw<T[N]>::assign(int) {
00219   _SCV_RW_ERROR(assign,int,array);
00220 }
00221 template<typename T, int N> void scv_extension_rw<T[N]>::assign(unsigned) {
00222   _SCV_RW_ERROR(assign,unsigned,array);
00223 }
00224 template<typename T, int N> void scv_extension_rw<T[N]>::assign(long) {
00225   _SCV_RW_ERROR(assign,long,array);
00226 }
00227 template<typename T, int N> void scv_extension_rw<T[N]>::assign(unsigned long) {
00228   _SCV_RW_ERROR(assign,unsigned long,array);
00229 }
00230 template<typename T, int N> void scv_extension_rw<T[N]>::assign(long long) {
00231   _SCV_RW_ERROR(assign,long long,array);
00232 }
00233 template<typename T, int N> void scv_extension_rw<T[N]>::assign(unsigned long long) {
00234   _SCV_RW_ERROR(assign,unsigned long long,array);
00235 }
00236 template<typename T, int N> void scv_extension_rw<T[N]>::assign(float) {
00237   _SCV_RW_ERROR(assign,float,array);
00238 }
00239 template<typename T, int N> void scv_extension_rw<T[N]>::assign(double) {
00240   _SCV_RW_ERROR(assign,double,array);
00241 }
00242 template<typename T, int N> void scv_extension_rw<T[N]>::assign(const string&) {
00243   _SCV_RW_ERROR(assign,string,array);
00244 }
00245 template<typename T, int N> void scv_extension_rw<T[N]>::assign(const sc_string&) {
00246   _SCV_RW_ERROR(assign,sc_string,array);
00247 }
00248 template<typename T, int N> void scv_extension_rw<T[N]>::assign(const char *) {
00249   _SCV_RW_ERROR(assign,const char *,array);
00250 }
00251 
00252 template<typename T, int N> bool scv_extension_rw<T[N]>::get_bool() const  {
00253   _SCV_RW_ERROR(get_bool,bool,array); return false;
00254 }
00255 template<typename T, int N> long long scv_extension_rw<T[N]>::get_integer() const  {
00256   _SCV_RW_ERROR(get_integer,integer,array); return 0;
00257 }
00258 template<typename T, int N> unsigned long long scv_extension_rw<T[N]>::get_unsigned() const {
00259   _SCV_RW_ERROR(get_unsigned,unsigned,array); return 0;
00260 }
00261 template<typename T, int N> double scv_extension_rw<T[N]>::get_double() const {
00262   _SCV_RW_ERROR(get_double,double,array); return 0;
00263 }
00264 template<typename T, int N> sc_string scv_extension_rw<T[N]>::get_string() const {
00265   _SCV_RW_ERROR(get_string,string,array); return sc_string("");
00266 }
00267 
00268 #ifdef SYSTEMC_H
00269 template<typename T, int N> void scv_extension_rw<T[N]>::assign(const sc_bv_base& v) {
00270   _SCV_RW_ERROR(assign,sc_bv_base,array);
00271 }
00272 template<typename T, int N> void scv_extension_rw<T[N]>::get_value(sc_bv_base& v) const {
00273   _SCV_RW_ERROR(get_value,sc_bv_base,array);
00274 }
00275 template<typename T, int N> void scv_extension_rw<T[N]>::assign(const sc_lv_base& v) {
00276   _SCV_RW_ERROR(assign,sc_lv_base,array);
00277 }
00278 template<typename T, int N> void scv_extension_rw<T[N]>::get_value(sc_lv_base& v) const {
00279   _SCV_RW_ERROR(get_value,sc_lv_base,array);
00280 }
00281 #endif
00282 // ----------------------------------------
00283 // specialization for pointers
00284 // ----------------------------------------
00285 template<typename T>
00286 class scv_extension_rw<T*>
00287  : public _SCV_INTROSPECTION_BASE1 {
00288 public: // public API for use only when full type information is available
00289   T** const get_instance() const { return _instance; }
00290   T** get_instance() { return _instance; }
00291   T** _get_instance() const { return _instance; }
00292 
00293 public:
00294   void _set_instance(T** p) { _instance = p; }
00295   void _set_as_field(_scv_extension_util_record * parent, T** p,
00296         const string& name) {
00297     if (p) _set_instance(p); 
00298     else if ( ! this->_get_parent() ) { this->_set_parent(parent,name); parent->_add_field(this); }
00299   }
00300 
00301 public:
00302   _SCV_DEFAULT_RW
00303   const T& read() { return *get_instance(); }
00304   void write(const T& rhs) {
00305     *_get_instance() = rhs; this->trigger_value_change_cb();
00306   }
00307 public:
00308   T ** _instance;
00309 };
00310 
00311 // ----------------------------------------
00312 // specialization for enums
00313 // ----------------------------------------
00314 class _scv_extension_rw_enum
00315   : public _SCV_INTROSPECTION_BASE_ENUM {
00316 public:
00317   _scv_extension_rw_enum() {}
00318   virtual ~_scv_extension_rw_enum() {}
00319 
00320   _SCV_INTROSPECTION_RW_FC_D
00321 
00322   int read() const { return *_get_instance(); }
00323   void write(int rhs) {
00324     *_get_instance() = rhs; this->trigger_value_change_cb();
00325   }
00326   void _set_instance(int * p) { _instance = p; }
00327   void _set_as_field(_scv_extension_util_record * parent, int * p,
00328          const string& name) {
00329     if (p) _set_instance(p);
00330     else if ( ! this->_get_parent() ) { _set_parent(parent,name); parent->_add_field(this); }
00331   }
00332   int * _get_instance() const { return _instance; }
00333   int * get_instance() {
00334     _scv_message::message(_scv_message::INTROSPECTION_GET_INSTANCE_USAGE);
00335     return _instance;
00336   }
00337   const int * get_instance() const { return _instance; }
00338 
00339   int * _instance;
00340 };
00341 
00342 
00343 #ifdef SYSTEMC_H
00344 #define _SCV_EXT_RW_FC_COMMON_SYSC_D           \
00345   virtual void assign(const sc_bv_base& v); \
00346   virtual void get_value(sc_bv_base& v) const; \
00347   virtual void assign(const sc_lv_base& v); \
00348   virtual void get_value(sc_lv_base& v) const;
00349 #else
00350 #define _SCV_EXT_RW_FC_COMMON_SYSC_D
00351 #endif
00352 
00353 
00354 // ----------------------------------------
00355 // specialization for basic types
00356 // ----------------------------------------
00357 
00358 #define _SCV_EXT_RW_FC_D(basic_type,type_id) \
00359 class _scv_extension_rw_ ## type_id \
00360  : public scv_extension_type<basic_type> { \
00361 public: \
00362   _scv_extension_rw_ ## type_id(); \
00363   virtual ~_scv_extension_rw_ ## type_id(); \
00364   \
00365 public: /* public API for use only when full type information is available */ \
00366   const basic_type* get_instance() const; \
00367   basic_type* get_instance(); \
00368   basic_type* _get_instance() const; \
00369   \
00370 public: /* internal API for implementation only */ \
00371   void _set_instance(basic_type* p); \
00372   virtual void _set_instance_core_wrap(void* p); \
00373   void _set_as_field(_scv_extension_util_record * parent, basic_type* p, \
00374          const string& name); \
00375   \
00376 public: \
00377   virtual void assign(bool); \
00378   virtual void assign(char); \
00379   virtual void assign(unsigned char); \
00380   virtual void assign(short); \
00381   virtual void assign(unsigned short);\
00382   virtual void assign(int); \
00383   virtual void assign(unsigned); \
00384   virtual void assign(long); \
00385   virtual void assign(unsigned long); \
00386   virtual void assign(long long); \
00387   virtual void assign(unsigned long long); \
00388   virtual void assign(float); \
00389   virtual void assign(double); \
00390   virtual void assign(const string&); \
00391   virtual void assign(const sc_string&); \
00392   virtual void assign(const char *); \
00393   \
00394   virtual bool get_bool() const; \
00395   virtual long long get_integer() const; \
00396   virtual unsigned long long get_unsigned() const; \
00397   virtual double get_double() const; \
00398   virtual sc_string get_string() const; \
00399   \
00400   _SCV_EXT_RW_FC_COMMON_SYSC_D \
00401   const basic_type& read(); \
00402   void write(const basic_type& rhs); \
00403   \
00404 public: \
00405   basic_type * _instance; \
00406 }; \
00407 \
00408 template<> \
00409 class scv_extension_rw<basic_type> \
00410   : public _scv_extension_rw_ ## type_id { \
00411 public: \
00412   scv_extension_rw() {} \
00413   virtual ~scv_extension_rw() {} \
00414 }; \
00415 
00416 
00417 // ------------------------------------------------------------
00418 // C/C++ Types
00419 // ------------------------------------------------------------
00420 
00421 // --------------
00422 // integer types
00423 // --------------
00424 
00425 _SCV_EXT_RW_FC_D(bool,bool)
00426 _SCV_EXT_RW_FC_D(char,char)
00427 _SCV_EXT_RW_FC_D(unsigned char,unsigned_char)
00428 _SCV_EXT_RW_FC_D(short,short)
00429 _SCV_EXT_RW_FC_D(unsigned short,unsigned_short)
00430 _SCV_EXT_RW_FC_D(int,int)
00431 _SCV_EXT_RW_FC_D(unsigned int,unsigned_int)
00432 _SCV_EXT_RW_FC_D(long,long)
00433 _SCV_EXT_RW_FC_D(unsigned long,unsigned_long)
00434 _SCV_EXT_RW_FC_D(long long,long_long)
00435 _SCV_EXT_RW_FC_D(unsigned long long,unsigned_long_long)
00436 
00437 // --------------
00438 // floating pointer types
00439 // --------------
00440 
00441 _SCV_EXT_RW_FC_D(float,float)
00442 _SCV_EXT_RW_FC_D(double,double)
00443 
00444 // --------------
00445 // string type
00446 // --------------
00447 
00448 _SCV_EXT_RW_FC_D(string,string)
00449 
00450 
00451 // ------------------------------------------------------------
00452 // SystemC Types
00453 // ------------------------------------------------------------
00454 
00455 #ifdef SYSTEMC_H
00456 
00457 // --------------
00458 // sc_string
00459 // --------------
00460 
00461 _SCV_EXT_RW_FC_D(sc_string,sc_string)
00462 
00463 // --------------
00464 // sc_bit
00465 // --------------
00466 
00467 _SCV_EXT_RW_FC_D(sc_bit,sc_bit)
00468 
00469 // --------------
00470 // sc_logic
00471 // --------------
00472 
00473 _SCV_EXT_RW_FC_D(sc_logic,sc_logic)
00474 
00475 _SCV_EXT_RW_FC_D(sc_signed,sc_signed)
00476 _SCV_EXT_RW_FC_D(sc_unsigned,sc_unsigned)
00477 _SCV_EXT_RW_FC_D(sc_int_base,sc_int_base)
00478 _SCV_EXT_RW_FC_D(sc_uint_base,sc_uint_base)
00479 _SCV_EXT_RW_FC_D(sc_lv_base,sc_lv_base)
00480 _SCV_EXT_RW_FC_D(sc_bv_base,sc_bv_base)
00481 
00482 
00483 // --------------
00484 // sc_int and sc_uint (begin)
00485 // sc_bigint and sc_biguint (begin)
00486 // sc_bv and sc_lv (begin)
00487 // --------------
00488 
00489 
00490 #define _SCV_EXT_RW_FC_N_BASE(T) \
00491 public: /* public API for use only when full type information is available */ \
00492   const T* get_instance() const { return _instance; } \
00493   T* get_instance() { return _instance; } \
00494   T* _get_instance() const { return _instance; } \
00495   \
00496 public: /* internal API for implementation only */ \
00497   void _set_instance(T* p) { _instance = p; _set_instance_core_wrap(p); } \
00498   virtual void _set_instance_core_wrap(void* p) {} \
00499   void _set_as_field(_scv_extension_util_record * parent, T* p,  \
00500         const string& name) { \
00501     if (p) _set_instance(p); \
00502     else if ( ! this->_get_parent() ) { this->_set_parent(parent,name); parent->_add_field(this); } \
00503   } \
00504   \
00505 public: \
00506   const T& read() { return *get_instance(); } \
00507   void write(const T& rhs) { *_get_instance() = rhs; this->trigger_value_change_cb(); } \
00508   \
00509 public: \
00510   T * _instance; \
00511 
00512 
00513 #define _SCV_EXT_RW_FC_N_ASSIGN(type_name,arg_name) \
00514   virtual void assign(arg_name i) { \
00515     *(this->_get_instance()) = i; \
00516     this->trigger_value_change_cb(); \
00517   }
00518 
00519 
00520 #define _SCV_EXT_RW_FC_N_BAD_ASSIGN(type_name,arg_name) \
00521   virtual void assign(arg_name i) { \
00522     _SCV_RW_ERROR(assign,arg_name,type_name); \
00523   }
00524 
00525 
00526 #define _SCV_EXT_RW_FC_N_ASSIGNS(type_name) \
00527   _SCV_EXT_RW_FC_N_ASSIGN(type_name,bool) \
00528   _SCV_EXT_RW_FC_N_ASSIGN(type_name,char) \
00529   _SCV_EXT_RW_FC_N_ASSIGN(type_name,unsigned char) \
00530   _SCV_EXT_RW_FC_N_ASSIGN(type_name,short) \
00531   _SCV_EXT_RW_FC_N_ASSIGN(type_name,unsigned short) \
00532   _SCV_EXT_RW_FC_N_ASSIGN(type_name,int) \
00533   _SCV_EXT_RW_FC_N_ASSIGN(type_name,unsigned int) \
00534   _SCV_EXT_RW_FC_N_ASSIGN(type_name,long) \
00535   _SCV_EXT_RW_FC_N_ASSIGN(type_name,unsigned long) \
00536   _SCV_EXT_RW_FC_N_ASSIGN(type_name,long long) \
00537   _SCV_EXT_RW_FC_N_ASSIGN(type_name,unsigned long long) \
00538   _SCV_EXT_RW_FC_N_BAD_ASSIGN(type_name,float) \
00539   _SCV_EXT_RW_FC_N_BAD_ASSIGN(type_name,double) \
00540 
00541 
00542 #define _SCV_EXT_RW_FC_N_ASSIGNS_STRING(type_name) \
00543   virtual void assign(const string& s) { \
00544     *(this->get_instance()) = s.c_str();   \
00545     this->trigger_value_change_cb();     \
00546   }            \
00547   virtual void assign(const sc_string& s) {  \
00548     *(this->get_instance()) = s.c_str();   \
00549     this->trigger_value_change_cb();     \
00550   }            \
00551   virtual void assign(const char *s) {     \
00552     *(this->get_instance()) = s;     \
00553     this->trigger_value_change_cb();     \
00554   }            \
00555 
00556 
00557 #define _SCV_EXT_RW_FC_N_ASSIGNS_GET(type_name) \
00558   virtual bool get_bool() const {        \
00559     return *(this->_get_instance()) != (type_name)0; \
00560   }                \
00561   virtual long long get_integer() const {      \
00562     return this->_get_instance()->to_int64();      \
00563   }                \
00564   virtual unsigned long long get_unsigned() const { \
00565     return this->_get_instance()->to_uint64();       \
00566   }                \
00567   virtual double get_double() const  {         \
00568     return this->_get_instance()->to_double();       \
00569   }                \
00570   virtual sc_string get_string() const {       \
00571     return this->get_instance()->to_string(); \
00572   }                \
00573 
00574 
00575 #define _SCV_EXT_RW_FC_N_ASSIGNS_SYSC(type_name) \
00576   virtual void assign(const sc_bv_base& v) { \
00577     if (this->get_bitwidth() != v.length()) \
00578       _scv_message::message(_scv_message::INTROSPECTION_SIZE_MISMATCH_FOR_WIDE_DATA, \
00579         "sc_bv_base","assign"); \
00580     *(this->_get_instance()) = v; this->trigger_value_change_cb(); \
00581   }                  \
00582   virtual void get_value(sc_bv_base& v) const { \
00583     if (this->get_bitwidth() != v.length()) \
00584       _scv_message::message(_scv_message::INTROSPECTION_SIZE_MISMATCH_FOR_WIDE_DATA, \
00585         "sc_bv_base","get_value"); \
00586     this->initialize(); v = *(this->_get_instance()); \
00587   }                        \
00588   virtual void assign(const sc_lv_base& v) { \
00589     if (this->get_bitwidth() != v.length()) \
00590       _scv_message::message(_scv_message::INTROSPECTION_SIZE_MISMATCH_FOR_WIDE_DATA, \
00591         "sc_lv_base","assign"); \
00592     *(this->_get_instance()) = v; this->trigger_value_change_cb(); \
00593   }                        \
00594   virtual void get_value(sc_lv_base& v) const { \
00595     if (this->get_bitwidth() != v.length()) \
00596       _scv_message::message(_scv_message::INTROSPECTION_SIZE_MISMATCH_FOR_WIDE_DATA, \
00597         "sc_lv_base","get_value"); \
00598     this->initialize(); v = *(this->_get_instance()); \
00599   }                  \
00600 
00601 
00602 // --------------
00603 // sc_int
00604 // --------------
00605 template<int N>
00606 class scv_extension_rw<sc_int<N> >
00607   : public scv_extension_type<sc_int<N> > {
00608 public:
00609   scv_extension_rw() {}
00610   virtual ~scv_extension_rw() {}
00611 public:
00612   _SCV_EXT_RW_FC_N_BASE(sc_int<N>)
00613   _SCV_EXT_RW_FC_N_ASSIGNS(sc_int)
00614   _SCV_EXT_RW_FC_N_BAD_ASSIGN(sc_int,const string&)
00615   _SCV_EXT_RW_FC_N_BAD_ASSIGN(sc_int,const sc_string&)
00616   _SCV_EXT_RW_FC_N_BAD_ASSIGN(sc_int,const char *)
00617   _SCV_EXT_RW_FC_N_ASSIGNS_GET(sc_int<N>)
00618   _SCV_EXT_RW_FC_N_ASSIGNS_SYSC(sc_int)
00619 };
00620 
00621 // --------------
00622 // sc_uint
00623 // --------------
00624 template<int N>
00625 class scv_extension_rw<sc_uint<N> >
00626   : public scv_extension_type<sc_uint<N> > {
00627 public:
00628   scv_extension_rw() {}
00629   virtual ~scv_extension_rw() {}
00630 public:
00631   _SCV_EXT_RW_FC_N_BASE(sc_uint<N>)
00632   _SCV_EXT_RW_FC_N_ASSIGNS(sc_uint)
00633   _SCV_EXT_RW_FC_N_BAD_ASSIGN(sc_uint,const string&)
00634   _SCV_EXT_RW_FC_N_BAD_ASSIGN(sc_uint,const sc_string&)
00635   _SCV_EXT_RW_FC_N_BAD_ASSIGN(sc_uint,const char *)
00636   _SCV_EXT_RW_FC_N_ASSIGNS_GET(sc_uint<N>)
00637   _SCV_EXT_RW_FC_N_ASSIGNS_SYSC(sc_uint)
00638 };
00639 
00640 // --------------
00641 // sc_bigint
00642 // --------------
00643 template<int N>
00644 class scv_extension_rw<sc_bigint<N> >
00645   : public scv_extension_type<sc_bigint<N> > {
00646 public:
00647   scv_extension_rw() {}
00648   virtual ~scv_extension_rw() {}
00649 public:
00650   _SCV_EXT_RW_FC_N_BASE(sc_bigint<N>)
00651   _SCV_EXT_RW_FC_N_ASSIGNS(sc_bigint)
00652   _SCV_EXT_RW_FC_N_ASSIGNS_STRING(sc_bigint)
00653   _SCV_EXT_RW_FC_N_ASSIGNS_GET(sc_bigint<N>)
00654   _SCV_EXT_RW_FC_N_ASSIGNS_SYSC(sc_bigint)
00655 };
00656 
00657 // --------------
00658 // sc_biguint
00659 // --------------
00660 template<int N>
00661 class scv_extension_rw<sc_biguint<N> >
00662   : public scv_extension_type<sc_biguint<N> > {
00663 public:
00664   scv_extension_rw() {}
00665   virtual ~scv_extension_rw() {}
00666 public:
00667   _SCV_EXT_RW_FC_N_BASE(sc_biguint<N>)
00668   _SCV_EXT_RW_FC_N_ASSIGNS(sc_biguint)
00669   _SCV_EXT_RW_FC_N_ASSIGNS_STRING(sc_biguint)
00670   _SCV_EXT_RW_FC_N_ASSIGNS_GET(sc_biguint<N>)
00671   _SCV_EXT_RW_FC_N_ASSIGNS_SYSC(sc_biguint)
00672 };
00673 
00674 // --------------
00675 // sc_bv
00676 // --------------
00677 template<int N>
00678 class scv_extension_rw<sc_bv<N> >
00679   : public scv_extension_type<sc_bv<N> > {
00680 public:
00681   scv_extension_rw() {}
00682   virtual ~scv_extension_rw() {}
00683 public:
00684   _SCV_EXT_RW_FC_N_BASE(sc_bv<N>)
00685   _SCV_EXT_RW_FC_N_ASSIGNS(sc_bv)
00686   _SCV_EXT_RW_FC_N_ASSIGNS_STRING(sc_bv)
00687   virtual bool get_bool() const {
00688     return *(this->_get_instance()) != 0;
00689   }
00690   virtual long long get_integer() const {
00691     static sc_bigint<N> tmp;
00692     tmp = *this->_get_instance();
00693     return tmp.to_int64();
00694   }
00695   virtual unsigned long long get_unsigned() const {
00696     static sc_bigint<N> tmp;
00697     tmp = *this->_get_instance();
00698     return tmp.to_uint64();
00699   }
00700   virtual double get_double() const {
00701     static sc_bigint<N> tmp;
00702     tmp = *this->_get_instance();
00703     return tmp.to_double();
00704   }
00705   virtual sc_string get_string() const {
00706     return this->get_instance()->to_string();
00707   }
00708   _SCV_EXT_RW_FC_N_ASSIGNS_SYSC(sc_bv);
00709 };
00710 
00711 // --------------
00712 // sc_lv
00713 // --------------
00714 template<int N>
00715 class scv_extension_rw<sc_lv<N> >
00716   : public scv_extension_type<sc_lv<N> > {
00717 public:
00718   scv_extension_rw() {}
00719   virtual ~scv_extension_rw() {}
00720 public:
00721   _SCV_EXT_RW_FC_N_BASE(sc_lv<N>)
00722   _SCV_EXT_RW_FC_N_ASSIGNS(sc_lv)
00723   _SCV_EXT_RW_FC_N_ASSIGNS_STRING(sc_lv)
00724   virtual bool get_bool() const {
00725     return *(this->_get_instance()) != 0;
00726   }
00727   virtual long long get_integer() const {
00728     static sc_bigint<N> tmp;
00729     tmp = *this->_get_instance();
00730     return tmp.to_int64();
00731   }
00732   virtual unsigned long long get_unsigned() const {
00733     static sc_bigint<N> tmp;
00734     tmp = *this->_get_instance();
00735     return tmp.to_uint64();
00736   }
00737   virtual double get_double() const {
00738     static sc_bigint<N> tmp;
00739     tmp = *this->_get_instance();
00740     return tmp.to_double();
00741   }
00742   virtual sc_string get_string() const {
00743     return this->get_instance()->to_string();
00744   }
00745   _SCV_EXT_RW_FC_N_ASSIGNS_SYSC(sc_lv);
00746 };
00747 
00748 
00749 // --------------
00750 // sc_int and sc_uint (end)
00751 // sc_bigint and sc_biguint (end)
00752 // sc_bv and sc_lv (end)
00753 // --------------
00754 #undef _SCV_EXT_RW_FC_N_BASE
00755 #undef _SCV_EXT_RW_FC_N_ASSIGN
00756 #undef _SCV_EXT_RW_FC_N_BAD_ASSIGN
00757 #undef _SCV_EXT_RW_FC_N_ASSIGNS
00758 #undef _SCV_EXT_RW_FC_N_ASSIGNS_STRING
00759 #undef _SCV_EXT_RW_FC_N_ASSIGNS_GET
00760 #undef _SCV_EXT_RW_FC_N_ASSIGNS_SYSC
00761 
00762 #endif
00763 
00764 
00765 // ----------------------------------------
00766 // wrap up this component
00767 // ----------------------------------------
00768 #undef _SCV_ASSIGN
00769 #undef _SCV_BAD_ASSIGN
00770 
00771 #undef _SCV_DEFAULT_RW_SYSC
00772 #undef _SCV_DEFAULT_RW
00773 
00774 #undef _SCV_INTROSPECTION_BASE
00775 #define _SCV_INTROSPECTION_BASE scv_extension_rw<T>
00776 #undef _SCV_INTROSPECTION_BASE1
00777 #define _SCV_INTROSPECTION_BASE1 scv_extension_rw<T*>
00778 #undef _SCV_INTROSPECTION_BASE2
00779 #define _SCV_INTROSPECTION_BASE2 scv_extension_rw<T[N]>
00780 
00781 #undef _SCV_INTROSPECTION_BASE_ENUM
00782 #define _SCV_INTROSPECTION_BASE_ENUM _scv_extension_rw_enum

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