Jump to content

bennymao

Members
  • Content Count

    7
  • Joined

  • Last visited

Posts posted by bennymao


  1. 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   = 0b01001
    sy0 = sx; //sy0 = 0b1001
    sy1 = sx; //sy1 = 0b0001
    sy2 = sx; //sy2 = 0b0101
    sy3 = sx; //sy3 = 0b0111

     

    sx = -5;   //sx   = 0b11011
    sy0 = sx; //sy0 = 0b1011
    sy1 = sx; //sy1 = 0b1011
    sy2 = 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. 


  2. Page-20 of "SystemC 2.0.1 Language Reference Manual Revision 1.0", "Index 6" of "Table 2. Examples of Fixed-Point Formats"

    (1) For "range signed"
    It says [-0.125, 0.109375].
    But I think the range should be [-0.125, 0.1171875], because the minimum data is ".1110000" and the maximum one is ".0001111".

    (2) For "range unsiged"
    It says [0, 0.234375].
    But I think the range shoulde be [0, 0.2421875], because the minimum data is ".0000000" and the maximum one is ".0011111".

    Whether my understanding is correct?
    Can anybody give me help?
    Thanks in advanced.
     

    post-11345-0-13182800-1380802812_thumb.jpg

×
×
  • Create New...