---
name: "Arithmetic Logic Unit Design"
status: "done"
started: "2019-12"
summary: "3-bit ALU on an FPGA."
url: "https://0xobat.com/projects/arithmetic-logic-unit"
author: "Obat"
---

# Arithmetic Logic Unit Design

A 3-bit arithmetic logic unit in Verilog, on a DE10-Lite FPGA. Built with a partner for Digital VLSI Circuit Design at Lakehead.

Two 3-bit inputs, a 2-bit control signal and a 6-bit output. Four operations: XNOR, shift left, add, multiply. Switches set the inputs. The seven-segment displays show the result, in binary for XNOR and in decimal for add and multiply.

There are five modules: the logic, the display, one that synchronises the inputs to the 50 MHz clock, the LEDs, and a top module that wires them to the board. We tested with testbenches first, then on the board. It works.

## What we'd change

- The display module uses about 63 case statements to cover every decimal result. A counter would do it.
- The variable that tracks a few shifted bits is a 32-bit integer.

## Links

- [PDF](https://0xobat.com/Arithmetic-Logic-Unit-ALU-Design-and-Implementation.pdf)
