Chapterبەش 2 · Lectureوانە 2.5

Registers and Busesتۆمارگەکان و تێپەڕگەکان

The CPU's own tiny storage — PC, IR, MAR, MDR, the accumulator, the status register and the general-purpose registers — and the three buses that join it to memory and devices: the data bus, the address bus and the control bus. With an animated read and write, the 2n2^n rule for addresses, and how buses look in a PC today.

کۆگا بچووکەکەی خودی — PC، IR، MAR، MDR، ، و — لەگەڵ سێ کە بە و ئامێرەکانەوەی دەبەستن: ، و . لەگەڵ جوڵەوێنەی خوێندنەوە و نووسین، یاسای 2n2^n بۆ ناونیشانەکان و لە کۆمپیوتەرێکی کەسیی ئەمڕۆدا چۆنن.

16 min read16 خولەک خوێندنەوە · 16 stepsهەنگاو

What you will learnچی فێر دەبیت

  • Explain what a register is and why it is faster than RAM.
  • Give the job of PC, IR, MAR, MDR, ACC, the status register and the general-purpose registers.
  • Describe the data, address and control buses, their directions and typical signals.
  • Follow a memory read and a memory write across the three buses.
  • Work out how many addresses n address lines can reach.
  • ڕوونی بکەیتەوە چییە و بۆچی لە خێراترە.
  • کاری PC، IR، MAR، MDR، ACC، و بڵێیت.
  • ، و ، ئاڕاستەکانیان و وەسف بکەیت.
  • خوێندنەوە و نووسینێکی بە سێ بگریتەوە.
  • دیاری بکەیت n هێڵی ناونیشان دەگەنە چەند ناونیشان.

Registers: the CPU's own tiny storageتۆمارگەکان: کۆگا بچووکەکەی خودی CPU

Definitionپێناسە

A group of flip-flops that stores one binary word, for example 8, 32 or 64 bits. A processor keeps the numbers it is working on in registers.

کۆمەڵێک کە یەک هەڵدەگرێت، بۆ نموونە 8، ⁦32⁩ یان ⁦64⁩ بیت. ئەو ژمارانەی کاریان لەسەر دەکات لە تۆمارگەکاندا هەڵیان دەگرێت.

Registers are very fast storage places that hold data for a short time while the CPU works on it. A CPU needs several of them: one for the next instruction's address, one for the instruction itself, some for the numbers it is adding, and so on. Inside, each register is a row of flip-flops.

شوێنی هەڵگرتنی زۆر خێران کە بۆ کاتێکی کورت هەڵدەگرن لە کاتێکدا کاری لەسەر دەکات. پێویستی بە چەندانیانە: یەکێک بۆ ناونیشانی دواتر، یەکێک بۆ خودی ، هەندێک بۆ ئەو ژمارانەی کۆیان دەکاتەوە و هتد. لە ناوەوە هەر ڕیزێک فلیپ-فلۆپە.

A register is a single storage place inside the CPU. Memory (RAM) is outside the CPU and is reached through the buses. That is why registers are the fastest storage in the whole computer — and why there are so few of them: today's PC and phone processors have only 16 to 32 general-purpose registers, each 64 bits wide.

تاکە شوێنێکی هەڵگرتنە لەناو CPUـدا. بیرگە (RAM) لە دەرەوەی و لە ڕێگەی پێی دەگەیەنرێت. بۆیە خێراترین شوێنی هەڵگرتنن لە هەموو — هەر بۆیەش ژمارەیان کەمە: پرۆسێسەرەکانی ئەمڕۆی کۆمپیوتەری کەسی و مۆبایل تەنها ⁦16⁩ تا ⁦32⁩ ⁦64⁩ هەیە.

The tailor's handsدەستی بەرگدروو

A tailor in the bazaar keeps a few things in his hands and on his table: the piece he is cutting, the tape, the chalk (registers). The rolls of cloth are on the shop shelves, a few steps away (RAM). Older stock waits in a store room across the street (the SSD or hard disk).

بەرگدروویەک لە بازاڕدا چەند شتێک لە دەستیدا و لەسەر مێزەکەی هەڵدەگرێت: ئەو پارچەیەی دەیبڕێت، مەتر و تەباشیر (). تۆپە قوماشەکان لەسەر ڕەفەی دووکانەکەن، چەند هەنگاوێک دوورتر (). کاڵای کۆنتر لە کۆگایەکی ئەو بەری شەقامەکە چاوەڕێ دەکەن ( یان ).

Where the analogy stops workingسنووری ئەم نموونەیە

A CPU fetches from RAM in a few dozen nanoseconds (billionths of a second), and it never «thinks» about what to keep in hand: the program's instructions decide which value goes into which register.

لە چەند دە نانۆچرکەیەکدا (هەر نانۆچرکەیەک ملیاریەکی چرکەیە) لە دەهێنێت و هەرگیز «بیر ناکاتەوە» کە چی لە دەستیدا بهێڵێتەوە: بڕیار دەدەن کام بەها بچێتە ناو کام .

Quick checkپشکنینی خێراWhere are the registers? لە کوێن؟

The registers and their jobsتۆمارگەکان و کارەکانیان

Each register has one job. The table lists the registers the course slides name, with what each one held while the 5 + 2 program ran.

هەر یەک کاری هەیە. خشتەکە پیشان دەدات کە سلایدەکانی وانەکە ناویان دەبەن، لەگەڵ ئەوەی هەریەکەیان چی هەڵگرتبوو لە کاتی جێبەجێبوونی بەرنامەی کۆکردنەوەی 5 و 2.

