bennymao Posted October 6, 2013 Report Share Posted October 6, 2013 sc_fixed<5,5> sx;sc_fixed<4,4,SC_TRN,SC_WRAP> sy0;sc_fixed<4,4,SC_TRN,SC_WRAP,1> sy1;sc_fixed<4,4,SC_TRN,SC_WRAP,2> sy2;sc_fixed<4,4,SC_TRN,SC_WRAP,3> sy3; The simulation results are as below. sx = 9; //sx = 0b01001sy0 = sx; //sy0 = 0b1001sy1 = sx; //sy1 = 0b0001sy2 = sx; //sy2 = 0b0101sy3 = sx; //sy3 = 0b0111 sx = -5; //sx = 0b11011sy0 = sx; //sy0 = 0b1011sy1 = sx; //sy1 = 0b1011sy2 = sx; //sy2 = 0b1011 sy3 = sx; //sy3 = 0b1011 //The definition in IEEE Std 1666™-2011 is "SC_WRAP, (n_bits>1) The result number shall get the sign bit of the original number. The saturated bits shall get the inverse value of the sign bit of the original number. The remaining bits shall be copied from the original number". So it seems the result should be sy3=0b1001.Can anybody tell me why the result is 0b1011? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.