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 two input data registers to the ALU inputs (the registers must be loadable using the slide switches for data and pushbutton for enables), and drive the ALU Op Code input from three slide switches. Connect the ALU output to your Hex seven-segment display controller. Program data into the registers, and demonstrate all ALU functions.
OpCode | Description | Output F |
---|---|---|
000 | Addition | A + B |
001 | Increment | A + 1 |
010 | Subtract | A - B |
011 | Multiply | A * B |
100 | Not | not A |
101 | Bit-wise XOR | A xor B |
110 | Bit-wise OR | A or B |
111 | Bit-wise AND | A and B |
2. Status Outputs
Add four status outputs to your ALU to indicate when:
- the ALU output is 0;
- the ALU output is negative (assuming 8-bit 2’s compliment numbers);
- the output resulted a carry out of the MSB;
- the output is incorrect due to overflow or underflow.
Connect the four status outputs to LEDs and verify their function.
Challenges
1. Add a display mux
Add a multiplexor to the seven-segment display inputs so that you can show the input operands (using two Hex digits each), or the output result. Use the last open slide switch to control the mux.
2. Display in Decimal
Add a binary-to-BCD conversion circuit so that all data is shown in decimal.