Registers named in the course slides لە سلایدەکانی وانەکەدا
RegisterShort nameناوی کورتJobکارExample from 5 + 2نموونە لە 5+25 + 2
Program counterPCHolds the address of the next instruction to fetch.ناونیشانی دواتر هەڵدەگرێت کە دەبێت بهێنرێت.0, 1, 2, 3, then 40، 1، 2، 3، پاشان 4
Instruction registerIRHolds the instruction being carried out now.ئەو هەڵدەگرێت کە ئێستا جێبەجێ دەکرێت.LOAD A1 → R1
Memory address registerMARHolds the address the CPU is about to read from or write to.ئەو ناونیشانە هەڵدەگرێت کە خەریکە لێی بخوێنێتەوە یان تێیدا بنووسێت.A1
Memory data registerMDRHolds the value travelling between memory and the CPU.ئەو بەهایە هەڵدەگرێت کە لە نێوان و دەگوازرێتەوە.5
AccumulatorACCIn simple CPUs, collects the results of calculations.لە سادەکاندا ئەنجامی حیسابەکان کۆ دەکاتەوە.(the slide's LOAD 4, ADD 5 program)( ⁦LOAD 4⁩، ⁦ADD 5⁩ـی سلایدەکە)
Status registerflagsSingle bits (flags) that describe the last result: zero? negative? too big? تاک () کە دوایین ئەنجام وەسف دەکەن: سفر؟ سالب؟ زۆر گەورە؟after 5−55 - 5: zero flag = 1دوای 5−55 - 5: سفر دەبێتە 1
General-purpose registersR0, R1, R2 …Hold the numbers and variables the program is using.ئەو ژمارە و هەڵدەگرن کە بەکاریان دەهێنێت.R1 = 5, R2 = 2, R3 = 7
Quick checkپشکنینی خێراThe CPU is about to read memory address A2. Which register holds «A2»? خەریکە ناونیشانی ⁦A2⁩ لە بخوێنێتەوە. کام «⁦A2⁩» هەڵدەگرێت؟

Fetch Decode Execute Cycle in more detailComputer Science Lessons · Englishئینگلیزی · 655K viewsبینین · 12K likesلایک

The registers at work: the program counter, memory address register, memory data register, instruction register and accumulator during fetch, decode and execute.

لە کاتی کاردا: ، ، ، و لە کاتی ، شیکردنەوە و جێبەجێکردندا.

Each register's job, shown step by step on a simple CPU diagram.

ئەرکی هەر ، هەنگاو بە هەنگاو لەسەر نەخشەیەکی سادەی .

The registers and their jobsتۆمارگەکان و کارەکانیان

MAR and MDR: the CPU's door to memoryMAR و MDR: دەرگای CPU بۆ بیرگە

Every move of data between main memory and the processor passes through two registers. The MAR (memory address register) holds where: the address. The MDR (memory data register) holds what: the data being read or written.

هەموو گواستنەوەیەکی لە نێوان و پرۆسێسەردا بە دوو تێدەپەڕێت. MAR () شوێنەکە هەڵدەگرێت: ناونیشانەکە. MDR () شتەکە هەڵدەگرێت: ئەو دەخوێندرێتەوە یان دەنووسرێت.

When LOAD A1 → R1 ran: MAR = A1, memory sent back 5, MDR = 5, and then 5 was copied into R1. MAR is joined to the address bus and MDR to the data bus.

کاتێک LOAD A1 → R1 جێبەجێ بوو: MAR = A1، ژمارە 5ی ناردەوە، MDR = 5، پاشان 5 کۆپی کرا بۆ ⁦R1. MAR⁩ بە بەستراوە و MDR بە .

Quick checkپشکنینی خێراWhat does MDR hold during a write?لە کاتی نووسیندا MDR چی هەڵدەگرێت؟

The registers and their jobsتۆمارگەکان و کارەکانیان

PC, IR and the accumulatorPC، IR و تۆمارگەی کۆکەرەوە

The program counter (PC) points to the next instruction to be fetched from memory. The instruction register (IR) holds the instruction that is being carried out now. Together they keep the CPU moving through a program, as How a computer runs a program shows step by step. Inside, the PC is a counter that can also be loaded.

⁦(PC)⁩ ئاماژە بە دواتر دەکات کە دەبێت لە بهێنرێت. ⁦(IR)⁩ ئەو هەڵدەگرێت کە ئێستا جێبەجێ دەکرێت. ئەم دووانە پێکەوە بە ناو بەرەو پێش دەبەن، وەک کۆمپیوتەر چۆن بەرنامەیەک جێبەجێ دەکات هەنگاو بە هەنگاو پیشانی دەدات. لە ناوەوە PC ژمێرەرێکی دیجیتاڵە کە دەتوانرێت بەهای تێدا بار بکرێت.

The accumulator (ACC) is the register where simple CPUs collect results: LOAD puts a number in it, ADD adds to it, STORE copies it back to memory.

⁦(ACC)⁩ ئەو کە سادەکان ئەنجامەکانی تێدا کۆ دەکەنەوە: LOAD ژمارەیەک دەخاتە ناوی، ADD شتێکی بۆ زیاد دەکات، STORE دەیگەڕێنێتەوە بۆ .

Quick checkپشکنینی خێراWhich register always points to the next instruction?کام هەمیشە ئاماژە بە دواتر دەکات؟

The registers and their jobsتۆمارگەکان و کارەکانیان

Status flags and general-purpose registersئاڵاکانی دۆخ و تۆمارگە گشتییەکان

The status register is a row of single bits called flags. After each calculation the ALU sets them: the zero flag becomes 1 if the result was 0, another flag if it was negative, another if it was too big to fit. Instructions such as «jump if equal» read these flags — this is how a program makes decisions.

ڕیزێکە لە تاک کە پێیان دەوترێت . دوای هەر حیسابێک یەکەی ژیربێژیی بیرکارییانە دیاریان دەکات: سفر دەبێتە 1 ئەگەر ئەنجامەکە 0 بوو، تر ئەگەر سالب بوو، تر ئەگەر زۆر گەورە بوو و جێی نەدەبووەوە. وەک «ئەگەر یەکسان بوو باز بدە» ئەم دەخوێننەوە — بەم شێوەیە بڕیار دەدات.

General-purpose registers (R0, R1, R2 …) are included on most CPUs and are used for high-speed temporary storage of a program's variables. An x86-64 PC processor has 16 of them (Intel's announced APX extension doubles this to 32 on future chips); a 64-bit Arm processor has 31.

