Adders and flip-flops
แนะนำใหม่
14:50
RISC, Pipelines & Logic
นักออกแบบชิปสองคนเผชิญปัญหาเดียวกัน: ทำให้โปรแกรมทำงานเร็ว คนหนึ่งบอกว่า — สร้างคำสั่งทรงพลัง เพื่อให้แต่ละคำสั่งทำงานได้มาก คนอื่นบอกว่า — รักษา…
บรรยายภาษาอังกฤษ · สลับคำบรรยายภาษาอังกฤษและภาษาจีนได้
ในบทเรียนนี้
| English | ความหมาย |
|---|---|
| processor/ˈprəʊsesə/ | The component that executes instructions and performs the operations of a computer or similar system. |
| adder/ˈædə/ | A logic circuit that adds binary numbers. |
| gates | Electronic components that produce an output from one or more binary inputs. |
| sum digit | The digit written in one column after adding the bits and any carry-in. |
| carry/ˈkæri/ | การถ่วง |
| half adder/hɑːf ˈædə/ | ฮาล์ฟแอดเดอร์ |
| full adder/fʊl ˈædə/ | เครื่องบวกเต็ม |
| carry-in | A bit carried from the column to the right into an addition. |
| bit/bɪt/ | A binary digit, taking the value zero or one. |
| memory/ˈmeməri/ | Circuits that store data, such as registers, RAM and ROM. |
| flip-flop/flɪp flɒp/ | ฟลิป-ฟลอป (Flip-flop) |
| sum/sʌm/ | The bit produced in the current column when binary bits are added. |
| binary addition | The process of adding numbers written using the digits zero and one. |
| carry-out | A bit carried from an addition to the next column on the left. |
| ripple-carry adder/ˈrɪpl ˈkæri ˈædə/ | เครื่องบวกแบบนำพากระแสวน |
| 4-bit adder | A circuit that adds two binary numbers with four bits each. |
| bistable/baɪˈsteɪbl/ | สภาวะสองเสถียรภาพ |
| circuit/ˈsɜːkɪt/ | A complete path through which electric current can flow. |
| registers/ˈredʒɪstəz/ | A small, fast storage location within a processor used to hold data, addresses or instructions temporarily. |
| counters/ˈkaʊntəz/ | ตัวนับ |
| SRAM/ˈesræm/ | A type of RAM that uses flip-flops to store bits without needing refresh. |
| cells/selz/ | Small parts of memory that each store a bit of data. |
| SR flip-flop/ˌes ˈɑː flɪp flɒp/ | _flip-flop SR_ |
| set/set/ | To make the output Q of a flip-flop become 1. |
| reset | To make the output Q of a flip-flop become 0. |
| cross-coupled NOR gates | Two NOR gates connected so each output feeds into the other gate's input. |
| JK flip-flop/ˌdʒeɪ ˈkeɪ flɪp flɒp/ | _flip-flop JK_ |
| toggle/ˈtɒɡl/ | การสลับสถานะ |
| clock edge/klɒk edʒ/ | The moment when a clock signal changes from 0 to 1 or from 1 to 0. |
เครื่องมือที่รู้เพียงจริงและเท็จ ทำคณิตศาสตร์ได้อย่างไร
- ตัวประมวลผลไม่มีเครื่องบวกในความหมายของสิ่งที่มีตัวเลขอยู่ข้างใน มีแต่เกตที่ตอบว่าจริงหรือเท็จ และไม่มีอย่างอื่น
- แต่ $1 + 1 = 10$ เกิดขึ้นจากเกตสองตัว: XOR ให้ผลรวม digit, AND ให้การยกตัว นั่นคือหน่วยคำนวณทั้งหมดในแบบจำลองเล็ก ๆ และการเชื่อมต่อกันหลายครั้งจะบวกเลขได้ทุกขนาด
- อีกครึ่งหนึ่งของคอมพิวเตอร์คือการจดจำ และหนึ่งบิตของหน่วยความจำก็คือเกตเช่นกัน ที่ต่อสายให้เอาต์พุตย้อนกลับเข้าอินพุตเพื่อคงค่าไว้
- บทเรียนนี้คือ half adder, full adder และ flip-flop ที่เก็บบิต
Half adder
- half adder บวกบิตเดี่ยวสองตัว คือ $A$ และ $B$, ผลลัพธ์คือ sum $S$ และ carry $C$
| A | B | S | C |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
- อ่านตามคอลัมน์: $S$ เป็น 1 เมื่อมีอินพุตเป็น 1 พอดี ซึ่งคือ XOR. $C$ เป็น 1 ก็ต่อเมื่อทั้งสองเป็น 1 ซึ่งคือ AND. ดังนั้น $S = A \oplus B$ และ $C = A \cdot B$
- มันมองข้ามcarry เข้า ซึ่งเป็นเหตุผลว่ามันเป็นเพียง "ครึ่ง" ของadder และไม่ สามารถต่อ chained กันเองได้

