The 4-Bit ALU is designed to perform various arithmetic and logical operations on 4-bit binary numbers. It supports operations such as addition, subtraction, multiplication, division, and several logical operations. Additionally, it includes an encryption function that can be used to encrypt 4-bit inputs using an 8-bit key. This capstone project is from the MIT BWSI Basics of ASICs class.
The module accepts two 4-bit binary numbers, a
and b
, and a 4-bit operation code (opcode
) that determines the operation to be performed. The results are then output through the uo_out
wire, while additional status information, such as carry out and overflow, is output through the uio_out
wire. The uio_oe
wire controls the enable or disable functionality for the uio_in
and uio_out
wires.
a
and b
, producing a 4-bit result and a carry out.b
from a
, producing a 4-bit result and a borrow indication.a
and b
, producing an 8-bit result.a
by b
, producing a 4-bit quotient and remainder. Division by zero is handled by returning a zero result.a
and b
.a
and b
.a
and b
.a
, with b
being ignored.a
and b
using an 8-bit key derived from concatenating a
and b
. The encryption function applies an XOR operation between this 8-bit concatenated value and a fixed 8-bit key. The result is an 8-bit encrypted value.To test this 4-bit ALU chip, set the values for a and b based on the 4-bit binary values for each, as well as the 4-bit operation code. The output can be up to 8-bits, using the uo pins along with the first 4 bidirectional pins. The uio pin 6 is used for the carry out, and the uio 7 is used for the overflow.
N/A
# | Input | Output | Bidirectional |
---|---|---|---|
0 | a[0] | result[0] | opcode[0] |
1 | a[1] | result[1] | opcode[1] |
2 | a[2] | result[2] | opcode[2] |
3 | a[3] | result[3] | opcode[3] |
4 | b[0] | result[4] | |
5 | b[1] | result[5] | |
6 | b[2] | result[6] | carry_out |
7 | b[3] | result[7] | overflow |