The ALU inside the CPU is the hardware circuitry that performs arithimetic (add, sub, mult, div) and logic (AND, OR, XOR) operations. In order for the ALU to perform its function, it must have the appropriate inputs and control signals to select which circuitry to activate that matches the desired operation. For example, if you want to perform an add operation on two numbers, these two numbers must be placed in special input registers on the ALU bus. Once the two values are in place, the internal control unit of the CPU sends a set of signals to the ALU that activate the add circuitry which reads the two input numbers, and places the result into an output register where it can be picked up by the CPU to send to the application. The machine level instruction that comes from the compiled application code contains the binary information that defines the operation (add) and points to the location of the operands (inputs and output destination). The ALU is composed of a network of logic gates (AND, OR, INVERTERS and MULTIPLEXORS) that form the paths to implement all the possible arithmetic and logic operations. Hope this helps a little.
Comments
The ALU inside the CPU is the hardware circuitry that performs arithimetic (add, sub, mult, div) and logic (AND, OR, XOR) operations. In order for the ALU to perform its function, it must have the appropriate inputs and control signals to select which circuitry to activate that matches the desired operation. For example, if you want to perform an add operation on two numbers, these two numbers must be placed in special input registers on the ALU bus. Once the two values are in place, the internal control unit of the CPU sends a set of signals to the ALU that activate the add circuitry which reads the two input numbers, and places the result into an output register where it can be picked up by the CPU to send to the application. The machine level instruction that comes from the compiled application code contains the binary information that defines the operation (add) and points to the location of the operands (inputs and output destination). The ALU is composed of a network of logic gates (AND, OR, INVERTERS and MULTIPLEXORS) that form the paths to implement all the possible arithmetic and logic operations. Hope this helps a little.