- Control the machine and ensure that all components work in harmony.
- The controller has data exchange function, which refers to the implementation of data exchange between the CPU and the controller, as well as between the controller and the device.
- Comparing the telephone to the human body, the controller is like the human brain, outputting various commands and allowing the components to operate flexibly.
- The arithmetic unit can only perform calculations, while the controller is used to control the operation of the entire CPU.
- Through the data bus, the CPU writes data in parallel to the controller or reads data in parallel from the controller.
The hardware structure of a computer system mainly consists of four parts: controller, arithmetic unit, memory, and input/output devices, among which the controller and arithmetic unit are collectively referred to as the central processing unit. Abbreviated as CPU, it is the command center of computer hardware systems. It consists of two components: a controller and an arithmetic unit. The function of the controller is to control the coordination of various parts of the computer, while the arithmetic unit is responsible for the arithmetic and logical operations of the computer
(1) Arithmetic unit
- Arithmetic and Logic Unit (ALU)
ALU mainly performs fixed-point arithmetic operations (addition, subtraction, multiplication, and division), logical operations (AND or XOR), and shift operations on binary data. In some CPUs, there are also shifters specifically designed to handle shift operations.
Typically, ALU consists of two input terminals and one output terminal. Integer Execution Unit (IEU) is sometimes referred to as an integer unit. What we usually refer to as’ CPU is XX bits’ refers to the number of bits of data that ALU can process.
- Floating Point Unit (FPU)
FPU is mainly responsible for floating-point operations and high-precision integer operations. Some FPUs also have vector operation capabilities, while others have dedicated vector processing units.
- General Register Group
A general-purpose register group is a set of the fastest memory used to store operands and intermediate results involved in operations.
There are significant differences between RISC and CISC in the design of general-purpose registers. CISC registers are usually few, mainly due to hardware cost limitations at the time. For example, the x86 instruction set only has 8 general-purpose registers. So, the CPU execution of CISC mostly involves accessing data in memory rather than registers. This slows down the speed of the entire system. RISC systems often have a large number of general-purpose registers and utilize techniques such as overlapping register windows and register files to fully utilize register resources.
For the disadvantage of the x86 instruction set only supporting 8 general-purpose registers, the latest CPUs from Intel and AMD have adopted a technique called “register renaming”, which allows the registers of x86 CPUs to break through the limit of 8 and reach 32 or even more. However, compared to RISC, this technology requires an additional clock cycle for register operations to rename registers.
- Special register
Special registers are usually status registers that cannot be changed by programs and are controlled by the CPU itself to indicate a certain state.
(2) Controller
The arithmetic unit can only perform calculations, while the controller is used to control the operation of the entire CPU.
- Command controller
The instruction controller is a crucial part of the controller, responsible for executing operations such as fetching and analyzing instructions, and then handing them over to the execution unit (ALU or FPU) for execution, while also generating the address of the next instruction.
- Timing controller
The function of a timing controller is to provide control signals for each instruction in chronological order. The timing controller includes a clock generator and a doubling definition unit, where the clock generator emits a very stable pulse signal from a quartz crystal oscillator, which is the main frequency of the CPU; The multiplier definition unit defines how many times the CPU clock frequency is the memory frequency (bus frequency).
- Bus controller
Bus controllers are mainly used to control the internal and external buses of CPUs, including address buses, data buses, control buses, and so on.
- Interrupt Controller
The interrupt controller is used to control various interrupt requests, queue them according to their priority, and hand them over to the CPU for processing one by one.