# Project 10 A Simple ALU

## Introduction

Arithmetic and Logic Unit (ALU) circuits are found at the core of microprocessors. They combine the input data operands, and produce output data as directed by the computer’s programming instructions. Computer programming instructions, or machine codes, contain several bits that configure the ALU to combine input data using arithmetic or logic functions. For example, an “ADD” instruction would contain bits to configure the ALU to combine input operands using an adding circuit, and an “OR” instruction would contain bits to configure the ALU to combine operands using an OR’ing circuit.

Although ALUs are seemingly complex, they are actually fairly easy to specify and straightforward to design. This project present the design of a simple ALU.

#### Before you begin, you should:

• Understand the design and operation of arithmetic circuits;
• Understand how to specify and design combinational circuits;
• Be a confident and capable Vivado user.

#### After you’re done, you should:

• Understand how ALUs function;
• Be able to describe a simple ALU in Verilog;
• Be comfortable designing more complex combinational circuits.

## Background

All of the circuits used in a typical ALU have already been presented in earlier projects – all that remains is gathering the various subcircuits together, and creating a new ALU component that combines all the needed features in one design. Although ALU circuits can be large and complex, the design of an ALU is rather straight-forward.

## Requirements

### 1. ALU

Create an 8-bit ALU in Verilog that supports the functions shown in the table. Connect data registers to both ALU inputs, and load the data registers from slide switches, using push buttons for load enable signals, as shown. Connect three slide switches to the ALU control input, and connect the ALU output to your seven-segment display controller through the Bin2BCD converter. Program data into the registers, and demonstrate all ALU functions. Figure 1. ALU system with input regsiters and output Bin2BCD converter
OpCode Description Output F
000 Addition $A + B$
001 Increment $A + 1$
010 Subtract $A - B$
011 Bit-wise XOR $A \oplus B$
100 Bit-wise OR $A \rvert B$
101 Bit-wise AND $A \And B$