เกตสองตัว และบวกไบนารีก็เกิดขึ้น
The gates inside an adder
A half-adder's sum bit is an XOR gate and its carry is an AND gate — toggle A and B and watch the truth-table row light up.
In a half adder, the sum output S is produced by which gate?
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
$S = A \text{ XOR } B$ (1 when the inputs differ); the carry is $A \text{ AND } B$.
In a half adder the carry output C is produced by which single gate?
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
C is 1 only when both inputs are 1, which is AND. The sum S is 1 when exactly one input is 1, which is XOR.
Full adder
- Full adder บวก สาม บิต: $A$, $B$ และ carry-in, สร้างผลรวมและการยกตัวออก. $S = A \oplus B \oplus C_{\text{in}}$
- สามารถสร้างได้จาก half adder สองตัวบวกกับ OR gate: ตัวแรกบวก $A$ กับ $B$, ตัวที่สองบวกผลรวมนั้นกับ carry-in, และ OR รวมการยกตัวทั้งสอง
- เชื่อมต่อ full adders โดยให้ carry-out ของแต่ละตัวเข้า carry-in ของตัวถัดไป จะได้ ripple-carry adder แบบหลายบิต: สี่ตัวบวกเลข 4-bit สองจำนวน

การยกตัวคือสิ่งที่ต้องเดินทาง นี่คือเหตุผลที่เรียกว่า ripple
Match each building block to what it does.
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Adders add bits (chain full adders for multi-bit addition); flip-flops store a bit (the JK fixes the SR forbidden state).
How does a full adder differ from a half adder?
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
A full adder adds A, B and a carry-in (so adders can be chained) — built from two half adders plus an OR gate.
ตัวอย่างวิธีทำ: ทำไมใช้ full adder ไม่ใช่ half adder สองตัว
- อธิบายว่าทำไมเครื่องบวก 4-bit จึงสร้างจาก full adders แทนที่จะเป็น half adders.
- การบวกเลข 4-bit สองจำนวนทีละคอลัมน์ คอลัมน์ใดที่ไม่ใช่คอลัมน์ขวาสุดอาจได้รับ carry จากคอลัมน์ทางขวา, ดังนั้นจึงมี สาม อินพุตที่ต้องบวก ไม่ใช่สอง
- Half adder ไม่มี carry-in ดังนั้นจึงรับอินพุตที่สามไม่ได้ และการยกตัวจะหายไป
- เฉพาะคอลัมน์ที่มีนัยสำคัญน้อยที่สุดเท่านั้นที่ไม่มี carry-in ดังนั้น half adder จึงใช้ได้ตรงนั้น; ในทางปฏิบัติทั้งสี่เป็น full adders—with carry-in ตัวแรกต่อเข้ากับ 0

