跳转至

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

CPUCPU

I/O System ⇆ CPU ⇆ Memory

How to Execute Instructions?

CPU

  • Basic Computer System

CPU

  1. processor
    • registers
  2. memory
  3. bus

  4. Data Stored in Memory

  5. All “information” in the computer is in binary form
    • 0: zero voltage,1: positive voltage
    • bit: the smallest unit of information (0 or 1)
  6. The basic unit of memory is a byte
    • 1 Byte = 8 bits, e.g., “0101 1101”
  7. Each byte in memory is labeled by a unique address
  8. All addresses in the machine have the same number of bits e.g., 64-bit addresses on ARM64
  9. 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”

  10. Both Code and Data in Memory

    • Once a program is loaded in memory, its address space contains both code and data

CPU

  • What’s in the CPU?

CPU

  1. Registers - 寄存器: the “variables” that hardware instructions work with
  2. Data can be loaded from memory into a register
  3. Data can be stored from a register back into memory
  4. Operands and results of computations are in registers
  5. Accessing a register is really fast
  6. There is a limited number of registers
  7. Arithmetic and Logic Unit - 算术逻辑单元: what you do computation with
  8. Used to compute a value based on current register values and store the result back into a register → +, * , /, -, OR, AND, XOR, etc.
  9. Program Counter: Points to the next instruction
  10. 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)
  11. Current Instruction: Holds the instruction that’s currently being executed
  12. Control Unit: Decodes instructions and make them happen
  13. 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 物理地址 逻辑地址