📚 Computer Architecture | 计算机体系结构
Computer architecture is the logical design and fundamental operational structure of a computer system. It describes how key hardware components such as the central processing unit (CPU), memory, buses, and input/output interfaces are organised and how they interact to execute instructions and process data.
计算机体系结构是计算机系统的逻辑设计与基本操作结构。它描述了中央处理器(CPU)、存储器、总线以及输入/输出接口等关键硬件组件如何组织,以及它们如何相互作用来执行指令和处理数据。
1. Understanding Computer Architecture | 理解计算机体系结构
At its core, computer architecture defines the rules and methods that describe the functionality, organisation, and implementation of a computer system. It is not just about the physical components; it also covers how data flows between them, how instructions are interpreted, and how the system is controlled. For IGCSE Computer Science, we focus on the Von Neumann model because it is the foundation of almost all modern general-purpose computers.
计算机体系结构的核心在于定义描述计算机系统功能、组织和实现的规则与方法。它不仅仅是关于物理组件,还涉及数据如何在它们之间流动、指令如何被解释,以及系统如何被控制。对于IGCSE计算机科学而言,我们重点关注冯·诺依曼模型,因为它是几乎所有现代通用计算机的基础。
The architecture includes the concept of a stored program, meaning that both program instructions and data are held in the same main memory. This design makes it possible to change a computer's task simply by loading a new program, without altering any hardware.
该体系结构包含了 "存储程序" 的概念,即程序指令和数据都保存在同一个主存储器中。这种设计使得只需加载一个新程序就能改变计算机的任务,而无需更改任何硬件。
2. The Von Neumann Architecture | 冯·诺依曼体系结构
The Von Neumann architecture, proposed by mathematician John von Neumann, is built around three key concepts: a single shared memory for both instructions and data, a central processing unit that reads and executes instructions one at a time, and a control unit that coordinates all activities. These features together form the stored-program concept, which remains the cornerstone of most computer systems today.
冯·诺依曼体系结构由数学家约翰·冯·诺依曼提出,其核心有三个关键概念:一个供指令和数据共用的单一存储器、一个逐条读取并执行指令的中央处理器,以及一个协调所有活动的控制单元。这些特征共同构成了 "存储程序" 概念,至今仍是大多数计算机系统的基石。
In a Von Neumann machine, the CPU is connected to main memory (RAM) via a set of buses. A single system bus carries addresses, data, and control signals. Because instructions and data share the same pathway, this can create a bottleneck known as the "Von Neumann bottleneck", which limits the speed at which the CPU can operate if memory access is slow.
在冯·诺依曼机器中,CPU通过一组总线连接到主存储器(RAM)。单一系统总线承载地址、数据和控制信号。由于指令和数据共享同一条通道,这可能造成一个被称为 "冯·诺依曼瓶颈" 的限制——如果内存访问速度慢,就会限制CPU的运行速度。
The components of this architecture include the CPU, memory unit, input devices, output devices, and the buses that link them together. The CPU itself is broken down into the Control Unit (CU), Arithmetic Logic Unit (ALU), and a set of registers. Understanding how these pieces fit together is essential for grasping the fetch-decode-execute cycle.
该体系结构的组成部分包括CPU、存储器单元、输入设备、输出设备和连接它们的总线。CPU本身又细分为控制单元(CU)、算术逻辑单元(ALU)和一组寄存器。理解这些部件如何协同工作,对于掌握取指-译码-执行周期至关重要。
3. The Central Processing Unit (CPU): Core Components | 中央处理器(CPU):核心部件
The CPU is often called the "brain" of the computer. It is responsible for executing program instructions by performing basic arithmetic, logic, control, and input/output operations. Inside the CPU, three main elements work together: the Control Unit, the Arithmetic Logic Unit, and registers.
CPU常被称为计算机的 "大脑"。它负责通过执行基本的算术、逻辑、控制和输入/输出操作来运行程序指令。在CPU内部,三个主要元素协同工作:控制单元、算术逻辑单元和寄存器。
The Control Unit (CU) manages the execution of instructions. It decodes each instruction and generates the necessary control signals to coordinate data movement through the registers, ALU, and memory. It controls the timing of operations using an internal clock signal. Without the CU, the CPU would not know which operation to perform or when to perform it.
控制单元(CU)管理指令的执行。它对每条指令进行译码,并生成必要的控制信号,以协调数据通过寄存器、ALU和内存的移动。它使用内部时钟信号控制操作的时序。如果没有CU,CPU将不知道该执行哪个操作或何时执行。
The Arithmetic Logic Unit (ALU) handles all mathematical calculations and logical comparisons. It can perform operations such as addition, subtraction, simple multiplication, and bitwise AND, OR, and NOT. Data required for an operation is fetched from registers, the result is produced by the ALU, and the outcome is stored back in a register or sent to memory.
算术逻辑单元(ALU)处理所有的数学计算和逻辑比较。它能执行加法、减法、简单乘法,以及按位与、或、非等操作。运算所需的数据从寄存器中取出,由ALU产生结果,并将结果存回寄存器或送到内存中。
Registers are extremely fast, small storage locations inside the CPU. They hold data, addresses, or instructions that the CPU is currently working on. Registers are used to store intermediate results, track the next instruction address, and hold the instruction currently being decoded. Having data in registers avoids time-consuming trips to main memory.
寄存器是CPU内部极其快速的小型存储单元。它们保存CPU当前正在处理的数据、地址或指令。寄存器用于存储中间结果、跟踪下一条指令的地址,以及保存正在译码的指令。数据存放在寄存器中可以避免耗时的主存访问。
4. The Fetch-Decode-Execute Cycle | 取指-译码-执行周期
Every instruction that the CPU processes goes through a repeating sequence called the fetch-decode-execute (FDE) cycle, also known as the machine cycle. This cycle is the heartbeat of a processor and is repeated billions of times per second in modern CPUs.
CPU处理的每条指令都要经历一个不断重复的序列,称为取指-译码-执行(FDE)周期,也称机器周期。这个周期是处理器的 "心跳",在现代CPU中每秒重复数十亿次。
In the fetch stage, the address of the next instruction is taken from the Program Counter (PC) and placed onto the address bus. The instruction is then retrieved from main memory into the Memory Data Register (MDR) and later copied to the Current Instruction Register (CIR). After the fetch, the PC is incremented to point to the next instruction.
在取指阶段,下一条指令的地址从程序计数器(PC)中取出并放到地址总线上。然后该指令从主存中取出,送入存储数据寄存器(MDR),随后被复制到当前指令寄存器(CIR)。取指完成后,PC递增以指向下一条指令。
During the decode stage, the Control Unit interprets the instruction held in the CIR. It determines what operation is required and identifies any operands (data or addresses) that are needed. The CU prepares the necessary control signals for the ALU and other circuits.
在译码阶段,控制单元解释CIR中保存的指令。它确定需要执行什么操作,并识别所需的操作数(数据或地址)。CU为ALU和其他电路准备必要的控制信号。
The execute stage is where the actual operation takes place. If an arithmetic or logic instruction is being processed, the ALU performs the calculation. If data needs to be read from or written to memory, the appropriate addresses and data are placed on the buses. The result is then stored in a register or sent to memory, and the cycle starts again for the next instruction.
执行阶段是实际操作发生的地方。如果正在处理算术或逻辑指令,ALU就会执行计算。如果需要从内存读取数据或向内存写入数据,相应的地址和数据会被放到总线上。结果随后存入寄存器或送到内存,然后周期重新开始处理下一条指令。
5. Key Registers and Their Functions | 关键寄存器及其功能
Several special-purpose registers are central to the operation of a Von Neumann processor. Each has a clearly defined role during the fetch-decode-execute cycle.
几个专用寄存器对冯·诺依曼处理器的运行至关重要。每个寄存器在取指-译码-执行周期中都有明确定义的角色。
Program Counter (PC): holds the memory address of the next instruction to be fetched. After each fetch, it is incremented automatically so that instructions are processed in sequence, unless a jump or branch instruction changes its value.
程序计数器(PC):保存下一条将要取出的指令的内存地址。每次取指后,PC会自动递增,以使指令顺序处理,除非跳转或分支指令改变了它的值。
Memory Address Register (MAR): stores the address of the memory location that the CPU wants to read from or write to. During a memory operation, the MAR is connected to the address bus so that the correct location is selected.
存储地址寄存器(MAR):存储CPU想要读取或写入的内存位置的地址。在内存操作期间,MAR与地址总线相连,以便选中正确的位置。
Memory Data Register (MDR): acts as a buffer for data being transferred between the CPU and main memory. When an instruction or piece of data is fetched from RAM, it passes through the MDR before being moved into the appropriate internal register.
存储数据寄存器(MDR):充当CPU与主存之间传输数据的缓冲区。当指令或数据从RAM中取出时,它先通过MDR,然后再移入相应的内部寄存器。
Current Instruction Register (CIR): holds the actual instruction that is currently being decoded and executed. The CU looks at the bit pattern in the CIR to work out what operation to perform.
当前指令寄存器(CIR):保存当前正在译码及执行的实际指令。控制单元查看CIR中的位模式,以确定要执行什么操作。
Accumulator (ACC): a general-purpose register used to temporarily store results produced by the ALU. Many arithmetic and logic instructions use the accumulator as an implied operand, storing one input and then receiving the result.
累加器(ACC):一个通用寄存器,用于临时存储ALU产生的结果。许多算术和逻辑指令将累加器作为一个隐含操作数,用它存放一个输入值,然后接收运算结果。
These registers work in tight coordination. For example, to read an operand from memory location 200, the CPU loads 200 into the MAR, initiates a read, and the value appears in the MDR before being used by the ALU.
这些寄存器紧密配合工作。例如,要从内存位置200读取一个操作数,CPU会将200加载到MAR中,发起一次读操作,该值就会出现在MDR中,然后被ALU使用。
6. System Buses: Data, Address, and Control | 系统总线:数据总线、地址总线与控制总线
Communication between the CPU, memory, and I/O devices is carried out by three types of buses. A bus is simply a set of parallel wires that carry binary information from one part of the computer to another.
CPU、存储器和I/O设备之间的通信由三种总线完成。总线就是一组并行导线,它们将二进制信息从计算机的一个部分传送到另一个部分。
The address bus is a unidirectional bus that transmits memory addresses from the CPU to other components, such as RAM or I/O controllers. The width of the address bus (e.g., 32 bits) determines the maximum number of addressable memory locations, which is 2³² addresses for a 32-bit bus.
地址总线是一条单向总线,用来将内存地址从CPU传送到其他组件(如RAM或I/O控制器)。地址总线的宽度(例如32位)决定了可寻址存储位置的最大数量,对于32位总线而言,就是2³²个地址。
The data bus is bidirectional, transporting actual instructions and data between the CPU, memory, and peripherals. A wider data bus (e.g., 64 bits) allows more bits to be transferred simultaneously, improving system performance. The data bus width often matches the word size of the processor.
数据总线是双向的,在CPU、存储器和外设之间传输实际的指令和数据。更宽的数据总线(如64位)允许同时传输更多的位,从而提高系统性能。数据总线宽度通常与处理器的字长相匹配。
The control bus carries command and timing signals that coordinate all activities across the system. Typical control signals include memory read, memory write, I/O read, I/O write, and clock signals. Unlike the address and data buses, the control bus is a collection of individual control lines, each with a specific purpose.
控制总线承载指挥和定时信号,协调整个系统的所有活动。典型的控制信号包括存储器读、存储器写、I/O读、I/O写和时钟信号。与地址总线和数据总线不同,控制总线是一组各自独立的控制线,每一条都有特定作用。
Together, these three buses enable the fetch-decode-execute cycle. For example, when fetching an instruction, the PC value goes onto the address bus, a read signal is sent over the control bus, and the instruction travels back to the CPU over the data bus.
这三种总线共同实现了取指-译码-执行周期。例如,在取指令时,PC的值被放到地址总线上,读信号通过控制总线发出,随后指令通过数据总线传回CPU。
7. Factors That Affect CPU Performance | 影响CPU性能的因素
The speed at which a processor can execute instructions is influenced by three main factors: clock speed, number of cores, and cache memory. Understanding these factors helps explain why different processors perform differently even if they share the same basic architecture.
处理器执行指令的速度受三个主要因素影响:时钟速度、内核数量和缓存内存。理解这些因素有助于解释为什么不同的处理器即使基于相同的基本架构,性能表现也不同。
r clock speed generally means faster processing, but it also generates more heat and consumes more power.
时钟速度以赫兹(Hz)衡量,决定了CPU每秒能执行多少个取指-译码-执行周期。一个3.5 GHz的处理器每秒完成3.5 × 10⁹个周期。更高的时钟速度通常意味着更快的处理速度,但也会产生更多热量并消耗更多功率。
The number of cores refers to independent processing units within a single CPU. A dual-core or quad-core processor can handle multiple instructions at the same time, provided the software is designed to take advantage of parallel execution. More cores can dramatically improve multitasking and performance in well-optimised applications.
内核数量指的是单个CPU内部的独立处理单元。双核或四核处理器可以同时处理多条指令,前提是软件被设计为能利用并行执行的优势。更多的内核可显著改善多任务处理能力以及优化良好的应用程序的性能。
Cache memory is a small amount of extremely fast memory located on or very close to the CPU chip. It stores frequently accessed instructions and data so that the processor can retrieve them more quickly than from RAM. Modern CPUs have multiple levels of cache (L1, L2, L3), with L1 being the smallest and fastest. A larger cache size reduces the time the CPU spends waiting for data, thereby increasing overall speed.
缓存内存是位于CPU芯片内部或极靠近CPU的一小部分极快内存。它保存经常访问的指令和数据,使处理器能比从RAM中更快地获取它们。现代CPU有多级缓存(L1、L2、L3),其中L1最小且最快。更大的缓存容量能够减少CPU等待数据的时间,从而提高整体速度。
It is important to note that clock speed, cores, and cache do not operate in isolation. A very high clock speed with insufficient cache may still cause performance bottlenecks, just as adding cores without software support yields little benefit.
值得注意的是,时钟速度、内核数量和缓存并非孤立地起作用。极高的时钟速度如果配合不足的缓存仍可能造成性能瓶颈,同样,增加内核但缺乏软件支持也收效甚微。
8. Instruction Sets and How They Work | 指令集及其工作原理
An instruction set is the complete collection of machine-level commands that a CPU can understand and execute. Each instruction consists of two main parts: an opcode and an operand. The opcode (operation code) tells the CPU what to do, such as ADD, LOAD, or STORE. The operand specifies the data to be used or the memory address involved.
指令集是CPU能够理解并执行的机器级命令的完整集合。每条指令主要由两部分组成:操作码和操作数。操作码告诉CPU做什么,如ADD(加)、LOAD(取数)或STORE(存数)。操作数指定要使用的数据或相关的内存地址。
For example, a simple instruction might be LOAD 50. In this case, LOAD is the opcode that tells the CPU to load a value into the accumulator, and 50 is the operand that could represent the memory address from which the value should be fetched. During assembly language programming, these symbolic names are converted into binary patterns that the control unit can interpret.
例如,一条简单的指令可能是 LOAD 50。这种情况下,LOAD是操作码,告诉CPU将一个值加载到累加器中,而50是操作数,可能代表应该从中取值的那个内存地址。在汇编语言编程中,这些符号化的名称会被转换成控制单元能够解释的二进制模式。
Instruction sets can be classified as CISC (Complex Instruction Set Computer) or RISC (Reduced Instruction Set Computer). CISC processors have a large number of powerful, multi-step instructions that can complete complex tasks with a single command. RISC processors use a smaller set of simple instructions, each designed to execute in one clock cycle, which often results in faster and more efficient pipelining.
指令集可分为CISC(复杂指令集计算机)和RISC(精简指令集计算机)。CISC处理器拥有大量功能强大的多步指令,能用一条命令完成复杂任务。RISC处理器则使用一小套简单指令,每条都设计在一个时钟周期内执行,这通常能带来更快、更高效的流水线操作。
Although the opcode–operand structure is a simplification, it captures the essential relationship: the CPU works as a pattern-recognising machine that matches each binary opcode to a specific circuit operation. The richer the instruction set, the more versatile the CPU, but at the potential cost of increased complexity and power consumption.
虽然操作码-操作数结构是一种简化,但它抓住了本质关系:CPU就像一台模式识别机器,将每个二进制操作码匹配到一个特定的电路操作。指令集越丰富,CPU功能越多样,但代价可能是复杂性和功耗的增加。
9. Embedded Systems | 嵌入式系统
An embedded system is a computer system designed for a dedicated function within a larger mechanical or electrical system. Unlike general-purpose desktop computers, embedded systems are single-purpose, often resource-constrained, and optimised for low power consumption and real-time operation. They are found in washing machines, microwave ovens, car engine management units, digital watches, and many other everyday devices.
嵌入式系统是一种为更大机械或电气系统中的特定功能而设计的计算机系统。与通用的台式计算机不同,嵌入式系统功能单一,通常资源受限,并针对低功耗和实时操作进行了优化。它们存在于洗衣机、微波炉、汽车引擎管理单元、电子表以及许多其他日常设备中。
A key characteristic of embedded systems is that they are designed to perform one task repeatedly, often with minimal user intervention. The program is usually stored in ROM or flash memory and is not intended to be changed by the end user. The hardware is stripped down to exactly what is needed, which reduces cost and increases reliability.
嵌入式系统的一个关键特征是它们被设计为重复执行一项任务,通常只需极少的用户干预。程序一般存储于ROM或闪存中,最终用户无法更改。硬件被精简到刚好满足需要,这降低了成本并提高了可靠性。
Many embedded systems include microcontrollers, which integrate a CPU, memory, and input/output ports on a single chip. These microcontrollers often have special circuits for analogue-to-digital conversion, timers, and communication interfaces, all tightly integrated to suit specific control applications.
许多嵌入式系统包含微控制器,它们将CPU、存储器和输入/输出端口集成在单一芯片上。这些微控制器通常带有模数转换、定时器和通信接口等专用电路,全部紧密集成以适应特定的控制应用。
Because embedded systems are frequently safety-critical or real-time (e.g., anti-lock braking systems), they must respond to inputs within strict time limits. This demand influences both the hardware design and the software, which is often written in low-level languages to guarantee precise timing and reliability.
由于嵌入式系统常常关乎安全或必须实时响应(例如防抱死制动系统),它们必须在严格的时间限制内对输入作出反应。这一需求既影响硬件设计,也影响软件——后者通常用低级语言编写,以保证精确的时序和可靠性。
10. Summary and Key Takeaways | 总结与要点提炼
Computer architecture provides the blueprint for how a computer works at the hardware level. The Von Neumann model defines a system where a single memory stores both data and instructions, processed sequentially by a CPU composed of a Control Unit, ALU, and registers.
计算机体系结构为计算机在硬件层面如何工作提供了蓝图。冯·诺依曼模型定义了一个系统,其中单一存储器同时存储数据和指令,并由一个
Published by TutorHao | IGCSE Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)

或截图后用「扫一扫 → 相册」选择本图