We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 23049

8.1i XST - Subtraction of integer values is incorrect when one operand is negative


Keywords: synthesis, divide, signed

When the operand is negative and type is integer, the subtraction result is incorrect. For example:

signal g_13bit : integer range -6143 to 6143;
signal cr_prod_2_12bit : integer range -2048 to 2048;
signal cb_prod_2_12bit : integer range -2048 to 2048;

g_13bit <= cr_prod_2_12bit - cb_prod_2_12bit;

--> cr_prod_2_12bit := -307 111011001101
cb_prod_2_12bit := 28 000000011100
g_13bit := 3761 0111010110001 ==> should be : -335 1111010110001

The MSB does not reflect the correct sign.


This problem occurs when using the divide operator on a signed operand, and the result is a signed integer used in a subtraction. In this case, the sign is lost. This is a problem in XST; it performs incorrect calculations when using the type integer.

You can work around this issue by using "std_logic_vector" instead of integers.

This issue is fixed in ISE 8.2i.
AR# 23049
Date Created 03/08/2006
Last Updated 12/16/2008
Status Archive
Type General Article