150 likes | 183 Views
Learn how an Arithmetic Logic Unit (ALU) functions, from basic operations like AND, OR, ADD, and SUB to extending to multi-bit precision. Explore the integration of selectors, multiplexers, and opcodes in creating a powerful ALU. Understand how to detect overflow and handle complex operations in a 32-bit ALU setup. Dive into the core of computer processing with this detailed guide.
E N D
CSSE 132Arithmetic Logic Unit Monday, September 16, 2019 Adapted from CMU 15-213/18-213/15-513
Questions • ALU is an "all-in-one" circuit that perform multiple operations. • It can do AND, OR, ADD and more • How to select an operation? • Multiplex • How to build an arithmetic logic unit? • AND,OR, ADD, SUB, SLT and etc. • How to extend to multi-bit?
Introduce ALU (Arithmetic Logic Unit) • The “brawn” of the computer
Mutiplexer • Given inputs A and B, we also need a “selector” to choose what we want to perform
Build a bit Multiplexer (cont.) • Given input A, B, and S
ALU (Arithmetic Logic Unit) • Introduce the “opcode” – the selector
ALU (adding Addition) • Basic one-bit ALU with addition
ALU (adding Subtraction ) • + 1 • Add “binvert” • Set CarryIn to 1 for the least significant bit
Multibit ALU Op(2) • A 32-bit ALU
Multibit ALU (adding Set Less Than) • Set when is less than. (slt) • ”Less” as input and “set” as output • The sign bit of MSB • Connect the MSB to LSB of less: e.g, 0..001
Multibit ALU (Overflow detection) • Only matters in MSB ALU