Principles of computer composition [1] First understanding of hardware

Table of contents

Test point 1: Hardware development ——————————————————————————————

1. Basic composition of computer hardware

1. Early von Neumann machines

(1) Features of von Neumann computer:

2. Structure of modern computer

3. Summary diagram

2. The working principle of each hardware

1. Register MAR, MDR

2. Main storage (memory)

Test point 2: The following definitions —————————————————————————————

3. Calculator

4. Controller

5. Run the instance

Topic: Analyze the CPU operation of this C language

 (0) PC points to the fetch operation at address 0: fetch a from address 5 and put it into ACC.

(1) execute a*b

(2) Execute ab+c

 (3) Store the result of ab+c in address 8

(4) Execute the shutdown command in memory 4

 (5) Summary

3. Hierarchical structure of computer system

1. Five-layer structure

2. Compiled language, interpreted language

3. Summary

4. Computer Architecture vs Computer Composition Principles

4. Computer Performance Indicators

1. CPU performance indicators

(1) CPU main frequency, CPI

(2) IPS,FLOPS

2. Overall system performance indicators

(1) Static indicators


Moore's Law: reveals the speed of information technology progress
The number of transistors that can be accommodated on an integrated circuit will double approximately every 18 months, and the overall performance will also double

Test point 1: Hardware development ——————————————————————————————

The first generation: the era of electronic tubes
The second generation: the era of transistors
The third generation: the era of small and medium-scale integrated circuits
The fourth generation: the era of large-scale and ultra-large-scale integrated circuits

1. Basic composition of computer hardware

The structure of early Von Neumann machines:
(1) The basic composition of computer hardware
(2) The structure of modern computers
 

1. Early von Neumann machines

(1) Features of von Neumann computer:

1. The computer is composed of five major components.
2. Instructions and data are stored in the memory at the same position
, and can be searched by address . 3. Instructions and data are expressed in binary.
4. Instructions are composed of operation codes and address codes.
5. Store programs
6. Use arithmetic units as the center (the data transmission between the input/output device and the memory is completed through the arithmetic unit as a transfer)

2. Structure of modern computer

Von Neumann needs to use the arithmetic unit as a transfer to complete the inefficiency, and the structure of modern computers directly puts the book data into the memory

CPU=calculator+controller

Because CPU=calculator+controller, the above figure can be simplified to the following figure:

 Primary storage is main storage (memory), secondary storage (hard disk)

 

3. Summary diagram

2. The working principle of each hardware

1. Register MAR, MDR

 Data is what a computer wants. CPU is different from Cainiao Station: CPU can not only fetch data but also write data.

MAR: address register, used to indicate which memory unit to read/write. The number of bits reflects the number of storage units
MDR: data register, used to temporarily store data to be read/written. Its number of bits = storage word length

Note: MAR and MDR logic belong to the main memory, but current computers usually integrate MAR and MDR into the CPU .

2. Main storage (memory)

MAR: Indicates the address of the storage unit.

Test point 2: The following definitions —————————————————————————————

Storage unit: Each storage unit stores a string of binary codes
Storage word (word): the binary code (combination) in the storage unit
Storage word length: the number of bits of the binary code in the storage unit Storage unit
: the electronic component that stores binary, each A storage element can store 1bit

Example:
MAR=4 bits --> There are 2^4 storage units in total
MDR=16 bits --> Each storage unit can store 16 bits,
1 word (word) = 16 bits
Confused: 1 byte (Byte) = 8bit
1B=1 byte, 1b=1 bit

Example: Download speed 100Mbps (100Mb percent second 100 megabits per second), 1Byte= 8bit, 100Mbps/8=12MB/s

3. Calculator

Calculator: used to implement arithmetic operations (such as: addition, subtraction, multiplication and division), logic operations (such as: AND or not)

ACC: Accumulator, used to store operands or operation results
MQ: Multiplication quotient register, during multiplication and division operations , used to store operands or operation results .
X: General-purpose operand register, used to store operands (there can be more than one, but theoretically one is enough) ALU: Arithmetic logic unit, which realizes arithmetic operations and logic operations
through internal complex circuits

4. Controller

CU: Control unit, analyzing instructions, and giving control signals
IR: Instruction register, storing the currently executed instruction
PC: Program counter, storing the date of the next instruction, with automatic increment function
Control Unit
Instruction Register
Program Counter

5. Run the instance

Topic: Analyze the CPU operation of this C language

 (0) PC points to the fetch operation at address 0: fetch a from address 5 and put it into ACC.

The first instruction below is divided into 9 uops

After the PCC executes the "fetch instruction" operation, it will be +1, pointing to address 1

(1) execute a*b

(2) Execute ab+c

 (3) Store the result of ab+c in address 8

(4) Execute the shutdown command in memory 4

 (5) Summary

 

3. Hierarchical structure of computer system

1. Five-layer structure

There is a one-to-one correspondence between assembly and binary machine instructions, and each binary machine instruction needs to execute multiple microinstructions on the hardware. The upper three layers belong to software, and the lower two layers belong to hardware (the meter group focuses on the lower two layers).

2. Compiled language, interpreted language

C and C++ are called compiled languages. Such as: JavaScript, Python, and Shell are called interpreted languages. The compiled language is translated into machine language in one step (the compiler program is similar to our translation of all Chinese articles into English articles); while the interpreted language is translated into machine language one by one (the interpreter program is similar to saying a sentence to translate a sentence). So compiled languages ​​are efficient.

Note: Compilation, assembly, and interpretation programs can be collectively referred to as " translation programs ", and their functions are to translate high-level languages ​​into low-level languages

3. Summary

4. Computer Architecture vs Computer Composition Principles

 

4. Computer Performance Indicators

1. CPU performance indicators

(1) CPU main frequency, CPI

10Hz=10 pulses/s, the CPU main frequency means the number of CPU pulses or clock cycles per second (1 pulse=1 clock cycle)

(2) IPS,FLOPS

IPS=main frequency/average CPI, main frequency: indicates the clock cycle of the CPU per second, average CPI: the number of clock cycles required to execute an instruction, then IPS is how many instructions are executed per second

(The file size is in binary units, and the hardware processing rate above is in decimal units, for example, the main frequency is 3GHZ=3*10^9HZ=3 billion HZ)

example:

2. Overall system performance indicators

(1) Static indicators

 Question: Is a CPU with a high main frequency necessarily faster than a CPU with a low main frequency?
Not necessarily, there is also an indicator of CPI, for example: two CPUs, the main frequency of A is 2GHz, and the average CPI=10; the main frequency of B is 1GHz, Average CPI=1.

A: IPS=2/10=0.2G instructions/s; B: IPS=1/1=1G instructions/s, then machine B here is faster

Question: If the average CPI of two CPUs A and B are the same, then A must be faster?
Not necessarily, it depends on the instruction system. For example, A does not support multiplication instructions, and can only use multiple additions to achieve multiplication; while B supports multiplication instruction.

Question: (Does the faster the benchmark program executes, the better the performance of the machine?
There are differences in the frequency of statements in the benchmark program, and the running results cannot fully explain the problem

Guess you like

Origin blog.csdn.net/zhang_si_hang/article/details/128477539