I've hit a problem with the definition of signed division in numeric_std. With this function: function "/" (L: SIGNED; R: INTEGER) return SIGNED is if L is "100" (that is, -4), and R is 4, then the function returns, not -1, but 0. This is because: constant R_LENGTH: NATURAL := MAX(L'LENGTH, SIGNED_NUM_BITS(R)); ... if (R_LENGTH > L'LENGTH) then QUOT := (others => '0'); return RESIZE(QUOT, L'LENGTH); end if; The signed_num_bits function says that to represent 4 as a signed value requires 4 bits. This is correct. Because R's bit representation is larger than L's bit represented the function returns zero. The result of (-4) / 4 should be -1, not 0. Isn't this a bug in in numeric_std? Paul -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Mon Aug 11 13:45:36 2014
This archive was generated by hypermail 2.1.8 : Mon Aug 11 2014 - 13:46:32 PDT