1. Original code, inverse code, complement code, code shift
In the original code, inverse code, and complement code representation, the highest bit of the machine number is the sign bit, 0 represents the positive sign, and 1 represents the negative sign . The remaining bits are the absolute value of the binary conversion of the number.
Original code : The advantage is that the correspondence between the true value of the number and its original code representation is simple, and the implementation of multiplication and division operation rules is simple, but it is inconvenient to implement addition and subtraction operations.
[ +1 ] Hara = 0 0000001 [ -1 ] Hara = 1 0000001
[ + 127] Hara = 0 1111111 [-127] Hara = 1 1111111
Inverse code : When it is a positive number, it is equal to the original code. When it is a negative number , it is bitwise inverted except for the sign bit .
[ +1 ] Inverse = 0 0000001 [ -1 ] Inverse = 1 1111110
[ +127 ] inverse = 0 1111111 [-127] inverse = 1 0000000
Complement code : When it is a positive number, it is equal to the original code. When it is a negative number , except for the sign bit, the bit is inverted, and the least significant bit is incremented by 1 .
[ +1 ] Complement = 0 0000001 [ -1 ] Complement = 1 1111111
[ +127 ] Complement = 0 1111111 [-127] Complement = 1 0000001
Code shift : Invert the sign bit of the complement code
[ +1 ] shift = 1 0000001 [ -1 ] shift = 0 1111111
Second, CPU
Function : program control, operation control, time control, data processing.
Composition : arithmetic unit, controller, register bank, internal bus
The arithmetic unit includes: arithmetic logic unit ALU , accumulation register AC, data buffer register DR, state condition register PSW
The controller includes: instruction register IR , program counter PC, address register AR, instruction decoder ID
3. Hamming code
The composition method is to insert k check bits at certain positions between data bits, and to realize error detection and error correction by expanding the code distance.
Assuming that the data bits are n bits and the parity bits are k bits, then n and k must satisfy the following relationship:
2^k -1≥n + k
4. Instruction pipeline processing
5. Computer reliability
Suppose a system consists of N subsystems: the reliability of each subsystem is represented by R 1 , R 2 , ..., R N respectively , how to calculate the reliability R of the system:
In a series system : R=R 1 *R 2 … *R N
In a parallel system : R=1-(1-R 1 )(1-R 2 )…(1-R N )