(⁦R0⁩، ⁦R1⁩، ⁦R2⁩ …) لە زۆربەی هەن و بۆ هەڵگرتنی خێرا و کاتیی بەکار دێن. پرۆسێسەرێکی ⁦x86-64⁩ـی کۆمپیوتەری کەسی ⁦16⁩ دانەی هەیە (درێژکراوەی APX کە Intel ڕایگەیاندووە ئەمە بۆ داهاتوو دەکاتە ⁦32⁩)؛ پرۆسێسەرێکی Armـی ⁦64⁩ ⁦31⁩ دانەی هەیە.

Quick checkپشکنینی خێراThe ALU works out 7−77 - 7. Which flag becomes 1? 7−77 - 7 حیساب دەکات. کام دەبێتە 1؟

Buses: the shared roads inside the computerتێپەڕگەکان: ڕێگا هاوبەشەکانی ناو کۆمپیوتەر

Definitionپێناسە

A set of parallel wires or lines that carries data, addresses or control signals between the parts of a computer, like a road that all the parts share.

کۆمەڵێک تەل یان هێڵی تەریبە کە ، ناونیشان یان جڵەوکردن لە نێوان بەشەکانی کۆمپیوتەردا دەگوازێتەوە، وەک ڕێگایەک کە هەموو بەشەکان بە هاوبەشی بەکاری دەهێنن.

A bus is a set of parallel wires (lines) that carries signals between parts of the computer. The system bus is part of the motherboard: it joins the CPU, the memory and the I/O modules, which in turn connect to I/O devices such as the keyboard or printer. Inside the CPU there are buses too — the internal bus — joining the registers, the ALU and the control unit. In today's processors these paths are at least 64 lines wide, and wider still for the vector registers.

کۆمەڵێک تەلی (هێڵی) تەریبە کە لە نێوان بەشەکانی دەگوازێتەوە. بەشێکە لە : ، و مۆدیولەکانی / بەیەکەوە دەبەستێت، کە ئەوانیش بە و وەک یان دەبەسترێنەوە. لەناو هەیە — ناوەکی — کە ، و بەیەکەوە دەبەستێت. لە پرۆسێسەرەکانی ئەمڕۆدا ئەم ڕێڕەوانە لانیکەم ⁦64⁩ هێڵ پانن و بۆ ڤێکتەری پانتریشن.

Three boxes in a row: CPU, Memory (RAM) and I/O module, with an I/O device joined to the I/O module by a cable. Below them run three bus lines. The address bus has an arrow going down from the CPU and arrows going up into memory and the I/O module: one way. The data bus has arrows both ways at every box. The control bus has arrows both ways at the CPU and the I/O module and into memory. A bracket says that together they form the system bus.سێ چوارگۆشە لە ڕیزێکدا: CPU، بیرگە (RAM) و مۆدیولی نێوخستە/دەرخستە، لەگەڵ ئامێرێکی نێوخستە/دەرخستە کە بە کێبڵێک بە مۆدیولەکەوە بەستراوە. لە خوارەوەیان سێ هێڵی تێپەڕگە هەن. تێپەڕگەی ناونیشان تیرێکی لە CPUـەوە بەرەو خوارەوە هەیە و تیری بەرەو سەرەوە بۆ بیرگە و مۆدیولەکە: یەک ئاڕاستە. تێپەڕگەی دراوە لە هەموو چوارگۆشەکاندا تیری دوولایەنەی هەیە. تێپەڕگەی جڵەوکردن لە CPU و مۆدیولەکەدا دوولایەنەیە و بۆ بیرگە یەک لایەنە. کەوانەیەک دەڵێت پێکەوە تێپەڕگەی سیستەم پێک دەهێنن.
The data bus, address bus and control bus join the CPU, memory and I/O modules. Redrawn for CêIT from the idea of the course slide «Buses inside a computer».، و ، و مۆدیولەکانی / بەیەکەوە دەبەستن. بۆ CêIT لە بیرۆکەی سلایدی «⁦Buses inside a computer⁩»ـی وانەکەوە دووبارە کێشراوەتەوە.CêIT
Sending a parcelناردنی پاکەتێک

Think of the post office. The address bus is the address written on the parcel — only the sender (the CPU) writes it. The data bus is the parcel itself, which can travel to a house or come back from it. The control bus is the note on top: «deliver this» (write) or «collect a parcel» (read).

بیر لە پۆستەخانە بکەرەوە. ئەو ناونیشانەیە کە لەسەر پاکەتەکە نووسراوە — تەنها نێرەر () دەینووسێت. خودی پاکەتەکەیە کە دەکرێت بچێت بۆ ماڵێک یان لەوێوە بگەڕێتەوە. ئەو تێبینییەیە کە لەسەرەوەی دانراوە: «ئەمە بگەیەنە» (نووسین) یان «پاکەتێک وەربگرە» (خوێندنەوە).

Where the analogy stops workingسنووری ئەم نموونەیە

The three buses work at the same moment, as electrical signals on many wires, billions of times a second — not one parcel at a time.

