After previously building the NAND, Full Adder, Full Subber, and Comparator, I felt ready to tackle the Arithmetic Logic Unit (ALU). Since I’m not certain exactly what opcodes and microcodes I’ll be implementing later, I wasn’t sure which functions to include in the ALU. Working off of the list of operations from the 16 bit ALU from Warren’s Microcoded CPU, I decided on the following 20 operations: addition, subtraction, multiplication, division, remainder, negation, greater than, equal to, less than, AND, OR, NAND, NOR, NOT, XOR, Logical Shift Left, Logical Shift Right, Logical Rotate Left, Logical Rotate Right, and Arithmetic Shift Right. There are some extra slots on the MUX available in case I need to go back and add some operations later.
There’s a flag output for carry_out and borrow_out from the addition and subtraction operations. I decided against including the in and out flags for the multiplication operation for simplicity’s sake and may need to come back and include that later if the micro-codes require it.
(Click on image for higher resolution version).