index
Table of contents
Chapter 1: Computer Organization, Software and Hardware
1.2.1 Basic composition of computer
1.2.3 Computer System Hierarchy
Chapter 2: Conversion of various bases
2.1.2BCD码(Binary Coded Decimal)
2.2.2 The role of source code complement code shift
Chapter 1: Computer Organization, Software and Hardware
Wang Dao Computer PubMed Computer Composition Principle_哔哩哔哩_bilibili
1.1 Computer Development
1.2.1 Basic composition of computer
() Basic composition of software (omitted)
()Basic components of hardware: controller, arithmetic unit, storage, input and output devices
() Main memory: divided into storage banks, MAR, MDR, a storage bank contains several storage units, a storage unit contains several storage words; MAR registers addresses and the number of storage units, MDR registers data and storage word length
() arithmetic unit three registers + a logical arithmetic unit (ALU)
() The controller pc fetches instructions for IR analysis, and the CU executes
() Analyze the PC to find the corresponding instruction according to the address and take it away. The CU analyzes the instruction according to the opcode instruction and then finds the corresponding address to find the corresponding data and send it to ACC for logical operation
1.2.3 Computer System Hierarchy
Frequency: Periodic motion, the number of times completed per unit time. unit-1
cpi: the time required for an instruction,
Chapter 2: Conversion of various bases
2.1 Carry counting system
Observe various digital representations
The expression form of 456 is actually 6+50+400. To put it bluntly, it is the number at each position multiplied by the power of 10.
If 0101 means binary, it is 1*2 to the 0th power+0+1*2 to the 2nd power+0
Switch to binary (convert to decimal) to see that (every 2 enters 1), the 1 at the beginning means two consecutive 2s, which is 4, and the 1 at the end is 2 to the power of 0*1=1, (that is, 1+0 +4+0) final 0101 represents 5
2.1.2BCD码(Binary Coded Decimal)
BCD advantage: the main BCD code is much easier to use than the conversion between binary and decimal (this thing was invented for convenience)
8424: Represent decimal numbers in binary
For example, if 15 is expressed in binary: 1111
But it is expressed as: 0001 0101 with 8421 code
Addition of 8421 yards:
The number of digits is not enough to directly +6, (reason: )
2.1.3 Characters and strings
Chinese character encoding method: national standard code and UTF8
Big-endian mode and little-endian mode will be explained later: skip here
2.1.4 Parity code
2.1.5 Hamming check code
The parity code has no error correction ability, and secondly, the error detection ability is not good.
The formula for the minimum number of check digits to be added in the Hamming code is as follows
Practice Test (1):
(2)
2.1.6CRC
2.2.1 Representation of fixed-point numbers - unsigned numbers, signed numbers, fixed-point decimals, fixed-point integers
(Fixed-point numbers are all based on binary numbers)
(In addition to fixed-point numbers and floating-point numbers (omitted))
Simply put, fixed-point numbers are divided into unsigned numbers-signed numbers
Unsigned number: Equivalent to absolute value
Signed number: the highest digits all represent the sign bit ( the machine with the signed number indicates the original code , complement code, inverse code and shift code. )
If a fixed-point number is to represent an integer or a decimal, it can be divided into the following three cases:
- Pure integer: For example, the integer 100, the decimal point is actually the last digit, so ignore it
- Pure decimal: For example: 0.123, the decimal point is fixed at the highest position
- Integer + decimal: such as 1.24, 10.34, the decimal point is at a specified position
Integers and decimals are stored separately. The default integer decimal point is at the end, and the default decimal point is at the beginning.
Because the highest bit is the sign bit, the formal value of the machine number is not equal to the real value,
1. true value
The true value refers to a signed binary number with a "+" sign in front of the value to indicate a positive number and a "-" sign to indicate a negative number.
2. Number of machines
Machine number (also known as machine code) refers to the symbol "+" represented by "0" and the symbol "-" represented by "1" in the digital system, that is, the signed binary number after the symbol is "digitized". Commonly used machine numbers are original code, complement code and complement code.
Source range (-127-----127) complement (-128--------127)
Decimal (-(1-1/127)-------1-1/127) complement (-1-------1-1/127)
The frame shift can only represent fixed-point integers (cannot represent decimals)
2.2.2 The role of source code complement code shift
When adding unsigned numbers in fixed-point numbers, normal calculations are fine, but signed numbers are not.
2.2.3 Shift operation
The calculation of the inverse code of the source code: (extracted separately)
y source code inverse complement and its calculation
2.2.7 Mandatory type conversion
In the C language, the high byte part will be discarded directly after the forced type conversion
2.2.8 Data Storage and Arrangement