سێ لە هەمان ساتدا کار دەکەن، وەک کارەبایی لەسەر چەندین تەل، ملیارەها جار لە چرکەیەکدا — نەک یەک پاکەت لە هەر جارێکدا.

Quick checkپشکنینی خێراWhich part of the computer is the system bus part of? بەشێکە لە کام بەشی ؟

Data bus, address bus and control busتێپەڕگەی دراوە، تێپەڕگەی ناونیشان و تێپەڕگەی جڵەوکردن

The system bus is made of three groups of lines, each with its own job:

لە سێ کۆمەڵە هێڵ پێکهاتووە و هەریەکەیان کاری خۆی هەیە:

The three buses as the course slides describe themسێ وەک سلایدەکانی وانەکە باسیان دەکەن
BusCarriesچی دەگوازێتەوەDirectionئاڕاستەLines in the slidesژمارەی هێڵ لە سلایدەکانداSignal namesناوی هێڵەکان
Data busThe data itself, between the CPU and memory or I/O devicesخودی ، لە نێوان و یان ئامێرەکانی /Both ways: out of the CPU for a write, into the CPU for a readدوولایەنە: بۆ نووسین لە دەردەچێت، بۆ خوێندنەوە دێتە ناو 8, 16, 32, 64D0, D1, D2, D3 …
Address busAn address, from the CPU to memory or I/O devicesناونیشانێک، لە بۆ یان ئامێرەکانی /One way: the CPU supplies the addressیەک لایەنە: ناونیشانەکە دەدات16, 20, 24 (old chips)⁦16⁩، ⁦20⁩، ⁦24⁩ ( کۆنەکان)A0, A1, A2, A3 …
Control busSignals that coordinate the CPU's activities; each signal has its own purposeئەو کارەکانی ڕێک دەخەن؛ هەر مەبەستی خۆی هەیەEach line is out, in or both waysهەر هێڵێک یان دەرچوونە، یان هاتنە ژوورەوە، یان دوولایەنە10–20/RD, /WR, CLK, /IRQ
  • /RD — read: «send me the data at this address».
  • /WR — write: «store the data on the data bus at this address».
  • CLK — the clock: the regular beat that keeps every part in step.
  • /IRQ — interrupt request: a device (for example the keyboard) asks the CPU for attention.
  • /RD — خوێندنەوە: «ئەو لەم ناونیشانەدایە بۆم بنێرە».
  • /WR — نووسین: «ئەو لەسەر لەم ناونیشانەدا هەڵبگرە».
  • CLK — : لێدانی ڕێکوپێک کە هەموو بەشەکان پێکەوە ڕێک دەخات.
  • /IRQ — داوای پچڕاندن: ئامێرێک (بۆ نموونە ) داوا لە دەکات ئاگاداری بێت.
Quick checkپشکنینی خێراWhich bus carries data in both directions?کام بە هەردوو ئاڕاستە دەگوازێتەوە؟

Data bus, address bus and control busتێپەڕگەی دراوە، تێپەڕگەی ناونیشان و تێپەڕگەی جڵەوکردن

A read and a write, step by stepخوێندنەوە و نووسین، هەنگاو بە هەنگاو

Watch the three buses work together. First the CPU reads the value at address 5, then it writes 9 into address 6.

سەیری کارکردنی سێ پێکەوە بکە. سەرەتا بەهای ناونیشانی 5 دەخوێنێتەوە، پاشان ژمارە 9 لە ناونیشانی 6ـدا دەنووسێت.

An animation in seven frames. The CPU (control unit, MAR and MDR) on the left, memory with addresses 3 to 7 on the right, three buses between them. Read: MAR holds 5 and the address bus carries 5 to memory; the control bus carries READ; memory puts the value 42 from address 5 on the data bus towards the CPU; 42 arrives in MDR. Write: MAR holds 6 and MDR holds 9; the address bus carries 6, the control bus WRITE and the data bus 9 towards memory; memory saves 9 at address 6.
An animation in seven frames. The CPU (control unit, MAR and MDR) on the left, memory with addresses 3 to 7 on the right, three buses between them. Read: MAR holds 5 and the address bus carries 5 to memory; the control bus carries READ; memory puts the value 42 from address 5 on the data bus towards the CPU; 42 arrives in MDR. Write: MAR holds 6 and MDR holds 9; the address bus carries 6, the control bus WRITE and the data bus 9 towards memory; memory saves 9 at address 6.
Reading address 5 and writing to address 6: the address bus always goes one way, the data bus both ways.خوێندنەوەی ناونیشانی 5 و نووسین لە ناونیشانی 6: هەمیشە یەک ئاڕاستەیە و دوولایەنە.CêIT
  1. Address outناونیشان دەردەچێت

    MAR puts the address on the address bus.

    MAR ناونیشانەکە دەخاتە سەر .

  2. Commandفەرمان

    The control bus carries READ (or WRITE).

    READ (یان WRITE) دەبات.

  3. Data movesدراوە دەجووڵێت

    On a read, memory puts the value on the data bus and it arrives in MDR. On a write, MDR puts the value on the data bus and memory saves it.

    لە خوێندنەوەدا بەهاکە دەخاتە سەر و دەگاتە MDR. لە نووسیندا MDR بەهاکە دەخاتە سەر و هەڵیدەگرێت.

Quick checkپشکنینی خێراDuring a read, which way does the value on the data bus travel?لە کاتی خوێندنەوەدا، بەهای سەر بەرەو کوێ دەڕوات؟

Data bus, address bus and control busتێپەڕگەی دراوە، تێپەڕگەی ناونیشان و تێپەڕگەی جڵەوکردن

Sharing one wire: tri-state outputsهاوبەشیکردنی یەک تەل: دەرچوونی سێ‌دۆخی

