CS 202 - Problem Nine: ALU

Published

March 13, 2026

Due
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 main circuit (you are welcome to create sub-circuits however)
  • your circuit must have three inputs: operand_0, operand_1, and operation.
  • operand_0 and operand_1 are 32-bits
  • operation is a 4-bit input
  • your circuit should have one output called result
  • result should be 32-bits.
  • the value of result should reflection what happens when operation is applied to operand_0 and operand_1.
  • the value of N will indicate if result is potentially negative (i.e., look at bit 31)
  • the value of Z will indicate if the result is zero
  • the value of C will indicate that there was a carry out from bit 31 arithmetic operations. It should be zero for logical operations
  • the value of V will 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.