How to increment a sc bitvector of width > 32

Status
Not open for further replies.

chetha

Newbie level 1
Joined
Aug 4, 2009
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,288
Hi
I am trying to implement a 40 bit counter in systemC
I had ttried with the following code

sc_bv <40> counter;
............
............
counter = counter.to_ulong()+1;

Even I tried counter.to_uint64()+1 also
The issue I am facing is after FFFFFFFF the counter value is 0 but not 1FFFFFFFF

Is there any short cut other than splitting the counter into 8 and 32 bit wide vectors ans incrementing them separately

Regards
Chethan
 

Hi Chetan,

you declared the counter as ulong.
ulong is nothing but 32-bit.
Thats y u'r counter value become 0 after FFFFFFFF.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…