The CPU, memory and other chips all hang on the same data-bus wires. If two of them put different values on one wire at the same moment, the wire would get a confused voltage and the chips could overheat. So their bus outputs are tri-state (three-state): besides 0 and 1, an output can be switched off — disconnected, which engineers call high impedance and write as Z.

، و تر هەموویان بە هەمان تەلەکانی بەستراون. ئەگەر دوانیان لە هەمان ساتدا دوو بەهای جیاواز بخەنە سەر یەک تەل، تێکەڵ دەبێت و لەوانەیە زۆر گەرم ببن. بۆیە دەرچوونی ئەم بۆ سەر سێ‌دۆخییە ⁦(tri-state)⁩: جگە لە 0 و 1، دەتوانرێت دەرچوونەکە بکوژێنرێتەوە — واتە پچڕاو، کە ئەندازیاران پێی دەڵێن «بەرگریی بەرز» ⁦(high impedance)⁩ و بە Z دەینووسن.

Each chip has an enable input. The address and control signals enable only the chip whose turn it is: that chip drives the wire with 0s and 1s, and every other chip stays disconnected. The small circuit that joins a chip to the bus or lets it go is called a bus driver (a tri-state buffer).

هەر هێڵێکی چالاککردنی هەیە. ناونیشان و جڵەوکردن تەنها ئەو چالاک دەکەن کە نۆرەی ئەوە: ئەو 0 و 1 دەخاتە سەر تەلەکە و هەموو تر پچڕاو دەمێننەوە. ئەو پارچە بچووکەی بە دەبەستێت یان لێی دەپچڕێنێت پێی دەوترێت لێخوڕی (⁦bus driver⁩ یان ⁦tri-state buffer⁩).

Three chips — CPU, memory (RAM) and an SSD — hang on one shared bus wire. The CPU's and the SSD's switches are open: off, disconnected (Z). Memory's switch is closed: it is enabled and drives a 1 onto the wire. Text: only the enabled chip drives the wire; the others let go, and next moment another chip may be enabled.سێ چیپ — CPU، بیرگە (RAM) و درایڤی جێگیر — بە یەک تەلی هاوبەشی تێپەڕگەوە بەستراون. سویچی CPU و درایڤی جێگیر کراوەیە: کوژاوەن و پچڕاون (Z). سویچی بیرگە داخراوە: چالاکە و 1 دەخاتە سەر تەلەکە. نووسین: تەنها چیپە چالاکەکە سیگناڵ دەخاتە سەر تەلەکە؛ ئەوانی تر بەری دەدەن و لە ساتی دواتردا چیپێکی تر چالاک دەبێت.
Tri-state outputs: one chip drives the shared wire, the others are disconnected.دەرچوونی سێ‌دۆخی: یەک تەلە هاوبەشەکە بەکار دەهێنێت و ئەوانی تر پچڕاون.CêIT
Quick checkپشکنینی خێراMemory is sending a value on the data bus. What do the other chips on that bus do? بەهایەک بە دەنێرێت. تری سەر ئەو چی دەکەن؟

Experimenting with Buses and Three-State LogicSebastian Lague · Englishئینگلیزی · 726K viewsبینین · 30K likesلایک · Partبەشی 4:45–12:23 (ofلە 18:42)

Why many parts can share one bus only if all but one stay silent: bus contention and three-state outputs, shown in a logic simulator.

بۆچی چەند بەشێک تەنها کاتێک دەتوانن یەک هاوبەش بکەن کە جگە لە یەکێکیان هەموو بێدەنگ بن: پێکدادان و دەرچوونی سێ‌دۆخی، لە لۆجیکیدا.

Plays 4:45–12:23: the shared bus, what goes wrong when two outputs drive it, and three-state outputs.

لە ⁦4:45⁩ تا ⁦12:23⁩ پەخش دەبێت: هاوبەش، چی تێک دەچێت کاتێک دوو دەرچوون لە هەمان کاتدا بەسەریدا زاڵ دەبن، پاشان دەرچوونی سێ‌دۆخی ⁦(three-state)⁩.

How many addresses can n lines reach?n هێڵ دەگەنە چەند ناونیشان؟

Each address line is one bit: 0 or 1. With n lines the CPU can put 2 × 2 × … × 2 (n times) different patterns on the address bus, so it can reach this many memory places:

هەر هێڵێکی ناونیشان یەک : 0 یان 1. بە n هێڵ، دەتوانێت 2×2×⋯×22 \times 2 \times \cdots \times 2 (n جار) نەخشی جیاواز بخاتە سەر ، بۆیە دەگاتە ئەم ژمارەیە لە شوێنەکانی :

addresses=2n\text{addresses} = 2^{n}

Why each extra bit doubles the count is explained in Logic Design: How many patterns do N bits give?

بۆچی هەر زیادە ژمارەکە دوو هێندە دەکات لە کۆرسی دیزاینی ڕوون کراوەتەوە: N بیت چەند نەخش دەدات؟

More lines, many more addressesهێڵی زیاتر، ناونیشانی زۆر زیاتر
Address linesهێڵی ناونیشانAddressesژمارەی ناونیشانIf each place holds 1 byteئەگەر هەر شوێنێک 1 هەڵبگرێت
16216=65,5362^{16} = 65{,}53664 KiB
20220=1,048,5762^{20} = 1{,}048{,}5761 MiB — the Intel 8086 (1978)⁦1 MiB⁩ — پرۆسێسەری ⁦Intel 8086 (1978)⁩
24224=16,777,2162^{24} = 16{,}777{,}21616 MiB
32232=4,294,967,2962^{32} = 4{,}294{,}967{,}2964 GiB
482482^{48} ≈ 281 trillion2482^{48} ≈ ⁦281⁩ تریلیۆن256 TiB

