CS 202 - Problem Nine: ALU
2026-03-18T23:59
Goals
- Create a critical part of the ARM processor
Objective
For this problem, you will construct an ALU for an ARM32 processor. It will support all the arithmetic and logical operations entailed by the ARM32 instructions we have looked at in class, as well as some other important ones.
Here is the desired behavior of the ALU
| operation | result |
|---|---|
| 0000 | operand_0 bitwise-AND operand_1 |
| 0001 | operand_0 bitwise-XOR operand_1 |
| 0010 | operand_0 minus operand_1 |
| 0011 | operand_1 minus operand_0 |
| 0100 | operand_0 plus operand_1 |
| 1100 | operand_0 bitwise-OR operand_1 |
| 1101 | operand_1 |
| 1111 | bitwise-NOT operand_1 |
In addition to the result of the computation, your ALU should output four values that will be used to set the CPSR flags. The four values are:
C - carry N - negative Z - zero V - overflow (sort of)
The C and V flags are only relevant for arithmetic operations, for logical operations they can return zero. The V value is the strangest (and most annoying) of the four as it indicates a carry in to bit 31. It does not actually indicate overflow. We would use it in conjunction with C to determine if there was overflow.
Requirements
- your work must be in a file called
alu.circ - your implementation must be in the
maincircuit (you are welcome to create sub-circuits however) - your circuit must have three inputs:
operand_0,operand_1, andoperation. operand_0andoperand_1are 32-bitsoperationis a 4-bit input- your circuit should have one output called
result resultshould be 32-bits.- the value of
resultshould reflection what happens whenoperationis applied tooperand_0andoperand_1. - the value of
Nwill indicate ifresultis potentially negative (i.e., look at bit 31) - the value of
Zwill indicate if theresultis zero - the value of
Cwill indicate that there was a carry out from bit 31 arithmetic operations. It should be zero for logical operations - the value of
Vwill indicate that there was a carry in to bit 31. It should be zero for logical operations - you are restricted to
- input pins
- output pins
- splitters
- components in the Gates library (i.e., basic logic gates)
- components from the Arithmetic library
- components in the Plexers library
Submission
Upload your .circ file to Gradescope.