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.
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.
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.
1. Added ALU features
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.