KiB, MiB, GiB and TiB are the binary units (1 KiB=10241\,\mathrm{KiB} = 1024 bytes). They are explained in Bits, bytes and storage units.

KiB، MiB، GiB و TiB یەکە دووانییەکانن (1 KiB=10241\,\mathrm{KiB} = 1024 ). لە بیتەکان، بایتەکان و یەکەکانی خەزنکردن ڕوون کراونەتەوە.

Quick checkپشکنینی خێراA small chip has 10 address lines. How many memory places can it reach? بچووک ⁦10⁩ هێڵی ناونیشانی هەیە. دەگاتە چەند شوێنی ؟

Buses in today's computersتێپەڕگەکان لە کۆمپیوتەرەکانی ئەمڕۆدا

In older PCs one shared front-side bus joined the CPU to everything else. In today's PCs and servers that design is gone: the memory controller sits inside the CPU, so RAM connects straight to the processor through its own memory channels (64 data lines per memory module; DDR5 splits them into two 32-line channels), and graphics cards and SSDs connect through their own PCIe lanes. These are point-to-point links, not one bus that everybody shares. You can still see the lines as thin copper tracks running between the CPU socket, the memory slots and the expansion slots of the motherboard.

لە کۆمپیوتەرە کەسییە کۆنەکاندا یەک ⁦front-side bus⁩ـی هاوبەش بە هەموو شتێکی ترەوە دەبەست. لە کۆمپیوتەری کەسی و ئەمڕۆدا ئەو دیزاینە نەماوە: کۆنترۆڵکەری لەناو ، بۆیە لە ڕێگەی کەناڵەکانی خۆیەوە (⁦64⁩ هێڵی بۆ هەر پارچەیەکی ؛ ⁦DDR5⁩ ئەمانە دەکات بە دوو کەناڵی ⁦32⁩ هێڵی) ڕاستەوخۆ بە پرۆسێسەرەکەوە دەبەسترێت. هەروەها و لە ڕێگەی هێڵەکانی PCIeـی خۆیانەوە دەبەسترێن. ئەمانە بەستنەوەی خاڵ بە خاڵن، نەک یەک کە هەمووان بە هاوبەشی بەکاری دەهێنن. هێشتا دەتوانیت هێڵەکان ببینیت وەک ڕێڕەوی باریکی مس کە لە نێوان ، کەلێنەکانی و دەڕۆن.

Quick checkپشکنینی خێراWhich is true for a PC made today?کامیان بۆ کۆمپیوتەرێکی کەسیی ئەمڕۆ ڕاستە؟

Buses in today's computersتێپەڕگەکان لە کۆمپیوتەرەکانی ئەمڕۆدا

The exception: direct memory access (DMA)حاڵەتە جیاوازەکە: گەیشتنی ڕاستەوخۆ بە بیرگە ⁦(DMA)⁩

Quick checkپشکنینی خێراAn SSD copies a big file straight into RAM using DMA. Who puts the addresses on the bus? فایلێکی گەورە بە DMA ڕاستەوخۆ کۆپی دەکات بۆ ناو . کێ ناونیشانەکان دەخاتە سەر ؟

Direct Memory Access - DMA (simplified)Shrenik Jain · Englishئینگلیزی · 491K viewsبینین · 8.4K likesلایک

Direct memory access: how a DMA controller moves data between a device and memory so the CPU does not have to copy every byte.

گەیشتنی ڕاستەوخۆ بە ⁦(DMA)⁩: یەکەی DMA چۆن لە نێوان ئامێرێک و دەگوازێتەوە، تا ناچار نەبێت خۆی هەموو بگوازێتەوە.

DMA in three minutes.

DMA لە سێ خولەکدا.

Common mistakesهەڵە باوەکان

MistakeهەڵەWhat is trueڕاستییەکە
«Registers are part of RAM.»« بەشێکن لە .»Registers are inside the CPU; RAM is outside and reached through the buses. لەناو ؛ لە دەرەوەیە و لە ڕێگەی پێی دەگەیەنرێت.
«MAR holds the data that is read.»«MAR ئەو دەخوێندرێتەوە هەڵدەگرێت.»MAR holds the address; MDR holds the data.MAR ناونیشانەکە هەڵدەگرێت؛ MDR .
«The address bus carries data both ways.»« بە هەردوو ئاڕاستە دەگوازێتەوە.»The address bus goes one way, from the CPU (DMA is the exception). The data bus goes both ways. یەک ئاڕاستەیە، لە (DMA حاڵەتی جیاوازە). دوولایەنەیە.
«The control bus carries the numbers being added.»« ئەو ژمارانە دەگوازێتەوە کە کۆ دەکرێنەوە.»The control bus carries signals such as READ, WRITE, the clock and interrupt requests. Numbers travel on the data bus. وەک READ، WRITE، کاتژمێر و داوای پچڕاندن دەگوازێتەوە. ژمارەکان بە دەڕۆن.
«More address lines make the computer faster.»«هێڵی ناونیشانی زیاتر خێراتر دەکات.»More address lines let the CPU reach more memory places (2 to the power n). Speed depends on other things.هێڵی ناونیشانی زیاتر وا دەکات بگاتە شوێنی زیاتری (2n2^n). خێرایی بە شتی تر دەبەسترێتەوە.

Exercisesڕاهێنانەکان

ExerciseڕاهێنانRegisters during one instructionتۆمارگەکان لە کاتی یەک ڕێکارنامەدا

In the 5 + 2 program, the CPU fetches and runs LOAD A2 → R2 from address 1, and A2 holds 2. Give PC, MAR, MDR and IR right after the fetch, and MAR, MDR and R2 right after the execute.

