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 sc_uint

sc_uint is unsigned integer, and it is fixed precision integer of size 64 bits. The underlying operations use 64 bits, but the result size is determined at object declaration. Operands of type sc_uint can be converted to type sc_int and vice versa by using assignment statements. When assigning an integer to an unsigned operand, the integer value in 2's complement form is interpreted as an unsigned number. When assigning an unsigned to a signed operand, the unsigned is expanded to a 64 bit unsigned number and then truncated to get the signed value.

   

space.gif

sc_uint has rich operators as in the case of sc_int. Look at sc_int for details.

   

space.gif

  ../images/main/bullet_star_pink.gif Example sc_uint
   

space.gif


  1 #include <systemc.h>
  2 
  3 int sc_main (int argc, char* argv[]) {
  4   sc_uint<1>  bit_size    = 0;
  5   sc_uint<4>  nibble_size = 1;
  6   sc_uint<8>  byte_size   = 2;
  7   sc_uint<32> dword_size  = 3;
  8   //sc_int<128> addr; sc_int can not be more then 64
  9   // Perform auto increment
 10   dword_size ++;
 11   cout <<"Value of dword_size : " << dword_size << endl;
 12   // Terse method addition
 13   byte_size += nibble_size;
 14   cout <<"Value of byte_size  : " << byte_size << endl;
 15   // Bit selection
 16   bit_size = dword_size[2];
 17   cout <<"Value of bit_size   : " << bit_size << endl;
 18   // Range selection
 19   nibble_size = dword_size.range(4,1); // Can not assign out of range
 20   cout <<"Value of nibble_size: " << nibble_size << endl;
 21   // Concatenated
 22   dword_size = (byte_size,byte_size,byte_size,byte_size);
 23   cout <<"Value of dword_size : " << dword_size << endl;
 24 
 25   return 1;
 26 }
You could download file sc_uint.cpp here
   

space.gif

  ../images/main/bullet_star_pink.gif Simulator Output: sc_uint
   

space.gif

              SystemC 2.0.1 --- Oct  6 2006 19:17:37
         Copyright (c) 1996-2002 by all Contributors
                     ALL RIGHTS RESERVED
 Value of dword_size : 4
 Value of byte_size  : 3
 Value of bit_size   : 1
 Value of nibble_size: 2
 Value of dword_size : 50529027
   

space.gif

  ../images/main/bulllet_4dots_orange.gif sc_bigint

There are time when operands need to be larger than 64 bits. For these types of designs sc_int will not work. For these cases SystemC provides type sc_bigint (arbitrary sized signed integer). These types allow the designer to work on integers of any size, limited only by underlying system limitations. Arithmetic and other operators also use arbitrary precision when performing operations. SystemC define's MAX_NBITS in sc_constants.h to limit the max size of the bits for sc_bigint to 512.

   

space.gif

Type sc_bigint is a 2's complement signed integer of any size. sc_bigint has rich operators as in the case of sc_int. Look at sc_int for details.

   

space.gif

   

space.gif

  ../images/main/bullet_star_pink.gif Example sc_bigint
   

space.gif


  1 #include <systemc.h>
  2 
  3 int sc_main (int argc, char* argv[]) {
  4   sc_bigint<128> large_size ;
  5   // Shift operator
  6   large_size =  1000 << 1;
  7   cout <<"Value of large_size : " << large_size << endl;
  8   
  9   return 1;
 10 }
You could download file sc_bigint.cpp here
   

space.gif

  ../images/main/bullet_star_pink.gif Simulator Output: sc_bigint
   

space.gif

              SystemC 2.0.1 --- Oct  6 2006 19:17:37
         Copyright (c) 1996-2002 by all Contributors
                     ALL RIGHTS RESERVED
 Value of large_size : 2000
   

space.gif

  ../images/main/bulllet_4dots_orange.gif sc_biguint

sc_biguint is same as sc_bigint, only difference is sc_biguint is unsigned. These types allow the designer to work on integers of any size, limited only by underlying system limitations. Arithmetic and other operators also use arbitrary precision when performing operations. SystemC define's MAX_NBITS in sc_constants.h to limit the max size of the bits for sc_biguint to 512.

   

space.gif

sc_biguint has rich operators as in the case of sc_int. Look at sc_int for details.

   

space.gif

  ../images/main/bullet_star_pink.gif Example sc_biguint
   

space.gif


  1 #include <systemc.h>
  2 
  3 int sc_main (int argc, char* argv[]) {
  4   sc_biguint<128> a  = 30000;
  5   sc_biguint<128> b  = 20000;
  6   sc_biguint<256> c  = 0;
  7   // multiplication operator
  8   c = a * b;
  9   cout <<"Value of c : " << c << endl;
 10   
 11   return 1;
 12 }
You could download file sc_biguint.cpp here
   

space.gif

  ../images/main/bullet_star_pink.gif Simulator Output: sc_biguint
   

space.gif

              SystemC 2.0.1 --- Oct  6 2006 19:17:37
         Copyright (c) 1996-2002 by all Contributors
                     ALL RIGHTS RESERVED
 Value of c : 600000000
   

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