Registers
لم يُترجم بعد؛ يُعرض باللغة الإنجليزية
A register is a row of D flip-flops that share one clock, so it stores a whole number of bits at once: 4 flip-flops hold 4 bits, 8 hold a byte. Watch every bit hop in together at the rising clock edge, see how a load signal and a mux in front of each flip-flop decide between taking new data and keeping the old value, turn the same row into a shift register, and finish with a register file of four registers.
5 أسئلة سريعة
اختر إجابة لتعرف السبب. تُحفَظ نتيجتك مع تقدّمك.
01How many D flip-flops does an 8-bit register need?
Each flip-flop stores one bit, so an 8-bit register is a row of 8 flip-flops sharing one clock.
02A register holds 1001 and its load signal is 0. The inputs change to 0110 and a rising clock edge arrives. What does it hold now?
With load 0 each mux feeds the flip-flop's own Q back to its D, so every flip-flop copies its old bit: the register keeps 1001.
03What does the multiplexer (mux) in front of each flip-flop do?
A 2-input mux passes one of its inputs. Load 1 picks the new data bit; load 0 picks the bit the flip-flop already holds.
04A 4-bit shift register holds 1100 (12). A 0 is shifted in on the left at the next clock edge. What does it hold?
Every bit moves one place to the right and the new 0 enters on the left: 0110, which is 6. Shifting right by one halves the number.
05In a register file, what picks which register gets written at the clock edge?
The decoder turns the write address (for example 10 = R2) into a load signal for that one register; the others keep their values.
المسرد
- D flip-flop
- A one-bit memory: at the rising edge of the clock it copies its input D to its output Q, and holds Q the rest of the time.
- Register
- A row of D flip-flops sharing one clock, storing a multi-bit value: an 8-bit register is 8 flip-flops.
- Rising clock edge
- The moment the clock signal goes from 0 to 1. Edge-triggered flip-flops only change then.
- Load (enable)
- A control signal: 1 means the register takes new data at the next clock edge, 0 means it keeps its value.
- Multiplexer (mux)
- A switch circuit with several inputs and one output; select lines choose which input is passed through.
- Shift register
- Flip-flops wired output to next input, so at every clock edge each bit moves one place along.
- Decoder
- A circuit that turns a binary number into one active output line, for example 10 turns on line 2 of 4.
- Register file
- A small, fast group of registers inside a processor, with a decoder to choose the one to write and muxes to choose the ones to read.
الملاحظات والمصادر
- A D flip-flop copies its input D to its output Q only at the rising edge of the clock and holds Q the rest of the time. A row of N of them on one clock is an N-bit register (Harris and Harris, Digital Design and Computer Architecture, sections 3.2.3 and 3.2.4).
- A register with a load (enable) input puts a 2-input multiplexer in front of each flip-flop: with load 0 the mux feeds Q back to D, so the flip-flop reloads its own value at every edge (Harris and Harris, section 3.2.5; Nand2Tetris chapter 3 builds its Bit chip the same way).
- Real parts: Texas Instruments' SN74HC273 contains eight D flip-flops that share one clock and load on its positive edge; the SN74HC595 is an 8-bit serial-in shift register.
- In Python, x >> n is floor division by 2 to the power n, so 12 >> 1 is 6 and 7 >> 1 is 3: the bit shifted out is the remainder that gets dropped.
- A register file is a small, fast memory of registers. A decoder turns the write address into a load signal for one register; multiplexers pick the registers to read. Reads need no clock edge; writes happen on the edge (Harris and Harris, section 5.5, memory arrays). RISC-V's base integer instruction set has 32 registers, x0 to x31, and x0 always reads 0.
- Harris and Harris, Digital Design and Computer Architecture (sections 3.2, 5.4 and 5.5)
- Nisan and Schocken, The Elements of Computing Systems (Nand2Tetris), project 3: memory
- Texas Instruments SN74HC273 datasheet: octal D-type flip-flops with clear
- Texas Instruments SN74HC595 datasheet: 8-bit shift register with output latches
- RISC-V specifications (unprivileged ISA: integer registers x0 to x31)
- Python reference: shifting operations
- MIT OpenCourseWare 6.004 Computation Structures
اختبار يتاح بعد الخطوة الأخيرة.