لە کۆکردنەوەی 5 و 2ـدا، LOAD A2 → R2 لە ناونیشانی 1ـەوە دەهێنێت و جێبەجێی دەکات. ⁦A2⁩ ژمارە 2 هەڵدەگرێت. PC، MAR، MDR و IR ڕاستەوخۆ دوای هێنان بنووسە. پاشان MAR، MDR و ⁦R2⁩ ڕاستەوخۆ دوای جێبەجێکردن.

Show answerوەڵامەکە پیشان بدە
MomentکاتPCMARMDRIRR2
after fetchدوای هێنان21LOAD A2 → R2LOAD A2 → R2—
after executeدوای جێبەجێکردن2A22LOAD A2 → R22

During the fetch, MAR holds the instruction's address (1) and MDR the instruction; during the execute they hold the data's address (A2) and the data (2).

لە کاتی هێنان، MAR ناونیشانی ⁦(1)⁩ و MDR خودی هەڵدەگرن؛ لە کاتی جێبەجێکردندا ناونیشانی ⁦(A2)⁩ و خودی ⁦(2)⁩ هەڵدەگرن.

ExerciseڕاهێنانCount the addressesناونیشانەکان بژمێرە

(a) A processor has 30 address lines. How many memory places can it reach, and how much memory is that if each place holds one byte? (b) How many address lines are needed for 4 GiB of byte places?

(أ) پرۆسێسەرێک ⁦30⁩ هێڵی ناونیشانی هەیە. دەگاتە چەند شوێنی ؟ ئەگەر هەر شوێنێک یەک هەڵبگرێت، ئەمە چەند ؟ (ب) بۆ ⁦4 GiB⁩ لە شوێنی چەند هێڵی ناونیشان پێویستە؟

Show answerوەڵامەکە پیشان بدە
230=1,073,741,824 places=1 GiB2^{30} = 1{,}073{,}741{,}824 \text{ places} = 1\ \text{GiB}

(b) 4 GiB = 4×230=2324 \times 2^{30} = 2^{32}, so 32 address lines.

(ب) 4 GiB=4×230=2324\ \text{GiB} = 4 \times 2^{30} = 2^{32}، بۆیە ⁦32⁩ هێڵی ناونیشان.

ExerciseڕاهێنانWhich bus, which way?کام تێپەڕگە، بە کام ئاڕاستەدا؟

For each item say which bus carries it and in which direction: (a) the address 7 for a read; (b) the value 9 being written to memory; (c) the READ signal; (d) a keyboard asking the CPU for attention.

بۆ هەریەکەیان بڵێ کام دەیگوازێتەوە و بە کام ئاڕاستەدا: (أ) ناونیشانی 7 بۆ خوێندنەوە؛ (ب) بەهای 9 کە لە دەنووسرێت؛ (ج) READ؛ (د) کە داوا لە دەکات ئاگاداری بێت.

Show answerوەڵامەکە پیشان بدە
  • (a) Address bus, CPU → memory.
  • (b) Data bus, CPU → memory (a write).
  • (c) Control bus, CPU → memory.
  • (d) Control bus (the interrupt request line, IRQ), device → CPU.
  • (أ) ، لە بۆ .
  • (ب) ، لە بۆ (نووسین).
  • (ج) ، لە بۆ .
  • (د) (هێڵی داوای پچڕاندن، IRQ)، لە ئامێرەکەوە بۆ .
ExerciseڕاهێنانThe three buses from memoryسێ تێپەڕگەکە لە بیرەوە

Without looking back, name the three parts of the system bus and write one sentence about the job of each.

بەبێ سەیرکردنەوەی بەشەکانی پێشوو، سێ بەشی ناو ببە و بۆ کاری هەریەکەیان ڕستەیەک بنووسە.

Show answerوەڵامەکە پیشان بدە
  • Control bus — signals such as read, write, clock and interrupt that coordinate the CPU's work.
  • Address bus — the address of the memory place or device, sent by the CPU.
  • Data bus — the data itself, in either direction.
  • — وەک خوێندنەوە، نووسین، کاتژمێر و پچڕاندن کە کاری ڕێک دەخەن.
  • — ناونیشانی شوێنی یان ئامێرەکە، کە دەینێرێت.
  • — خودی ، بە هەر دوو ئاڕاستە.
ExerciseڕاهێنانHow the parts talk to each otherبەشەکان چۆن پەیوەندی بە یەکترەوە دەکەن

(a) What is the main job of the system bus? (b) Why is the data bus two-way, while the address bus is one-way?

(أ) کاری سەرەکیی چییە؟ (ب) بۆچی دوولایەنەیە، بەڵام یەک لایەنەیە؟

Show answerوەڵامەکە پیشان بدە

(a) The system bus is the shared set of wires on the motherboard that carries data, addresses and control signals between the CPU, memory and the I/O modules: it is how the parts of the computer communicate. (b) Data has to travel both ways — into the CPU when it reads and out of it when it writes. An address only ever goes from the CPU, which decides which place to use, to memory or a device; memory never has to send an address back, so one direction is enough. (A DMA controller is the exception: it can also put addresses on the bus.)

(أ) ئەو کۆمەڵە تەلە هاوبەشەیە لەسەر کە ، ناونیشان و جڵەوکردن لە نێوان ، و مۆدیولەکانی / دەگوازێتەوە: بەشەکانی بەم شێوەیە پەیوەندی بە یەکترەوە دەکەن. (ب) دەبێت بە هەردوو ئاڕاستە بڕوات — کاتێک دەخوێنێتەوە دێتە ژوورەوە و کاتێک دەنووسێت دەچێتە دەرەوە. ناونیشان هەمیشە تەنها لە دەچێت بۆ یان ئامێرێک، چونکە بڕیار دەدات کام شوێن بەکار بێت؛ هەرگیز پێویست ناکات ناونیشانێک بگەڕێنێتەوە، بۆیە یەک ئاڕاستە بەسە. (کۆنترۆڵکەری DMA حاڵەتی جیاوازە: ئەویش دەتوانێت ناونیشان بخاتە سەر .)

