Salta al contenuto
Note per Studenti Registers and Load Control Report

Registers and Load Control

In questa pagina 3

For complex systems divided into modules (some made of repeated identical blocks) a single state diagram is no longer enough: larger structures are needed, such as registers, counters, datapaths and control units.

Registers

An nn-bit register is made of nn flip-flops and some logic gates: the flip-flops store the data, the gates process the data arriving at the flip-flop inputs. A counter is a register that goes through a sequence of states (Shift Registers and CountersA shift register is a chain of D flip-flops, each output feeding the next input, so bits move one position per clock edge; it has serial input and output, optional parallel load (Shift has priority over Load) and a bidirectional version with a 4-to-1 MUX per stage (S1S0: 00 hold, 01 shift left, 10 shift right, 11 load). Uses: serial/parallel conversion, serial interfaces, delay lines, pseudo-random generators. Counters step through a sequence of states: the ripple (asynchronous) counter clocks each flip-flop with the previous output and accumulates delay, the synchronous counter uses one clock for all flip-flops and is faster, with EN and CO for cascading.Shift Registers and Counters →).

Simplest 4-bit register. Only PET D flip-flops, no gates: each FF stores one bit at every rising edge of the common clock. Loading new data is the load operation, here parallel (all 4 bits together). A common reset signal (clear‾\overline{clear}, active low) asynchronously forces all QiQ_i to 0; in normal operation clear‾=1\overline{clear}=1.

Controlling the load

We do not always want the register updated at every clock, only when needed. Two techniques.

a) Clock gating. The system (master) clock is a continuous pulse train; an OR gate controlled by LoadLoad lets the clock reach the FFs only when wanted: the FF clock input is C=Clock+Load‾C=Clock+\overline{Load}. With Load=1Load=1, C=ClockC=Clock and the FFs update at every rising edge. With Load=0Load=0, C=1C=1 steadily: there are no rising edges and the content does not change. LoadLoad must stay constant while Clock=0Clock=0 (for instance if it comes from a PET FF).

Drawbacks: gates between system clock and effective clock add propagation delays and therefore clock skew (the clock reaches elements at different times, so the system is no longer perfectly synchronised), requiring care in high-speed designs (Timing of Sequential Systems - Setup, Hold and Maximum Clock FrequencyA flip-flop stores the right value only if its input is stable for the setup time before and the hold time after the clock edge, and its output changes after the propagation delay. In a synchronous circuit the clock period must satisfy T >= t_pd,FF + t_COMB + t_s,FF + t_slack, which fixes the maximum frequency; slowing the clock cures setup violations but not hold violations, which require t_pd,FF,min + t_COMB,min >= t_h. Clock skew modifies both constraints.Timing of Sequential Systems - Setup, Hold and Maximum Clock Frequency →). Advantage: in complex circuits not all subsystems work together; switching off the clock of idle parts reduces power consumption without reducing performance.

Definition (load enable). The clock always reaches the FFs; the input is controlled instead: a 2-to-1 MUX selects for D between the data DD (if EN=1EN=1) and the FF's own output QQ (if EN=0EN=0):

  • EN=1EN=1: Q(t+1)=DQ(t+1)=D (load at the rising edge);
  • EN=0EN=0: Q(t+1)=Q(t)Q(t+1)=Q(t) (the register holds).

This defines the D flip-flop with enable; a register with load enable is nn of them in parallel with the same clock and the same LoadLoad. It is preferable to clock gating because it avoids clock skew and malfunctions. In VHDL: if load = '1' then Q <= D; end if; inside the clock-edge branch (VHDL - Latches, Flip-Flops and ResetsIn VHDL a memory element is a process in which some branch does not assign the signal: the D latch is process(D,C) with if C='1' then Q<=D, the positive-edge-triggered flip-flop is process(CLK) with if CLK'event and CLK='1'. Asynchronous reset: RST is in the sensitivity list and tested first (if RST='1' ... elsif clock edge); synchronous reset: only CLK in the list and RST tested inside the clock-edge branch, so a clock edge is needed for it to act. The testbench of a synchronous circuit has a process generating the clock and one applying inputs away from the active edge.VHDL - Latches, Flip-Flops and Resets →).

Datapath and control unit

A sequential system with many states is not described well by one state diagram or table: use the hierarchical approach and divide it into blocks. Many digital systems split into two macroblocks:

  • the datapath performs data processing (arithmetic, logic, ...): made of registers and arithmetic-logic blocks; it receives data inputs and control signals and provides data outputs and status signals;
  • the control unit sets the order of operations: a synchronous sequential machine that, from its own control inputs and the datapath status signals, generates the control signals the datapath executes.

The elementary operations on register data are the microoperations (Microoperations and RTLA microoperation is an elementary operation on register data, written in Register Transfer Language (RTL), for example K1: R2 <- R1 meaning that when K1 is 1 the content of R1 is copied into R2 at the clock edge. Microoperations are transfers (simultaneous ones separated by commas exchange contents), arithmetic (add, subtract, increment, decrement), logic bit by bit with masks (AND clears, OR sets to 1, XOR complements) and shifts (sl towards the MSB doubles, sr towards the LSB halves).Microoperations and RTL →); the control unit supplies the signals that trigger their sequence. A complete example is in Datapath and Control UnitA register cell is a flip-flop with logic for microoperations, shared across the n cells of a register. In a programmable system (CPU) the control unit executes instructions fetched from memory using a program counter; in a non-programmable system the control unit decides the microoperations only from inputs and datapath status signals. Complete example: summing five values with start, res and busy; the datapath has ACC_REG, OUT_REG and CNT_REG (decrementer, MUX, status signal zero); microoperations are combinations of control signals; the control unit is a 3-state Mealy machine (ready, acc, init).Datapath and Control Unit →.

Versione ripasso

  • Register: nn PET D FFs with a common clock; parallel load; asynchronous active-low clear‾\overline{clear}. A counter is a register stepping through states.
  • Clock gating: C=Clock+Load‾C=Clock+\overline{Load}; Load=1Load=1 passes the clock, Load=0Load=0 freezes it at 1. Saves power; gates add delay and skew; LoadLoad must be stable while the clock is low.
  • Load enable (preferred): MUX 2-to-1 before each D: EN=1EN=1 gives Q(t+1)=DQ(t+1)=D, EN=0EN=0 gives Q(t+1)=Q(t)Q(t+1)=Q(t). No skew. VHDL: if load = '1' then Q <= D; end if; in the edge branch.
  • Datapath (registers and arithmetic-logic blocks; data in/out, control and status signals) and control unit (synchronous FSM generating control signals from status signals).
  • Mistakes: gating the clock for load without considering skew and delays.

Teoria collegata