The ALU used for my CPU works on two 8-bit wide input values, and provides an 8-bit wide output value. The ALU provides in sum 16 different operations, which can be integer (signed and unsigned) operations and logical operations. The ALU is driven by the ALU opcode which includes the 4-bit long ALU function code, which tells the ALU which operation to execute.
Each ALU module was designed and implemented on its own, and finally all 16 modules are connected together to each other to provide the final functionality of the ALU. The downloads at the very end of this page provides you a schematic overview how the individual ALU modules are connected to each other and how the ALU is driven by the Instruction Decoder.
The ALU provides all the common Logical Operations found in every CPU:
Besides the Logical Operations the ALU also provide a lot of different function codes to be able to perform Integer Arithmetic (signed and unsigned):
In addition to the Logical Operations and the Integer Arithmetic the ALU also provides a few other functions necessary to work with the CPU:
Besides the Logical Operations and the Integer Arithmetic the ALU also produces the following Flags, which are used to implement the various Conditional Jumps: