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

SYNPLIFY - How do I use the INIT attribute to initialize a LUT in VHDL and Verilog?

Description

General Description:

When instantiating a LUT in VHDL, how do I use the INIT attribute to set the LUT equation?

Solution

The following file gives an example of how to use the INIT attribute to initialize the equation in the instantiated LUT. The specific device library must be included in order to reference the device-specific components in Synplify. In this case, the Virtex library was used; however, the examples will work for the Spartan-II and the Virtex-II architectures if the appropriate library is included.

Test case for using INIT attribute:

-- 4 input comparator with chip select example.

-- Given the signal DATA_IN (3 downto 0), the LUT equation is as follows:

~DATA_IN(3) * ~DATA_IN(2) * DATA_IN(1) * DATA_IN(0)

Library IEEE;

use IEEE.std_logic_1164.all;

library unisim;

use unisim.vcomponents.all;

entity muxtest is port (

DATA_IN : in std_logic_vector ( 3 downto 0 );

CS : in std_logic;

CLK : in std_logic;

DATA_OUT : out std_logic );

end muxtest;

architecture structural of muxtest is

component LUT4

generic (INIT : bit_vector (15 downto 0) := b"0000000000000000");

port (

I0 : in std_logic;

I1 : in std_logic;

I2 : in std_logic;

I3 : in std_logic;

O : out std_logic

);

end component;

component MUXF5

port (

I0 : in std_logic;

I1 : in std_logic;

S : in std_logic;

O : out std_logic

);

end component;

component GND

port(

G : out STD_ULOGIC );

end component;

signal LUT_OUT: std_logic;

signal MUX_OUT: std_logic;

signal GND_IN: std_logic;

begin

MYLUT1: LUT4

generic map (

INIT => b"0000_0000_0000_1000"

)

port map (

I0 => DATA_IN(0),

I1 => DATA_IN(1),

I2 => DATA_IN(2),

I3 => DATA_IN(3),

O => LUT_OUT

);

MYMUXF5: MUXF5 port map (

I0 => LUT_OUT,

I1 => GND_IN,

S => CS,

O => MUX_OUT

);

MYGND: GND port map ( G => GND_IN );

process ( CLK )

begin

if ( CLK = '1' and CLK'event ) then

DATA_OUT <= MUX_OUT;

end if;

end process;

end structural;

The following file gives an example of how to use the INIT attribute to initialize the equation in the instantiated LUT. The specific device library must be included in order to reference the device-specific components in Synplify. In this case, the Virtex library was used: however, the examples will work for the Spartan-II and the Virtex-II architectures if the appropriate library is included.

Test case for using INIT attribute:

-- 4 input comparator with chip select example.

-- Given the signal DATA_IN (3 downto 0), the LUT equation is as follows: