The relationship between CPU architecture and instruction set

1 CPU architecture

        The CPU architecture is a specification set by CPU manufacturers for CPU products belonging to the same series. The main purpose is to distinguish important marks of different types of CPUs. At present, the CPU classification on the market is mainly divided into two camps, one is the complex instruction set CPU headed by Intel and AMD, and the other is the reduced instruction set CPU headed by IBM and ARM. CPUs of two different brands have different product architectures. For example, the CPUs of Intel and AMD are based on the X86 architecture, while the CPUs of IBM are based on the PowerPC architecture, and the CPUs of ARM are based on the ARM architecture.

2 instruction set

        Computer instructions are the instructions and commands to direct the machine to work, and the program is a series of instructions arranged in a certain order. The process of executing the program is the working process of the computer. The instruction set is a set of instructions used in the CPU to calculate and control the computer system, and each new type of CPU specifies a series of instruction systems that cooperate with other hardware circuits when it is designed . Whether the instruction set is advanced or not is also related to the performance of the CPU , and it is also an important symbol of the performance of the CPU . The strength of the instruction is also an important indicator of the CPU, and the instruction set is one of the most effective tools to improve the efficiency of the microprocessor. From the perspective of the mainstream architecture at this stage, the instruction set can be divided into two parts : the complex instruction set and the reduced instruction set .

        Complex instruction set , also known as CISC instruction set, the English name is CISC, (Complex Instruction Set Computing abbreviation). In a CISC microprocessor, each instruction of the program is executed serially in sequence, and each operation in each instruction is also executed serially in sequence. The advantage of sequential execution is that the control is simple, but the utilization rate of each part of the computer is not high, and the execution speed is slow. In fact, it is the x86 series (that is, IA-32 architecture) CPU produced by Intel and its compatible CPU, such as AMD and VIA. Even the new X86-64 (also known as AMD64) belongs to the category of CISC.

        RISC : Reduced Instruction Set Computing RISC is a microprocessor that executes fewer types of computer instructions. It originated from the MIPS host (ie RISC machine) in the 1980s. The microprocessors used in RISC machines are collectively referred to as RISC processor. This allows it to perform operations faster (more million instructions per second, or MIPS). Because computers require additional transistors and circuit elements to execute each instruction type, a larger computer instruction set makes the microprocessor more complex and slower to perform operations. John Cocke of the IBM Research Center in Yorktown, New York, proved that about 20% of the instructions in the computer undertake 80% of the work. In 1974, he proposed the concept of RISC. Many current microchips use RISC concepts.

      The difference between complex instruction set and reduced instruction set The difference between simplified instructions and complex instructions! Good text - Chu Guangming - Blog Garden (cnblogs.com)

        The mainstream CPU architecture can be distinguished according to complex and simplified instruction sets as follows:

  • CISC:x86;
  • RISC: arm, RISC-V, LoongArc (Godson), MIPS;

3 Comparison of the characteristics of x86, ARM, MIPS and loongARC architectures

(1) x86

Architectural features: large instruction system, complex functions, multiple addressing modes, variable length, and multiple formats; various instructions can access memory data; some instructions require multiple machine cycles to complete; complex instructions are implemented using microprograms; System compatibility is strong.

Architecture advantage: The x86 architecture has strong compatibility, the supporting software and development tools are relatively mature, and the x86 architecture is powerful and uses the main memory efficiently, so it has great advantages in processing complex instructions and the application of commercial computing.

Main application areas or usage scenarios: servers, workstations and personal computers, etc.

(2) ARM

Architectural features: instruction length is fixed, easy to decode and execute; most instructions can be executed conditionally, reducing the overhead incurred in branching and making up for the lack of branch predictors; arithmetic instructions will only change the conditional code when required.

Architecture advantage: ARM structure has the characteristics of low power consumption and small size, focusing on the mobile terminal market, and has advantages in consumer electronics products.

Main application areas or usage scenarios: smart phones, tablet PCs, industrial control, network applications, consumer electronics, etc.

(3) MIPS

Architectural features: use 32-bit registers; most instructions are executed in one cycle; all instructions are 32-bit, and use fixed-length coded instruction set and pipeline mode to execute instructions; have high-performance cache capability, and the memory management scheme is relatively flexible.

Architecture advantages: MIPS has a simple structure design and low power consumption, which has advantages in embedded application scenarios.

Main application areas or usage scenarios: desktop terminals, industrial, automotive, consumer electronics systems, and special equipment such as radio communications.

(4) longARC

Architecture features: Integrate the main features of mainstream instruction systems such as X86/MIPS/ARM, and efficiently support binary translation. Maintain the typical RISC style: fixed-length 32 general-purpose fixed/floating-point load-store structure; cancel the delay slot, add operation instructions with PC as the source operation; realize bit operations and other instructions that most instruction sets choose to add.

4 CPU Architecture and Instruction Set Relationship

        Once the hardware structure of the CPU, that is, the architecture, is determined, the functions that can be realized by the CPU using the architecture are basically the same, and the instruction sets to realize the functions are also basically the same.

        The design of the CPU architecture determines the instruction set, such as the X86 instruction set, because the CPU adopts the X86 structure, so it is called the X86 instruction set; the instruction set refers to all the functions that a certain architecture CPU can implement, and the code numbers corresponding to these functions Constitute the instruction set; the code number should refer to the underlying code of the machine code. After a certain architecture CPU architecture is determined, the code number is determined. These numbers reflect the way the CPU performs certain functions and determine the hardware. Execution method; as mentioned above, these code numbers may be machine codes, machine codes are binary numbers, and the binary numbers are reflected on the circuit as high and low levels, thereby driving the circuit to operate; the binary numbers of different code numbers are arranged differently, so the level of the driving circuit The levels are different, so the way the circuit performs is different.

        Same function <- different circuit implementation <- CPU of different architecture <- different instruction set <- assembly language <- same program

Summary: CPUs with different architectures are ultimately reflected in different ways for the CPU to achieve the same function, or some CPUs have functions that other CPUs cannot implement, which is unique to a certain architecture; and different instruction sets implement different translations for the upper-level code , different circuit implementations for the next operation.

Reference link: Some personal understanding about CPU architecture and instruction set - warmbeast - Blog Park (cnblogs.com)

Guess you like

Origin blog.csdn.net/weixin_42121713/article/details/128243572