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

Mixed signed/unsigned remainder operation

$
0
0

Hi All,

I am bit confused about the following dout result:
 

sc_out<sc_int<8> >  dout;
sc_int<8>         din1=0x80;
sc_uint<4>        din2=0x9;

dout.write(din1 % din2);

dout=5;


I know that I am mixing sizes and signed/unsigned but I am intrigued what causes the result to be 5.

I was expecting either -128%9=-2 (or -128%-7=-2). If din1 is reduce to 4 bits then I would expected -1%9=-1 or 0.

Thanks.


Viewing all articles
Browse latest Browse all 595

Trending Articles