Quantcast
Channel: SystemC Language Forum RSS Feed
Viewing all articles
Browse latest Browse all 595

sc_int vs sc_fixed behaviour

$
0
0

I found that sc_fixed's rounding behaviour is not consistent with my understanding. For example:

 

sc_fixed<10,10,SC_TRN,SC_WRAP> a;

sc_int<10> b;

 

I expect a and b should behave the same but if the values are -ve, their behaviours are not the same.

 

a = -75;  b = -75;

 

a = -(a>>6);  a becomes 1

b = -(b>>6);  b becomes 2

 

I would think b's behaviour is more correct because -75>>6 = -2 and -(-75>>6) = 2.

 

Anyone know why sc_fixed with q_mode=SC_TRN should not behave like sc_int?

 

Thanks,

Sam


Viewing all articles
Browse latest Browse all 595

Trending Articles