#include
int sc_main (int argc, char* argv[]) {
sc_uint<1> bit_size = 0;
sc_uint<4> nibble_size = 1;
sc_uint<8> byte_size = 2;
sc_uint<32> dword_size = 3;
//sc_int<128> addr; sc_int can not be more then 64
// Perform auto increment
dword_size ++;
cout <<"Value of dword_size : " << dword_size << endl;
// Terse method addition
byte_size += nibble_size;
cout <<"Value of byte_size : " << byte_size << endl;
// Bit selection
bit_size = dword_size[2];
cout <<"Value of bit_size : " << bit_size << endl;
// Range selection
nibble_size = dword_size.range(4,1); // 如果超過範圍只會影響到可用的bit
cout <<"Value of nibble_size: " << nibble_size << endl;
// Concatenated
dword_size = (byte_size,byte_size);
cout <<"Value of dword_size : " << dword_size << endl;
nibble_size.range(1,2) = nibble_size.range(2,1); //sc_uint不能反向使用
//此處要看IEEE1666-2005 page194
cout <<"Value of nibble_size: " << nibble_size << endl;
return 1;
}
SystemC 2.2.0 --- Mar 18 2011 18:40:28
Copyright (c) 1996-2006 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 : 771
Error: (E5) out of bounds: sc_uint[_base] part selection: left = 1, right = 2 violates 0 <= right <= left <= 3
沒有留言:
張貼留言