How does the CPU work? The CPU comprises of the following components as stated below. PREFETCH UNIT CONTROL UNIT ALU/FPU DECODE UNIT REGISTERS INTERNAL CACHE MEMORY BUS INTERFACE UNIT OUTPUT INPUT Arithmetic/logic Unit (ALU) and Floating Point Unit Arithmetic Logic Unit-is the section of the CPU core that performs arithmetic(addition,subtraction,multiplication and division) involving integers and logical operations such as comparing two pieces of data to see if they are equal or determining if a specific condition is true or false. Arithmetic requiring decimals is usually performed by the floating point unit(FPU).
Arithmetic operations are perfomed when mathematical calculations are requested by the user,as well as when many other common computing tasks are performed. Most CPUs today have multiple ALUs and FPUs that work together to perform the necessary operations. Control Unit Coordinates and controls the operations and activities taking place within a CPU core such as retrieving data and instructions and passing them on to the ALU or FPU for execution. In other words it directs the flow of electric current within the core,much like a traffic cop controls the flow of vehicles on a roadway.
The control unit tells ALU and FPU what to do and makes sure that everything happens at the right time in order for the appropriate processing to take place. Prefetch Orders data and instructions from cache or RAM based on the current task. The prefetch unit tries to predict what data and instructions will be needed and retrieves them ahead of time,in order to help avoid delays in processing. Decode Unit Takes the instructions fetched by the prefetch unit and translates them into a form that can be understood by the control unit,ALU and FPU. The decoded instructions go to the control unit for processing. Registers and Internal Cache Memory
Registers and Cache memory are both types of memory used by the CPU. Registers are groups of high-speed memory located within the CPU that are used during processing. The ALU and FPU use registers to store data, intermediary calculations and the results of processing temporarily. Internal Cache memory is used to store instructions and data for the CPU,to avoid retrieving them from RAM or the hard drive. Bus Interface Unit It allows the core to communicate with other CPU components,such as the memory controller and other cores. The memory controller controls the flow of instructions and data going between the CPU cores and RAM.