The principle of computer composition-basic composition into the calculation of floating point number

The notes come from the Wangdao postgraduate entrance examination video

Chapter One

Transmit information through electrical signals (low level represents 0, high level represents 1)

computer system

Computer system = hardware + software

software

system software application
Operating system, database management system (DBMS), standard library (library functions used in programming), network software (implementing such as TCP/IP protocol), language processing program (converting high-level language into low-level language), service program ( Debugger) WeChat, QQ
Used to manage the entire computer system Various programs compiled according to task needs

Hardware development (logic element)

  1. The first digital computer: ENIAC (1946)-electronic tube
  2. Transistor (prototype with operating system)
  3. Small and medium scale integrated circuits
  4. Large-scale, very large-scale integrated circuits (operating systems appear)

  • In 1947, Bell Laboratories invented the "transistor" (Shockley)
  • In 1959, Fairchild Semiconductor Company invented "Integrated Circuit" (Eight Renegade)
  • Moore, the creation of Intel (Moore's Law: The number of transistors that can be accommodated on an integrated circuit doubles every 18 months, revealing the speed of information technology progress)

Software development

Machine language -> assembly language -> high-level programming language


Current development trend

  • More miniature, multi-purpose
  • Bigger, super high speed

The basic composition of computer hardware

Early von Neumann machine

Insert picture description here

Features of von Neumann machine

  1. The computer consists of five major components
  2. Instructions and data are stored in the memory with the same status and can be accessed by address
  3. Instructions and data are expressed in binary
  4. The instruction is composed of opcode and address code
  5. Stored procedure
  6. Arithmetic center

Modern computer architecture

Insert picture description here

  • Because the arithmetic unit and the controller are closely related, we integrate it into a whole CPU
  • Input devices and output devices are collectively called I/O devices
  • So the modern computer structure can be divided into:
    • CPU
    • Main memory (CPU and main memory are also called host)
    • I/O device

Insert picture description here

Main memory: such as mobile phone running memory 8GB

Auxiliary storage: such as 128GB of body memory


Main memory

Insert picture description here
Insert picture description here
Storage> Storage Unit> Storage Unit


Arithmetic unit

Insert picture description here


Controller

Insert picture description here

Computer working process (example)

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here


Insert picture description here


Computer system hierarchy

Insert picture description here

Insert picture description here

The program that translates high-level language into machine language is called translation program (including two types)

  • Compiler: Translate all the statements of the high-level language program (source program) written by the user into a machine language program at once, and then execute the machine language program. Therefore, as long as the source program remains unchanged, there is no need to translate again
  • Interpreter program: Translate a statement of the source program into a statement corresponding to the machine language, and execute this statement immediately, then translate the next statement of the source program, execute this statement, and repeat. Therefore, translate it once and execute it once, even if the sentence is repeated next time, it must be translated again.

The difference between computer architecture and computer composition principles

Insert picture description here

Computer performance indicators

Memory performance index

Insert picture description here

Insert picture description here


CPU performance indicators

Insert picture description here


Overall system performance indicators

Insert picture description here


Thinking

Insert picture description here

review

Insert picture description here


Chapter two

Base conversion

Convert other bases to decimal

Insert picture description here


Binary<–> Octal, Hexadecimal

  • Three binary digits correspond to one octal digit

  • Four binary digits correspond to one hexadecimal digit

Insert picture description here


Decimal -> Arbitrary

  • Integer part: Divide the base and take the remainder
  • Decimal part: multiply the base and take the remainder

Insert picture description here

Insert picture description here


Truth value and number of machines

Insert picture description here


BCD code

Insert picture description here


Insert picture description here


ASCII code

Insert picture description here

Insert picture description here


Chinese character representation

Insert picture description here


String representation

Insert picture description here


Parity check code

  • Can only detect errors, not correct errors

Insert picture description here

Insert picture description here


Insert picture description here


Hamming check code

Insert picture description here


Insert picture description here


Insert picture description here

Insert picture description here


Cyclic Redundancy Check (CRC)

  • Can detect errors, but cannot correct errors (in fact, when there are few information bits, sometimes it has the ability to correct errors)

Insert picture description here


Insert picture description here


Fixed-point representation

Unsigned number

All binary bits of the word length of the entire machine are numeric bits, without sign bits, equivalent to the absolute value of the number (usually an integer)

Signed number

Original code

Insert picture description here


Insert picture description here


Complement

Insert picture description here


Complement

Insert picture description here


Frameshift

  • Can only represent integers

Insert picture description here


to sum up

The method of [-x] complement by [x] complement- sign bit, all value bits are inverted, and the last bit is increased by 1

Insert picture description here


Insert picture description here


The role of original code, complement, and frameshift

The role of the complement: transform the subtraction operation into an equivalent addition (that is, when adding a negative number, it is equivalent to adding the complement of the negative number)

Insert picture description here


The role of frameshift: easy to compare size

Insert picture description here


Fixed-point operations

Arithmetic shift right

Insert picture description here


Arithmetic shift left

Insert picture description here


Arithmetic shift

Insert picture description here


Arithmetic shift of complement

Insert picture description here


Arithmetic shift summary

Insert picture description here


For example

Insert picture description here


Logical shift

Insert picture description here


Insert picture description here


Cyclic shift

Insert picture description here

Addition and subtraction operations and overflow judgment

Addition and subtraction

  • In the complement operation, the sign bit also participates in the operation

Insert picture description here


Overflow judgment


Insert picture description here


  • After the operation, the double sign bit 01-indicates overflow; 10-indicates underflow

Insert picture description here


Sign extension

Insert picture description here


Source code multiplication

  • The shift of the original code multiplication is a logical shift, and the sign bit also participates in the shift

Insert picture description here


Insert picture description here


Insert picture description here


Two's complement multiplication

Insert picture description here


Machine realization

Insert picture description here


  • The last addition, because the sign bit also participates in the operation
  • Complementary multiplication is arithmetic shift, and the sign bit is fixed.
  • Shift right arithmetic for positive numbers, add 0 to high bits
  • Negative number arithmetic shift right, high bit complement 1

Insert picture description here


Original code division

Insert picture description here


Machine realization: restoring remainder method

Insert picture description here

Insert picture description here


Restoring remainder method

Insert picture description here

No recovery remainder method (addition and subtraction alternate method)

  • If the remainder is negative, the quotient is 0 directly, and the remainder is shifted one place to the left (multiplied by 2), and the divisor is added to obtain the new remainder
  • The divisor must be smaller than the dividend, because the decimal binary digits cannot represent a number greater than 1, which means that the quotient in the first step must be 0

Insert picture description here


Two's complement division

Insert picture description here

Insert picture description here


Forced type conversion

Insert picture description here


Data storage and sorting

Large and small storage

Insert picture description here


Border alignment

Insert picture description here


Representation of floating point numbers

The range of fixed-point numbers is limited

Insert picture description here

The above floating-point number representation will lose precision, we can normalize its representation to reduce precision loss

Insert picture description here


Zuogui and Yougui

  • When overflow, the highest bit of the double sign bit is the correct sign

Floating point number normalization characteristics

Insert picture description here


Insert picture description here


IEEE 754

triple

The true value of -128, -127 has other uses

So the true value range is -126~127

Insert picture description here


  • Hidden represents the highest bit 1, in order to meet the characteristics of floating-point number normalization

Insert picture description here


Example

Insert picture description here

Insert picture description here


Maximum and minimum absolute value of IEEE single-precision floating-point number

Insert picture description here

Insert picture description here


Floating point operations

Insert picture description here

Insert picture description here


Forced type conversion

Insert picture description here


Insert picture description here


logic operation

Arithmetic Logic Unit (ALU)

Insert picture description here


Gate circuit

Insert picture description here


Insert picture description here


Compound logic

Insert picture description here

Insert picture description here


Adder

One full adder

Insert picture description here


Serial adder

Insert picture description here


Parallel adder

Insert picture description here


Adder, ALU improvement

Optimization of Parallel Adder

Insert picture description here


Insert picture description here


Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_46250447/article/details/112849724