quick.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

   

space.gif

   

space.gif

  ../images/main/bulllet_4dots_orange.gif Using the scv_extensions_if

The abstract methods provided by scv_extensions_if can be classified into methods for static extensions and methods for dynamic extensions. A static extension is used for simple type information and value access or assignment. This is accomplished via the scv_get_extensions() function in the Verification Standard.

   

space.gif

The target list of data types supported by the data introspection facility is shown in the following table.

   

space.gif

Data Type

Partial Template Specialization

bool

class scv_extensions<bool>

char

class scv_extensions<char>

short

class scv_extensions<short>

int

class scv_extensions<int>

long

class scv_extensions<long>

long long

class scv_extensions<long long>

unsigned char

class scv_extensions<unsigned char>

unsigned short

class scv_extensions<unsigned short>

unsigned int

class scv_extensions<unsigned int>

unsigned long

class scv_extensions<unsigned long>

unsigned long long

class scv_extensions<unsigned long long>

float

class scv_extensions<float>

double

class scv_extensions<double>

string

class scv_extensions<string>

pointer

class scv_extensions<T*>

array

class scv_extensions<T[N]>

sc_string

class scv_extensions<sc_string>

sc_bit

class scv_extensions<sc_bit>

sc_logic

class scv_extensions<sc_logic>

sc_int

template<int W> class scv_extensions< sc_int<W> >

sc_uint

template<int W> class scv_extensions< sc_uint<W> >

sc_bigint

template<int W> class scv_extensions< sc_bigint<W> >

sc_biguint

template<int W> class scv_extensions< sc_biguint<W> >

sc_bv

template<int W> class scv_extensions< sc_bv<W> >

sc_lv

template<int W> class scv_extensions< sc_lv<W> >

sc_fixed

template<int W, int I, sc_q_mode Q, sc_o_mode O, int N> class scv_extensions< sc_fixed<W,I,Q,O,N> >

sc_ufixed

template<int W, int I, sc_q_mode Q, sc_o_mode O, int N> class scv_extensions< sc_ufixed<W,I,Q,O,N> >

   

space.gif

These template specializations include appropriate operators so that they behave as if they are the underlying data objects. For example, most of them include the operators +=, -=, *=, /=, %=, ^=, etc., and the specializations for integer types include operators ++, --, <<=, and >>=. The specializations for SystemC types include the corresponding methods in the underlying object, such as to_int64(). These operators are required to support value change callbacks, etc. Implicit conversion to the underlying data type is used whenever possible. Similar to read() and write() in a SystemC port (sc_port), these extension classes also have read() and write() to get around the implicit conversion problem. In most cases, the C++ compiler can perform the implicit conversion automatically. In the cases when the compiler cannot deduce the right conversion, read() and write() can be used. Another method called get_instance() returns a non-constant pointer to the underlying object; this method must be used in conjunction with another method trigger_value_change_cb() to make sure value change callbacks are executed correctly. Data introspection is useful only

   

space.gif

   

space.gif

  ../images/main/bullet_star_pink.gif Example : scv_extensions_if
   

space.gif


  1 #include <scv.h>
  2 
  3 int sc_main (int argc, char* argv[]) {
  4   // Int data type
  5   int data = 100; 
  6   // Get the bitwidth of the data
  7   int bitwidth = scv_get_extensions(data).get_bitwidth();
  8   cout << "Width of data is "<< bitwidth << endl;
  9   cout << "Value in data is ";
 10   // Get the value in data and print to stdio
 11   scv_get_extensions(data).print();
 12   return 0;
 13 }
You could download file scv_extensions.cpp here
   

space.gif

  ../images/main/bullet_star_pink.gif Simulation Output : scv_extensions_if
   

space.gif

 Width of data is 32
 Value in data is 100
   

space.gif

   

space.gif

   

space.gif

   

space.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

  

Copyright © 1998-2014

Deepak Kumar Tala - All rights reserved

Do you have any Comment? mail me at:deepak@asic-world.com