计算机系统I-处理器基本原理

The Processor: Basic Principles

What is the architecture of computers

Von Neumann structure: data and programs are in memory.

Computer{CPU{ControlUnitDatapath{Path:multiplexorsALURegistersMemoryI/OInterfaceComputer \begin{cases} CPU\begin{cases} Control Unit\\ Datapath\begin{cases} Path: multiplexors\\ ALU\\ Registers\\ \cdots \end{cases} \end{cases}\\ Memory\\ I/O Interface \end{cases}

What is the inside of Processor (CPU)

  • Datapath: performs operations on data
  • Control: sequences datapath, memory, …
  • Cache memory
    • Small fast SRAM memory for immediate access to data

How to use CPU to solve problems

Design methodology 1: Common digital system

Finite state machine (FSM)

graph LR
	A[input]
	A -->B[Combinational circuit
			Status transmission conditions]
	A -->C[Combinational circuit
			Output processing]
	D[State storage] -->B
	C-->E[Output]
	B-->D
	B-->C

Design methodology 2: Control of Register Transfers

Control of Register Transfers

Register transfers performed on registers control that supervises the sequencing of the register transfers.

Design methodology 3: Control of Register Transfers

General system: Program state machine (PSM)

Turing Machine

Basic idea

  • Use machine to simulate mathematical computation process of humans by paper and pen.
  • Two simple operations
    • Write or delete a symbol from the paper
    • Move the attention from one position to another of the paper
  • The next operation depends on
    • the symbol in one position of the paper that the person pays attention to
    • the thinking state of the person currently
  • Turing constructs an ideal machine

Components of Turing Machine

  1. An infinitely long paper tape TAPE
  2. A read/write head HEAD
  3. A set of control rules TABLE
  4. A state register

Instruction structure of Turing Machine

M={Q,Σ,Γ,δ,q0,qaccept,qreject}M=\{Q,\Sigma,\Gamma,\delta,q0,qaccept,qreject\}, where Q,Σ,ΓQ,\Sigma,\Gamma​are all finite sets

  1. Q is the state set
  2. Σ\Sigma is the input alphabet, which does not include the special empty " ";
  3. Γ\Gamma is the alphabet, where bΓb\in\Gamma is the empty, and ΣΓ\Sigma\in\Gamma
  4. δ\delta is the transfer function: Q×ΣQ×Σ{L,R}Q\times\Sigma\to Q\times\Sigma\{L,R\}, where L and R represent the read/write head moves left and right, respectively
  5. q0\inQ is the beginning state
  6. qaccept is the accept state
  7. qreject is the reject state, and qreject\ne​qaccept

Program of Turing Machine

δ={qi,Sj,Sk,R(L or N),ql}\delta=\{q_i,S_j,S_k,R(L\ or\ N),q_l\}

  • qiq_i is the current state of the machine
  • SjS_j is the symbol read by the machine
  • SkS_k is the symbol waiting to be written to replace SjS_j
  • R, L, N represent moving right one step, moving left one step, or remain static
  • qlq_l is the next state of the machine

Practical Turing Machine – A Real Computer

A large enough storage to replace the tape

  • Magnetic storage for replacement
  • Semiconductor storage for replacement

Storing the inner state

  • Inner state does not store immediate, downgrading the efficiency
  • Register to store the immediate
  • Can significantly simplify computational structure and improve computing efficiency

Enhance the processing capability of HEAD–CPU

  • Require a stronger HEAD
  • Can be implement by Control of Register Transfer Technique: CPU
  • Satisfactory Universal Turing Machine

CPU

Logics in CPU

Unlocked vs. Clocked

Clocks used in synchronous logic

Performance

Being able to gauge the relative performance of a computer is an important but tricky task. There are a lot factors that can affect performance

  • Architecture
  • Hardware implementation of the architecture
  • Compiler for the architecture
  • Operating system

Furthermore, we need to be able to define a measure of performance

  • Single users on a PC -> a minimization of response time
  • Large data -> a maximization of throughput

Response Time and Throughput

  • Latency (Response time)
    • is the time between the start and completion of an event
    • How long it takes to do a task
  • Throughput (bandwidth)
    • is the total amount of work done in a given period of time
    • Total work done per unit time

How are response time and throughput affected by

  • Replacing the processor in a computer with a faster processor
  • Adding more processors?

Measuring Execution Time

Elapsed time

  • Total response time, including all aspects
  • Determines system performance

CPU time

  • Time spent processing a given job
  • Comprises user CPU time and system CPU time
  • Different programs are affected differently by CPU and system performance

How can computers run fast

The main goal of architecture improvement is to improve the performance of the system.

  • Describe a thing with the least instructions – Algorithms, compiling
  • Do more things in a Clock cycle – Architecture
  • Increase the speed of “core” – Main frequency

CPU Clocking

Operation of digital hardware governed by a constant-rate clock

  • Clock period: duration of a clock cycle
    e.g., 250ps = 0.25ns = 250×1012s250\times10^{-12}s
  • Clock frequency (rate): cycles per second
    e.g., 4.0GHz = 4000MHz = 4.0×1094.0\times10^{9}Hz

计算机系统I-处理器基本原理
http://example.com/2024/05/08/Computer-System-I-The-Processor-Basic-Principles/
作者
Penner
发布于
2024年5月8日
许可协议