
It is an ALU with AND, OR, XOR and ADD operations. It takes in two 3-bit operands as well as a 2-bit OPCODE and outputs a 3-bit output as well as carry and negative flags.
All operations are done simultaneously for each input. A multiplexer is then used to select which operation to forward to the output.
| OPC | Operation |
|---|---|
| 0 0 | AND |
| 0 1 | OR |
| 1 0 | XOR |
| 1 1 | ADD |
| input 7, 6, 5, 4, 3, 2, 1, 0 | output 4, 3, 2, 1, 0 |
|---|---|
| B[7:5] A[4:2] OPC[1:0] | Z C Y[2:0] |
| -------------------------------- | ------------------------ |
| 0 0 0 0 0 0 0 0 | 1 0 0 0 0 |
| 0 0 1 0 1 0 0 1 | 0 0 0 1 1 |
| 0 1 1 0 0 1 1 1 | 0 0 1 0 0 |
I used an 8-input DIP switch to simulate the inputs and LEDs to show the outputs.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | OPC_0 | Y_0 | |
| 1 | OPC_1 | Y_1 | |
| 2 | A_0 | Y_2 | |
| 3 | A_1 | FlagC | |
| 4 | A_2 | FlagZ | |
| 5 | B_0 | ||
| 6 | B_1 | ||
| 7 | B_2 |