Lecture Notes: Computer Organization
COMP1003 Computer Organisation
Prof. Haipeng GUO
Lec01
What is a Computer?
- Definition:
A computer is an electronic, digital, general-purpose machine that follows follows a step-by-step list (computer program) of instructions for solving a problem
计算机是一个电子的、数字化的通用机器,它按照逐步指令程序解决问题。
Turing Machine
1936年,Alan Turing。
Definition:
Turing machine, which is the abstract model of all computersComponents:
- a tape divided into cells
- a moving read/write head
- a state register storing the state of the Turing machine
- a finite table of instruction
The Church-Turing Thesis: All things that can be computed can be computed by a Turing machine
Universal Turing Machine: a Turing machine that could simulate all other Turing machines.
It is programmable – so it is a computer!
A computer is a Universal Turing Machine!
Historical Development
- Generation Zero: Mechanical Calculating Machines (1642-1945)
- The First Generation: Vacuum Tube Computers (1945-1953)
- The Second Generation: Transistor Computers (1954-1965)
- The Third Generation: Integrated Circuit (IC) Computers (1965-1980)
- The Fourth Generation: VLSI(Very-Large-Scale Integration) Computers (1980-)
Von Neumann Architecture
Also called stored-program architecture
Both data and program are stored in the memory
Components:
CPU (control unit, ALU, registers), memory, and an I/O system.
CPU(控制单元,算术逻辑单元,寄存器)、内存和I/O系统。von Neumann Bottleneck:
The speed difference between the CPU and memory creates a delay, as the CPU is faster than memory.
Von Neumann Execution Cycle
- also called the fetch-decode-execute cycle
- the control unit fetch the next instruction from the memory
- the instruction is decoded into a language that the ALU understands
- data operands are fetched from the memory into the registers inside CPU
- the ALU executes the instruction and places the result into the registers or memory
Abstraction
The essence of abstraction is preserving information that is relevant in a given context, and forgetting information that is irrelevant in that context.
Levels of Transformations
Problem –(Software Design)-> Algorithm –(Programming)-> Program –(Compiling/Interpreting)-> Instr Set Architecture
Problem: What you want to do
Algorithm: step-by-step procedure to solve the problem
Program: a computer program that implements the algorithm using some programming languages
The Machine Levels
- Instruction Set Architecture (ISA): instructions that a CPU can execute
- Microarchitecture: implementation of ISA
- Circuits: Details of electrical circuits
- Devices (transistors): Circuits are built by interconnecting transistors
- Bits: Transistors operate on bits (“0” or “1”) that represent data and information
Signed Interger Representation
- Sign-magnitude:原码,最高位是符号位,剩下表示大小
- 1’s complement:正数的话同原码。负数的话,在原码基础上,符号位不变,剩下取反。
- 2’s complement:正数的话同原码。负数的话,在原码基础上,符号位不变,剩下取反,再加一。
Real Number Representation
以下是 IEEE754 Single Point Precision Numbers 的示例
单精度浮点数,32 bits。从左到右,1 个 bit 表示 sign,8 个 bit 表示 exponent,23 个 bit 表示 fraction。
$$
(-1)^{sign} \times (1 + fraction) \times 2 ^ {exponent - 127}
$$
- e.g. $(12.375)_{10}$ to float
- $(12.375){10} = (1100.011){2} = 1.100011 \times 2 ^ 3$
- Sign bit = 0
- Exponent: $3 + 127 = 130 = 1000 0010$
- Mantissa: 1000 1100 0000 0000 000
- Answer: 0 1000 0010 1000 1100 0000 0000 000
Lecture Notes: Computer Organization
https://tosakaucw.github.io/lecture-notes-computer-organization/