Lec 0:Introduction¶
Von-Neumann Model¶
- A processor that performs operations and controls all that happens
- A memory that contains code and data
- I/O of some kind


I/O System ⇆ CPU ⇆ Memory
How to Execute Instructions?

- Basic Computer System

- processor
- registers
- memory
-
bus
-
Data Stored in Memory
- All “information” in the computer is in binary form
- 0: zero voltage,1: positive voltage
- bit: the smallest unit of information (0 or 1)
- The basic unit of memory is a byte
- 1 Byte = 8 bits, e.g., “0101 1101”
- Each byte in memory is labeled by a unique address
- All addresses in the machine have the same number of bits e.g., 64-bit addresses on ARM64
-
The processor has instructions that say “Read the byte at address X and give me its value” and “Write some value into the byte at address X”
-
Both Code and Data in Memory
- Once a program is loaded in memory, its address space contains both code and data

- What’s in the CPU?

- Registers - 寄存器: the “variables” that hardware instructions work with
- Data can be loaded from memory into a register
- Data can be stored from a register back into memory
- Operands and results of computations are in registers
- Accessing a register is really fast
- There is a limited number of registers
- Arithmetic and Logic Unit - 算术逻辑单元: what you do computation with
- Used to compute a value based on current register values and store the result back into a register → +, * , /, -, OR, AND, XOR, etc.
- Program Counter: Points to the next instruction
- Special register that contains the address in memory of the next instruction that should be executed (gets incremented after each instruction, or can be set to whatever value whenever there is a change of control flow)
- Current Instruction: Holds the instruction that’s currently being executed
- Control Unit: Decodes instructions and make them happen
- Logic hardware that decodes instructions (i.e., based on their bits) and sends the appropriate (electrical) signals to hardware components in the CPU
一些名词
Main Memory 主存/内存 RAM
adress content 物理地址 逻辑地址