↓ Skip to main content

Reconfigurable Convolutional Kernels on FPGAs via LUTs

Reconfigurable Convolutional Kernels on FPGAs via LUTs

Convolutional kernel data remains static during the calculation phase, which makes update speeds relatively slow. This characteristic allows us to leverage Look-Up Tables (LUTs) to store weights while simultaneously performing multiplication operations.

While LUT-based multipliers have been studied for some time, this approach proposes a specific method for implementing reconfigurable convolutions. By using LUTs for multiplication, we bypass the limitations of available DSP resources on FPGAs, making neural network acceleration feasible on low-end chips.

Multiplication Logic 🛠️
#

Modern FPGA LUTs have fixed input and output pins. For instance, Xilinx Zynq series devices feature LUTs with either 5 inputs and 1 output, or 4 inputs and 2 outputs. The challenge lies in how to implement arbitrary-sized multiplications using these structures.

Factorization Principle
#

We solve this using basic mathematical factorization. Consider a two’s complement data value $x$ with $B_i$ bits. If we multiply this by a constant $c$, the operation can be decomposed into smaller bit-width multiplications. These smaller products are then shifted and summed.

This process breaks down a $B_c \times B_i$ bit multiplication into multiple $B_c \times L$ multiplications. By setting $L$ to match the number of input pins on the LUT, we can map the multiplication directly onto the LUT hardware with maximum resource efficiency.

GPC Adder Trees
#

Decomposing multiplications generates a large number of additions, requiring a substantial adder tree to sum the shifted partial products. We utilize Generalized Parallel Counters (GPC) to take full advantage of the FPGA’s LUT resources and carry chains. This mapping minimizes wasted LUTs by ensuring the maximum number of full adders are packed into a single LUT, keeping the carry chain as short as possible.

Dynamic Configuration 🔄
#

A LUT is essentially a lookup table where the logic of the FPGA code is mapped. A key feature of modern LUTs is their ability to be dynamically configured, meaning the internal values can be updated during runtime.

In Xilinx Virtex, Spartan, and Zynq devices, LUTs can be updated via shift registers, typically completing in 32 clock cycles. This allows us to store convolutional kernel data directly within the LUTs and update them whenever the kernel needs to change.

Hardware Architecture 🏗️
#

The hardware structure for convolutional operations involves $N$ input data points ($x_1, x_2, \dots, x_N$). Each multiplication with a weight $c$ is decomposed into $K$ partial multiplications. These results are shifted and fed into the adder tree.

Partial Product Decomposition
#

For a $B_c \times L$ multiplication, the required LUT count is approximately $B_c + L$. Because the output bit-width $B_o$ of the adder tree is significantly larger than the input bit-width, we must implement rounding or truncation.

Faithful Rounding
#

If we truncate the output only after the final summation, the adder tree wastes LUTs by calculating and summing redundant bits. However, truncating every individual partial product too early leads to significant precision loss.

The solution is “faithful rounding.” We truncate each partial product to a bit-width slightly larger than the target. Based on the total number of partial products ($N \times B_i / L$), we calculate the exact number of bits to retain. This ensures the final result’s precision is equal to or better than a direct truncation, while minimizing LUT usage.

Ping-Pong LUT Structure
#

Updating LUT data presents a synchronization challenge: a LUT cannot be configured while it is actively performing a calculation. We resolve this by using a double-LUT structure. One set of LUTs performs the computation while the other set undergoes dynamic configuration. This ping-pong operation ensures continuous operation without interrupting the calculation pipeline.

For systems requiring high-reliability real-time execution, these hardware-level optimizations can be integrated with real-time operating systems like VxWorks to manage complex embedded workflows.

Resource Comparison
#

The proposed architecture maximizes LUT resource utilization compared to other LUT-based multiplication and addition methods. By optimizing the mapping of partial products and utilizing the GPC adder trees, this design improves timing performance and allows for higher-density CNN deployment on resource-constrained hardware.

Related