On Artix-7, one LUT is 6-bit input, 1-bit output. Presumably, any function I have with 6 bits input, 1 bit output I can implement by utilizing only one LUT.
When I synthesize the following code, however, I get a report saying 7 LUTs have been utilized. I am wondering why?
I am using Vivado 2019.2.
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.numeric_std_unsigned.all;
entity test is
port(
d_in : in std_logic_vector(5 downto 0);
d_out : out std_logic
);
end entity test;
architecture RTL of test is
type t_int_array is array (natural range<>) of integer;
constant primes : t_int_array(0 to 17) := (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61);
begin
process(d_in)
begin
d_out <= '0';
for i in 0 to 17 loop
if (d_in(5 downto 4) * d_in(3 downto 0) - d_in(0) = primes(i)) then
d_out <= '1';
end if;
end loop;
end process;
end architecture RTL;
Here is the synthesized schematic.
When I change the code to just skip one subtraction:
if (d_in(5 downto 4) * d_in(3 downto 0) = primes(i)) then
d_out <= '1';
end if;
and synthesize, I get the expected 1 LUT utilized.
