Project 10 Arithmetic and Logic Unit (ALU)

Introduction to ALU's

2361

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 (the registers must be loadable using the slide switches for data and pushbutton for clocks). Connect three slide switches to the ALU control input. Connect the ALU output to your seven-segment display controller. Program data into the registers, and demonstrate all ALU functions.

OpCode Description Output F
000 Addition A+BA + B
001 Increment A+1A + 1
010 Subtract ABA - B
011 Bit-wise XOR ABA \oplus B
100 Bit-wise OR ABA \rvert B
101 Bit-wise AND A&BA \And B

Challenges

1. Added ALU features

Add four status outputs to your ALU to indicate when:

  1. the ALU output is 0;
  2. the ALU output is negative (assuming 8-bit 2’s compliment numbers);
  3. the output resulted a carry out of the MSB;
  4. the output is incorrect due to overflow or underflow.

Connect the four status outputs to LEDs and verify their function.