The CPU and the fetch-execute cycle
Đã giới thiệu
11:47
CPU
Bộ xử lý trong điện thoại của bạn đang làm một việc gần như đơn giản đến mức ngốc nghếch. Lấy một lệnh. Xác định ý nghĩa của nó. Thực thi. Sau đó lấy lệnh tiếp theo. Đó là…
Thuyết minh tiếng Anh · Có thể chuyển đổi phụ đề tiếng Anh và tiếng Trung
Trong bài học này
| English | Ý nghĩa |
|---|---|
| CPU/ˌsiː piː ˈjuː/ | bộ xử lý trung tâm |
| data/ˈdeɪtə/ | Recorded facts, observations or values used for analysis or processing. |
| instructions/ɪnˈstrʌkʃnz/ | lệnh |
| ALU/ˌeɪ el ˈjuː/ | đơn vị tính toán logic |
| control unit/kənˈtrəʊl ˈjuːnɪt/ | đơn vị điều khiển |
| registers/ˈredʒɪstəz/ | cặp thanh ghi |
| buses/ˈbʌsɪz/ | tổng dữ liệu |
| program/ˈprəʊɡræm/ | A set of instructions specifying operations for a computer to carry out. |
| fetch–execute cycle/fetʃ ˈeksɪkjuːt ˈsaɪkl/ | The repeating process of obtaining an instruction, decoding it and carrying out the required operation. |
| logical comparisons | |
| control signals | |
| memory/ˈmeməri/ | Circuits that store data, such as registers, RAM and ROM. |
| address/əˈdres/ | An identifier specifying a location in memory or on a network. |
| chip | |
| Fetch | |
| Execute/ˈeksɪkjuːt/ | |
| PC | |
| MAR | |
| MDR | |
| CIR | |
| ACC | |
| Decode | |
| cache/kæʃ/ | bộ nhớ đệm |
| embedded system/emˈbedɪd ˈsɪstəm/ | hệ thống nhúng |
| cores/kɔːz/ | Processing units within a processor that can execute instruction streams. |
| cache size | |
| clock speed/klɒk spiːd/ | The number of cycles of a processor's clock per second; it alone does not determine how quickly every program runs. |
| Storage/ˈstɔːrɪdʒ/ | |
| secondary storage/ˈsekəndəri ˈstɔːrɪdʒ/ | Non-volatile storage used to retain data and programs beyond immediate processing. |
| program counter/ˈprəʊɡræm ˈkaʊntə/ | A processor register holding the address of the next instruction to fetch in the simplified CPU model. |
| address bus/əˈdres bʌs/ | The signal lines used to identify a memory location or device involved in a transfer. |
| data bus/ˈdeɪtə bʌs/ | The signal lines carrying data between processor, memory and other connected components. |
| accumulator/əˈkjuːmjʊleɪtə/ | A register used to hold intermediate arithmetic or logical results during processing. |
Bộ xử lý trung tâm
- CPU xử lý dữ liệu và thực thi lệnh, lặp lại chu kỳ hàng triệu lần mỗi giây.
- Bên trong có ALU, đơn vị điều khiển và thanh ghi, liên kết bởi tuyến bus.
- Nó chạy mọi chương trình qua chu kỳ lấy–thực thi.
Các bộ phận của CPU
- ALU — thực hiện phép tính và so sánh logic.
- Đơn vị điều khiển (CU) — gửi tín hiệu điều khiển để quản lý tất cả các bộ phận.
- Thanh ghi — bộ nhớ nhỏ, rất nhanh lưu trữ mỗi thanh một giá trị.
- Ba tuyến bus liên kết chúng với bộ nhớ: địa chỉ (một chiều), dữ liệu (cả hai chiều), điều khiển.


Một CPU hiện đại là một vi mạch chứa đơn vị điều khiển, ALU và thanh ghi


