UPGRADE YOUR BROWSER

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# 15467

5.1i XST - Logic from function definitions in a package is unexpectedly removed

Description

Keywords: VHDL, ignore, empty

Under certain circumstances, when I synthesize a design with functions defined in a package, all logic associated with that function is removed.

The behavior has been observed with a variable declared in a function that is initialized by the results of another function as shown in the following example:

function add(a,b : std_logic_vector) return std_logic_vector IS
:
:
variable sa : std_logic_vector(max_width-1 downto 0) := extend(a, max_width);
variable sb : std_logic_vector(max_width-1 downto 0) := extend(b, max_width);
:
:

Variables "sa" and "sb" are declared and initialized inside of a function. The initialization occurs as a result of the return value from the function "extend".

Solution

To work around the problem, initialize the variables after the beginning of the function as shown in this example:

function add(a,b : std_logic_vector) return std_logic_vector IS
:
:
variable sa : std_logic_vector(max_width-1 downto 0);
variable sb : std_logic_vector(max_width-1 downto 0);
:
:
begin
sa := extend(a, max_width);
sb := extend(b, max_width);
:
:
AR# 15467
Date Created 09/03/2007
Last Updated 01/06/2009
Status Archive
Type General Article