Primitive: 2-Bit Look-Up Table with General Output
Introduction
This design element is a 2-bit look-up table (LUT) with general output (O).
The LUT must be attached with an INIT attribute that has an appropriate number of hexadecimal digits for the number of inputs to specify its function. This element provides a look-up table version of a buffer or inverter. These elements are the basic building blocks. Multiple variants of LUTs accommodate additional types of outputs for use with different timing models for more accurate pre-layout timing estimation.
The INIT parameter for the FPGA LUT primitive gives the LUT its logical value. By default, this value is zero, thus driving the output to a zero regardless of the input values (acting as a ground). However, in most cases a new INIT value must be determined to specify the logic function for the LUT primitive. You can determine the LUT value by at least two methods.
- The Logic Table Method: Create a binary logic table of all possible inputs, specify the desired logic value of the output, and then create the INIT string from those output values.
- The Equation Method: Define parameters for each input to the LUT that correspond to their listed truth value and use those to build the logic equation you are after. This method is easier to understand after you have grasped the concept and is more self-documenting than the above method. However, this method does require the code to first specify the appropriate parameters.
Logic Table
| Inputs | Outputs | |
|---|---|---|
| I1 | I0 | O |
| 0 | 0 | INIT[0] |
| 0 | 1 | INIT[1] |
| 1 | 0 | INIT[2] |
| 1 | 1 | INIT[3] |
| INIT = Binary equivalent of the hexadecimal number assigned to the INIT attribute | ||
Design Entry Method
| Instantiation | Yes |
| Inference | Recommended |
| IP catalog | No |
| Macro support | No |
Available Attributes
| Attribute | Type | Allowed Values | Default | Description |
|---|---|---|---|---|
| INIT | HEX | Any 4-Bit Value | All zeros | Initializes look-up tables. |
VHDL Instantiation Template
Library UNISIM;
use UNISIM.vcomponents.all;
-- LUT2: 2-input Look-Up Table with general output
-- 7 Series
-- Xilinx HDL Language Template, version 2025.2
LUT2_inst : LUT2
generic map (
INIT => X"0")
port map (
O => O, -- LUT general output
I0 => I0, -- LUT input
I1 => I1 -- LUT input
);
-- End of LUT2_inst instantiation
Verilog Instantiation Template
// LUT2: 2-input Look-Up Table with general output (Mapped to a LUT6)
// 7 Series
// Xilinx HDL Language Template, version 2025.2
LUT2 #(
.INIT(4'h0) // Specify LUT Contents
) LUT2_inst (
.O(O), // LUT general output
.I0(I0), // LUT input
.I1(I1) // LUT input
);
// End of LUT2_inst instantiation
Related Information
- 7 Series FPGAs Configurable Logic Block User Guide (UG474)