Summaryپوختە

  • Registers are tiny, very fast storage places inside the CPU; RAM is outside it.
  • PC = address of the next instruction; IR = the current instruction; MAR = the address being used; MDR = the data moving in or out; ACC = results in simple CPUs; status register = flags; R0, R1 … = general-purpose.
  • The system bus on the motherboard has three parts: the data bus (both ways), the address bus (one way, from the CPU) and the control bus (signals).
  • n address lines reach 2n2^n places: 20 lines give 1 MiB, 32 lines 4 GiB.
  • Today the memory controller is inside the CPU, and RAM, graphics cards and SSDs use direct links (memory channels, PCIe) instead of one shared bus.
  • شوێنی هەڵگرتنی بچووک و زۆر خێران لەناو ؛ لە دەرەوەیەتی.
  • PC = ناونیشانی دواتر؛ IR = ئێستا؛ MAR = ئەو ناونیشانەی بەکار دێت؛ MDR = ئەو دێتە ژوورەوە یان دەچێتە دەرەوە؛ ACC = ئەنجامەکان لە سادەکاندا؛ = ؛ ⁦R0⁩، ⁦R1⁩ … = .
  • لەسەر سێ بەشی هەیە: (دوولایەنە)، (یەک لایەنە، لە ) و ().
  • n هێڵی ناونیشان دەگەنە 2n2^n شوێن: ⁦20⁩ هێڵ ⁦1 MiB⁩ و ⁦32⁩ هێڵ ⁦4 GiB⁩ دەدەن.
  • ئەمڕۆ کۆنترۆڵکەری لەناو . ، و لە جیاتی یەک هاوبەش بەستنەوەی ڕاستەوخۆ بەکار دەهێنن (کەناڵەکانی ، ).
Review questionsپرسیارەکانی پێداچوونەوە
Why can't the ALU add numbers straight from RAM?بۆچی یەکەی ژیربێژیی بیرکارییانە ناتوانێت ژمارەکان ڕاستەوخۆ لە RAMـەوە کۆ بکاتەوە؟

RAM is outside the CPU. Values must first come over the buses into registers (through MDR); the ALU works only on registers.

لە دەرەوەی . سەرەتا دەبێت بەهاکان بە بێنە ناو (بە MDRـدا)؛ تەنها لەسەر کار دەکات.

What is the difference between MAR and the PC? Both hold addresses.جیاوازیی نێوان MAR و PC چییە؟ هەردووکیان ناونیشان هەڵدەگرن.

The PC holds the address of the next instruction. MAR holds whatever address is being read or written right now — an instruction's or a piece of data's.

PC ناونیشانی دواتر هەڵدەگرێت. MAR هەر ناونیشانێک هەڵدەگرێت کە ئێستا دەخوێندرێتەوە یان دەنووسرێت — هی بێت یان هی .

How can several chips share the same data-bus wires without clashing?چۆن چەند چیپێک دەتوانن هەمان تەلەکانی تێپەڕگەی دراوە بەکار بهێنن بەبێ ئەوەی تووشی یەکتر ببن؟

Their outputs are tri-state: only the chip that is enabled drives the wires; all the others are disconnected (high impedance, Z).

دەرچوونەکانیان سێ‌دۆخین: تەنها ئەو چالاک کراوە بەها دەخاتە سەر تەلەکان؛ هەموو ئەوانی تر پچڕاون («بەرگریی بەرز»، Z).

Videoڤیدیۆ

Watch a videoسەیری ڤیدیۆیەک بکە

A video that viewers liked a lot and praised in their comments, chosen for this lesson.ڤیدیۆیەک کە بینەران زۆریان پێ خۆش بووە و لە کۆمێنتەکانیاندا ستایشیان کردووە، بۆ ئەم وانەیە هەڵبژێردراوە.

How Do CPUs Work?ExplainingComputers · Englishئینگلیزی · 437K viewsبینین · 15K likesلایک · Partبەشی 0:35–7:54 (ofلە 10:40)

Inside a CPU: the control unit, ALU, registers and the buses to memory, and how a program runs through the fetch-decode-execute cycle.

لەناو : ، ، و بەرەو ؛ هەروەها چۆن بە (، شیکردنەوە، جێبەجێکردن) کار دەکات.

Plays 0:35–7:54: CPU architecture with registers and buses, then how a program runs.

لە ⁦0:35⁩ تا ⁦7:54⁩ پەخش دەبێت: پێکهاتەی لەگەڵ و ، پاشان چۆن جێبەجێ دەکرێت.

Lesson complete!وانەکە تەواو بوو!

Well done. Review the key terms, then go on to the next lesson.دەستخۆش. سەیرێکی زاراوە سەرەکییەکان بکەرەوە، پاشان بڕۆ بۆ وانەی داهاتوو.

Key termsزاراوە سەرەکییەکان

Next lessonوانەی داهاتوو

How a Computer Runs a Programکۆمپیوتەر چۆن بەرنامەیەک جێبەجێ دەکات

References and further readingسەرچاوەکان و خوێندنەوەی زیاتر

This lecture is a first edition. The Kurdish text and terminology are waiting for review by Kurdish IT teachers.ئەم وانەیە چاپی یەکەمە. دەقە کوردییەکە و زاراوەکانی چاوەڕێی پێداچوونەوەی مامۆستایانی کوردی بواری IT ن.