Why must a 4-bit adder use full adders rather than half adders?
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
A half adder does produce a carry; what it lacks is a carry-in, so it cannot accept the carry arriving from the previous column.
Put the construction of a 4-bit ripple-carry adder in order.
ความยาก 3/5 · 200 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Gates make a half adder, half adders make a full adder, full adders chain into a word-width adder. The carry rippling along is what gives it its name.
Flip-flops
- A flip-flop is a bistable circuit: it has two stable states, 0 and 1, and it remembers the one it is in. It stores exactly one bit.
- มันเป็นองค์ประกอบพื้นฐานของ รีจิสเตอร์, ที่ $n$ บิต หมายถึง $n$ ฟลิปฟลอป, ของเคาน์เตอร์, และเซลล์หน่วยความจำ SRAMRAM.
- ต่างจากแอดเดอร์ (adder) ที่ผลลัพธ์ขึ้นอยู่กับอินพุตปัจจุบันเท่านั้น ผลลัพธ์ของฟลิปฟลอปขึ้นอยู่กับอินพุต ในอดีต (past inputs) นั่นคือความหมายของความจำในระดับวงจร
A flip-flop is used to:
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
A flip-flop has two stable states and holds one bit — the building block of registers and SRAM.
A flip-flop is bistable — it has two stable states and remembers one bit — which makes it the building block of registers and SRAM.
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Chaining flip-flops gives registers and counters; SRAM cache is built from them (no refresh needed, unlike DRAM).
SR และ JK
- An SR flip-flop SR has inputs S (set) and R (reset) and outputs $Q$ and $\overline{Q}$, built from two cross-coupled NOR gates.
S=1, R=0ตั้ง $Q$ เป็น 1.S=0, R=1รีเซ็ต $Q$ เป็น 0.S=0, R=0เก็บ สถานะปัจจุบัน ซึ่งเป็นความจำ.S=1, R=1ไม่ถูกต้อง: เพราะมันขอทั้ง set และ reset พร้อมกัน- A JK flip-flop JK removes that flaw by giving the
1,1input a meaning: toggle, so the output flips to its opposite. That makes it ideal for counters, since a chain of toggling flip-flops counts in binary. - A JK is usually clocked: the inputs act only on a clock edge, which keeps every flip-flop in the machine in step.

The invalid input turned into a useful one
For an SR flip-flop, which statements are correct? Select ทั้งหมด that apply.
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Toggling on 1,1 is the JK's improvement. On an SR that input asks for set and reset at once and is invalid.
The JK flip-flop's toggle behaviour is what makes it suitable for building counters.
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
A chain of flip-flops each toggling on its input counts in binary. Clocking them keeps every stage in step.
Worked example: trace an SR flip-flop
- $Q$ is currently 0. Give $Q$ after the inputs S=1 R=0, then S=0 R=0, then S=0 R=1.
- S=1, R=0 sets the output, so $Q$ becomes 1.
- S=0, R=0 holds, so $Q$ stays 1. This is the step that shows it is a memory: the inputs say nothing, and the output persists.
- S=0, R=1 resets, so $Q$ becomes 0. If S=1 and R=1 were applied, the answer is that the input is invalid, not a value.

คะแนนที่หลุดหายไป
- $S = A \oplus B$ and $C = A \cdot B$: XOR for the sum, AND for the carry. Swapping them loses both marks.
- "Half" means no carry-in, not "half the bits".
- A full adder is two half adders plus an OR, and the OR combines the two carries.
- On an SR flip-flop,
0,0holds and1,1is invalid. The JK's improvement is that1,1toggles.
คุณเข้าใจแล้ว
- half adder: two bits in, $S = A \oplus B$ from an XOR and $C = A \cdot B$ from an AND; no carry-in
- full adder: three bits in, built from two half adders plus an OR; chain them, carry-out to carry-in, for a ripple-carry adder
- a flip-flop is bistable and stores one bit; $n$ flip-flops make an $n$-bit register, and they are the cells of SRAM
- SR: set, reset,
0,0holds,1,1invalid · JK:1,1toggles, which is what makes counters, and it is clocked to stay synchronised
เกิดปัญหาอะไรขึ้น? เฉพาะทีมเว็บไซต์เท่านั้นที่เห็นข้อมูลนี้