The ALU in a CPU:
Độ khó 1/5 · 100 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
The arithmetic logic unit does the maths and logic; the control unit manages the parts.
Thanh ghi và chu kỳ lấy–thực thi
- Các thanh ghi đặc biệt: PC (địa chỉ lệnh tiếp theo), MAR (địa chỉ truy cập), MDR (dữ liệu/lệnh đã lấy), CIR (lệnh đang chạy), ACC (kết quả của ALU).
- Chu kỳ lặp lại ba giai đoạn: Lấy (sao chép lệnh vào CPU, sau đó PC + 1) → Giải mã (CU tìm hiểu ý nghĩa của nó) → Thực thi (thực hiện nó).

Chu kỳ lấy–giải mã–thực thi mà CPU lặp lại cho mỗi lệnh

Chu kỳ lấy lệnh-thực thi
Tap round the loop the CPU repeats billions of times a second — fetch the instruction, decode what it means, execute it, then do it all again.
Match each CPU part to what it does.
Độ khó 2/5 · 140 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
The ALU computes, the control unit directs, the PC tracks the next instruction, and cache keeps hot data close.
Put the stages of the cycle in order.
Độ khó 3/5 · 200 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
Fetch the instruction, decode what it means, then execute it — repeated continuously.
Bộ nhớ đệm, hiệu suất, hệ nhúng
- Bộ nhớ đệm là một lượng nhỏ bộ nhớ rất nhanh gần CPU, lưu trữ dữ liệu thường xuyên dùng — để CPU ít phải chờ.
- Hiệu suất phụ thuộc vào số lượng lõi, dung lượng bộ nhớ đệm, và tốc độ xung nhịp (chu kỳ mỗi giây).
- Một hệ thống nhúng là máy tính nhỏ được tích hợp vào thiết bị cho một nhiệm vụ cố định (máy giặt, lò vi sóng).

Bộ nhớ đệm và bộ nhớ chính (RAM) nằm gần CPU để cung cấp dữ liệu nhanh chóng cho nó


Which change would improve CPU performance?
Độ khó 1/5 · 100 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
More cores, a larger cache and a higher clock speed all improve performance.
Cache is small, very fast memory near the CPU that holds often-used data, so the CPU waits less than it would reading from main memory.
Độ khó 1/5 · 100 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
A bigger cache, more cores and a higher clock speed all raise performance — cache helps by cutting the wait for data.
Đây là thẻ mới nên sẽ hiển thị bằng tiếng Anh cho đến khi bản dịch sẵn sàng.
Worked example: one trip round the cycle
The program counter 程序计数器 (PC) holds 20. Describe how the next instruction is fetched.
- The address 20 is copied from the PC to the MAR and sent along the address bus 地址总线 to memory. The instruction stored at address 20 comes back along the data bus 数据总线 into the MDR, then is copied to the CIR.
- The PC goes up by 1, to 21, ready for the next fetch. The control unit then decodes the instruction in the CIR, and it is executed (the ALU does any calculation, with the result in the accumulator 累加器).
Which register holds the address of the next instruction to be fetched?
Độ khó 1/5 · 100 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
The PC holds the next address and is incremented after each fetch.
Doubling the number of cores always makes every program run twice as fast.
Độ khó 1/5 · 100 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
Only tasks that can be split between cores speed up, and the cores must share work and memory.
Bạn đã nắm vững
- CPU = ALU (toán học/logic) + CU (tín hiệu điều khiển) + thanh ghi, liên kết bởi tuyến địa chỉ/dữ liệu/điều khiển
- các thanh ghi: PC (lệnh tiếp theo), MAR/MDR (bộ nhớ), CIR (hiện tại), ACC (kết quả)
- chu trình: lấy lệnh → giải mã → thực thi
- hiệu suất: số nhân, dung lượng bộ nhớ đệm, tốc độ xung clock; bộ nhớ đệm = bộ nhớ nhanh nằm gần CPU
Đã xảy ra vấn đề gì? Chỉ đội ngũ trang web nhìn thấy thông tin này.