Sequential Circuits, Timing, Data Converters, Memories and Computer Organisation

The second half of Section 5 of the EC paper is where digital circuits stop being algebra. A combinational block's output depends only on its present inputs; the moment you add storage, the output depends on history, and two entirely new kinds of question become possible. One asks what the circuit reaches after some number of clock edges — a trace, and largely bookkeeping. The other asks how fast the clock may run, and that is not a logic question at all: it is arithmetic on propagation delay, setup time, hold time and critical path delay, the four quantities the syllabus names explicitly and the ones an EC candidate is expected to handle at circuit level rather than as abstractions. The rest of the section is the interface between the analog world and this one: sample and hold circuits, ADCs and DACs, where the arithmetic of resolution and the physics of a hold capacitor meet; ROM, SRAM and DRAM, three memories that differ in how many transistors a bit costs and whether reading destroys it; and a compact computer organisation sub-list of exactly four items — machine instructions and addressing modes, the ALU, the data path and control unit, and instruction pipelining. Keep that last list at its stated size. It is four items in the EC syllabus, not a paper of its own, and the useful depth is enough to compute an effective address, a pipeline clock period and a speedup — not enough to design a cache.

Latches and Flip-Flops: Level Against Edge

Storage in a digital circuit comes from positive feedback. Cross-couple two inverters and the pair has two stable states, which is one bit; open one of the feedback paths so that an input can force the state and you have a latch. The SR latch is the canonical form: two NOR gates cross-coupled, with S forcing the output high and R forcing it low, and S = R = 1 forbidden because it drives both outputs low and leaves the next state undefined when the inputs are released together. Add an enable and the level-sensitive D latch appears — while the enable is high the output follows D, which is exactly the behaviour a synchronous design cannot tolerate, because data racing through a transparent latch can propagate through several stages in one clock phase.

A flip-flop removes that exposure by sampling only at a clock edge. The standard construction is master-slave: two D latches in series with opposite enable polarity, so the master is transparent while the clock is low and the slave while it is high, and no path is ever transparent end to end. In CMOS the latches themselves are usually built from transmission gates rather than from NOR gates, which is cheaper, and that is where the D type's dominance comes from — a modern library offers a D flip-flop and builds anything else around it. Know the characteristic equations rather than the tables, because the equations are what you substitute into a state trace: Q+ = D for the D type, Q+ = T ⊕ Q for the T type, Q+ = J·Q′ + K′·Q for the JK, and Q+ = S + R′·Q for the SR subject to S·R = 0.

Four storage elements, their equations and their circuit-level catch
ElementCharacteristic equationThe catch a question exploits
SR latch, NOR builtQ+ = S + R′Q, with SR = 0Level sensitive, and S = R = 1 is forbidden
D latchQ+ = D while enabled, else holdTransparent, so data can race through
D flip-flop, master-slaveQ+ = D sampled at the edgeNeeds D stable across the setup and hold window
JK flip-flopQ+ = JQ′ + K′QJ = K = 1 toggles, which the SR case forbade
T flip-flopQ+ = T ⊕ QA JK with inputs tied — the natural counter cell
🎯 Why metastability cannot be designed away, only made improbable
A flip-flop's two stable states are separated by an unstable balance point, and if the data edge arrives inside the sampling window the internal node can be left near that point. From there it resolves exponentially, with a time constant set by the loop gain, so the probability that it is still undecided after a time t falls off as exp(−t/τ) — small, but never zero, and never removable by a better circuit. This is why an asynchronous input crossing into a clocked domain is passed through two flip-flops in series: the first may go metastable, and the second samples it a full clock period later, by which time the residual probability is negligible. The examinable point is the shape of the answer, not a number: synchronisers reduce the failure rate and are quoted as a mean time between failures, and any claim that a design is metastability-free is wrong.

Propagation Delay, Setup and Hold, and the Critical Path

Four delays describe a clocked stage, and mixing them up is the single most expensive habit in this section. Propagation delay t_pcq is the longest time from the clock edge until the flip-flop's output has settled. Contamination delay t_ccq is the shortest time from that edge until the output begins to change. Setup time t_su is how long the data must already be stable before the edge, and hold time t_h is how long it must remain stable after it. The combinational logic between two flip-flops has its own longest and shortest paths, t_pd and t_cd. The critical path is the longest register-to-register route through the whole design, and the clock period must exceed it; the shortest such route matters too, but for a completely different reason.

Work one stage all the way through. Take t_pcq = 0.9 ns, t_ccq = 0.5 ns, t_su = 0.4 ns, t_h = 0.25 ns, a combinational block whose longest path is t_pd = 3.2 ns and whose shortest is t_cd = 0.15 ns, and clock skew of 0.2 ns between the two flip-flops. The setup constraint says data launched at one edge must arrive and settle before the next: T_c ≥ t_pcq + t_pd + t_su + t_skew = 0.9 + 3.2 + 0.4 + 0.2 = 4.7 ns, so f_max = 1/4.7 ns ≈ 212.8 MHz. The hold constraint is a different inequality with no T_c in it at all: t_ccq + t_cd ≥ t_h + t_skew, that is 0.5 + 0.15 = 0.65 ns against 0.25 + 0.2 = 0.45 ns, satisfied with 0.2 ns of margin. Now push the skew to 0.45 ns and the hold requirement becomes 0.70 ns, which 0.65 ns fails — and no clock frequency fixes it, because the clock period does not appear in the inequality.

The two timing constraints, and what each one is fixed by
ConstraintInequalityValue in the worked stageCure when it fails
Setup, the long pathT_c ≥ t_pcq + t_pd + t_su + t_skew4.7 ns, so 212.8 MHzSlow the clock, or pipeline the logic
Hold, the short patht_ccq + t_cd ≥ t_h + t_skew0.65 ns against 0.45 ns, so 0.2 ns of marginAdd delay buffers, or reduce skew — never the clock
⚠️ A hold violation survives any clock frequency, including zero
The most reliable trap in this sub-item is a question that reports a failing circuit and offers a slower clock as a remedy. Look at which inequality fails. A setup failure is a race against the next edge, so lengthening the period always cures it. A hold failure is a race against the same edge — new data arriving at the second flip-flop before it has finished capturing the old — and the period is not in the expression, so the circuit fails identically at 200 MHz and at 1 kHz. Fixes are structural: insert deliberate delay on the short path, rebalance the clock tree so skew shrinks, or choose a flip-flop with a smaller hold requirement. Notice also which way skew hurts: it eats into the setup budget and the hold budget at once, which is why clock distribution rather than gate delay is what limits large synchronous chips.

Counters and Shift Registers, Counted in Nanoseconds

A mod-N counter needs ⌈log₂ N⌉ flip-flops, so a mod-12 counter takes four and a mod-100 counter takes seven, with the unused states either unreachable by design or steered back by decoding logic. The examinable divide is not the count but the clocking. In a ripple (asynchronous) counter each flip-flop's output clocks the next, so the delays add: four flip-flops of 7 ns propagation delay leave the outputs unsettled for up to 4 × 7 = 28 ns after an edge, which caps the usable clock at about 1/28 ns ≈ 35.7 MHz and, worse, means the output bus passes through counts the sequence never really visits. Decode those transient patterns and you get glitches — the reason a ripple counter's outputs should never drive a decoder directly.

A synchronous counter clocks every flip-flop from the same edge, so the outputs change together and the delays do not accumulate. What limits it instead is one stage of the loop: T_c = t_pcq + t_comb + t_su. With the same 7 ns flip-flops, 4 ns of enable-chain logic between stages and a 2 ns setup requirement, T_c = 13 ns and f_max ≈ 76.9 MHz — more than twice the ripple counter's ceiling. Look at what has vanished from that expression: the number of bits. Adding a fifth stage to a synchronous counter does not slow it down unless it lengthens the enable chain, whereas adding one to a ripple counter always does. That asymmetry, and not gate count, is why synchronous counters dominate despite costing more logic.

A shift register is n flip-flops in a chain, each feeding the next, so a serial bit stream is delayed by exactly n clocks — the standard serial-to-parallel and parallel-to-serial converter, and the delay line inside every digital filter. Feed the output back and the sequence closes: a ring counter of n stages has n states with one hot bit circulating, while a Johnson or twisted-ring counter feeds back the complement and gets 2n states from the same n flip-flops. Feed back an XOR of two tapped stages and you have a linear feedback shift register, which is what generates pseudo-random bit sequences in communication test equipment. A 4-bit LFSR with taps on the third and fourth stages cycles through 15 states — every pattern except all zeros, which is a fixed point the register can never leave. In general an n-bit maximal LFSR has 2^n − 1 states, and the missing one is always the all-zero word.

Four registers of four flip-flops each, and how many states each gives
StructureFeedbackStates in the cycle
Binary counterToggle logic on the enable chain16, the full count
Ring counterLast output to first input4, one hot bit circulating
Johnson counterComplement of the last output8, twice the flip-flop count
Maximal LFSRXOR of the third and fourth stages15, all but the all-zero word

Finite State Machines: Mealy, Moore and One Clock of Difference

A synchronous FSM is a state register plus two blocks of combinational logic: next-state logic reading the present state and the inputs, and output logic. In a Moore machine the output is a function of the state alone; in a Mealy machine it is a function of the state and the current input. That single difference has three consequences worth carrying into the exam. A Mealy machine usually needs fewer states, because the input can do some of the discriminating. Its output appears one clock earlier, because it does not wait for the transition to be registered. And its output can glitch, since it follows an input directly through combinational logic, whereas a Moore output changes only just after a clock edge and is therefore clean enough to drive other logic without qualification.

Design the standard detector both ways to see it. The task is to raise an output whenever the serial input has just completed the pattern 101, with overlaps allowed. As a Moore machine four states are needed: S0 has no useful prefix, S1 has seen a 1, S2 has seen 10, and S3 has seen 101 and is the only state whose output is 1. The transitions worth checking are the ones out of S3: on a 0 it goes to S2, because the sequence now ends in 10, and on a 1 it goes to S1, because the sequence now ends in a single useful 1. Get those two wrong and the machine stops detecting overlaps. As a Mealy machine three states suffice — A, B after a 1, C after 10 — and the output is asserted on the transition from C on input 1, which returns to B rather than to A for exactly the same overlap reason.

The overlapping 101 detector as a Moore machine
Present stateMeaningNext state on input 0Next state on input 1Output
S0No useful prefix yetS0S10
S1Seen 1S2S10
S2Seen 10S0S30
S3Seen 101, pattern completeS2, since the tail is now 10S1, since the tail is now 11

Trace the input 1101011 through the Moore table, starting in S0, and the states visited are S1, S1, S2, S3, S2, S3, S1. The output is high in the two visits to S3, so the machine reports two detections — which is right, because 1101011 contains 101 starting at its second bit and again starting at its fourth, the two occurrences sharing a 1. A machine that reported one detection was built without the overlap transitions; a machine that reported three has invented one. Notice that both designs need ⌈log₂ 4⌉ = 2 flip-flops for Moore and ⌈log₂ 3⌉ = 2 for Mealy, so on this example the Mealy saving in states buys no hardware at all — a useful corrective to the idea that fewer states always means a smaller circuit.

🧠 Name each state by the suffix it remembers, and the table writes itself
The reliable way to build a detector is to define each state as the longest prefix of the target pattern that is currently a suffix of the input seen so far. Then every transition is answered by one question: after appending this bit, what is the longest prefix of the pattern that is still a suffix? From S3 (101) on a 0 the input ends in 1010, whose longest useful suffix is 10, so the next state is S2, and the overlap handling comes out automatically instead of being remembered. The same recipe scales to any pattern and to any alphabet, and it is much faster under exam pressure than drawing arrows and hoping. It also tells you the state count before you start: a pattern of length k needs k + 1 Moore states when no prefix repeats.

Sample and Hold, ADCs and DACs

An ADC needs its input to stand still while it decides, so almost every converter is preceded by a sample and hold: a switch that connects the input to a hold capacitor C_H through a buffer, and a high-impedance amplifier that reads the capacitor once the switch opens. Four numbers characterise it. Acquisition time is how long the switch must stay closed for the capacitor to settle to within the required error — set by the source resistance and C_H. Aperture time and its jitter are the uncertainty in when the switch actually opened, which converts input slew into amplitude error. Droop is the slow decay of the held voltage caused by leakage into the switch and the amplifier's input. And pedestal error is the step injected by charge from the switch as it opens.

Droop is where a clean numerical question lives, because it ties the analog part to the resolution. Take a 12-bit converter with a 5 V reference. One least significant bit is 5/4096 = 1.2207 mV, and a sensible error budget for the hold stage is half of that, 0.6104 mV. Now let the hold capacitor be C_H = 100 pF with a total leakage of 10 nA. The droop rate is dV/dt = I/C = 10 × 10^(−9) / 100 × 10^(−12) = 100 V/s, which is 0.1 mV/µs. Divide the budget by the rate: the voltage may be held for 0.6104 / 0.1 = 6.1 µs before the droop alone costs half a bit. That single division decides whether a given converter can be driven by a given sample-and-hold, and it explains the design pull in both directions — a larger C_H droops more slowly but takes longer to acquire, and the two requirements meet somewhere in the middle.

The same 12-bit, 5 V converter fixes the other standard figures. Quantisation error is bounded by ± half an LSB = ±0.61 mV, and the signal-to-quantisation-noise ratio of an ideal converter on a full-scale sine is 6.02n + 1.76 = 6.02 × 12 + 1.76 = 74.0 dB — the reason resolution is quoted in bits and dynamic range in decibels, one bit being worth about 6 dB. On the ADC side the architectures trade speed against hardware in a way worth knowing as a table rather than as prose. On the DAC side, a weighted-resistor DAC needs resistances spanning R to 2^(n−1)R, which is unbuildable at 12 bits, while an R-2R ladder needs only two resistor values and is therefore what real parts use. For an 8-bit R-2R DAC with V_ref = 8 V, the output is V_ref × D/256; the code 10100000 is D = 160, so the output is 8 × 160/256 = 5.000 V, and one LSB is 8/256 = 31.25 mV.

Four ADC architectures at 12 bits, and what each costs
ArchitectureHow it decidesConversion timeHardware at 12 bits
FlashAll thresholds compared at onceOne clock — the fastest there is2^12 − 1 = 4095 comparators, which is why flash stops at 6 to 8 bits
Successive approximationBinary search, one bit per clockn clocks, so 12 µs at a 1 MHz clockOne comparator and one DAC
Dual slope, integratingCharges then discharges an integratorUp to 2 × 2^n counts — slow by designAn integrator and a counter; rejects mains hum
Sigma-deltaOversamples one bit, then filters digitallyMany oversampled clocks per output sampleA one-bit loop plus a decimation filter; best resolution
💡 A successive-approximation ADC is a chemist's balance
Weighing an unknown mass with a set of weights of 1, 2, 4, 8 grams and so on, you start with the heaviest: put it on, and if the pan tips the wrong way take it off again, then try the next. Each weight is tested exactly once, each test gives one bit, and after as many tests as there are weights you know the mass to within the smallest of them. That is precisely the SAR loop — the internal DAC plays the role of the weights, the comparator is the pan, and the register records the keep-or-discard decisions in order from the most significant bit down. The analogy also predicts the architecture's weakness: the input must not move during the weighing, which is exactly why a sample and hold is mandatory in front of a SAR converter and optional in front of a flash one.

ROM, SRAM and DRAM: What a Bit Costs

All three memories are the same architecture — an address decoder driving one row of an array, and a column circuit reading or writing the selected cells — and they differ almost entirely in the cell. A ROM cell is the presence or absence of a transistor at a crossing, so a ROM is literally a printed truth table: address lines are the inputs, the addressed word is the outputs. That makes a ROM a general combinational logic block, and the sizing question follows directly: to implement three arbitrary functions of four variables you need 2^4 words of 3 bits, which is 16 × 3 = 48 bits, and no minimisation is required or possible. An SRAM cell is two cross-coupled inverters plus two access transistors, six transistors, which holds its value as long as power is present and can be read without disturbing it. A DRAM cell is one transistor and one capacitor, which is why DRAM is several times denser and cheaper per bit than SRAM, and it pays for that density twice over.

The first payment is that a DRAM read is destructive. Sharing the tiny cell capacitor's charge onto the much larger bit-line capacitance leaves only a few tens of millivolts of signal, which a sense amplifier must resolve and then write back — so every read is a read-modify-write, and the row must be precharged before the next access. The second payment is refresh. Leakage discharges the cell, so every row must be rewritten within a retention time, typically 64 ms. A part with 4096 rows must therefore refresh one row every 64 ms / 4096 = 15.625 µs, and if a refresh cycle occupies 100 ns the overhead is 100 ns / 15.625 µs = 0.64 % of the available bandwidth — small, but never zero, and it is why DRAM has a controller and SRAM does not.

Three memories, cell by cell
MemoryCellRead behaviourWhere it is used
Mask ROM and its programmable cousinsA transistor present or absent at a crossingNon-destructive, non-volatileBoot code, lookup tables, hard-wired logic
SRAMSix transistors, two cross-coupled invertersNon-destructive, no refresh, fastestRegisters, caches, on-chip buffers
DRAMOne transistor, one capacitorDestructive, needs sense amplifier and refreshMain memory, wherever density decides

The other examinable habit is address arithmetic, which is pure counting. A 1K × 8 chip has 2^10 words, so it needs 10 address lines and 8 data lines. Build a 4K × 8 memory from four of them and the address bus is 12 bits wide: A9 down to A0 go to every chip in parallel, and A11 and A10 drive a 2-to-4 decoder whose four outputs are the chip selects, so exactly one device answers any address. The general rule is worth stating once: the low-order address bits select within a chip and the high-order bits select between chips, and a question that asks which lines go where is answered by counting log₂ of the chip depth. Word-width expansion is the other direction — two 1K × 4 chips side by side make 1K × 8, with the same address on both and the data buses concatenated rather than decoded.

Computer Organisation, in the Four Items EC Asks For

Machine instructions and addressing modes come first, and the fastest way in is field arithmetic. A 32-bit instruction with a 6-bit opcode and three 5-bit register fields has 32 − 6 − 15 = 11 bits left for an immediate, which as a two's complement value spans −1024 to +1023; change the opcode to 7 bits and the immediate range halves. An addressing mode is just a rule for turning instruction fields into an effective address. With R1 = 0x2000 as a base, R2 = 0x40 as an index and a displacement of 0x8, base-plus-index-plus-displacement gives EA = 0x2000 + 0x40 + 0x8 = 0x2048. Counting memory accesses is the other standard question, and the ordering is what matters: immediate and register modes touch memory not at all beyond the fetch, direct and register-indirect take one access, and memory-indirect takes two because the address itself must be fetched first.

Addressing modes, with R1 = 0x2000, R2 = 0x40 and a displacement of 0x8
ModeEffective address or operandWhat it is for
ImmediateThe operand is in the instruction itselfConstants, with no memory access at all
RegisterThe operand is the content of R1The fastest form, used by every ALU operation
Register indirectEA = 0x2000, the content of R1Pointer walking through a structure
Base with displacementEA = 0x2000 + 0x8 = 0x2008A field at a fixed offset inside a record
Base plus index plus displacementEA = 0x2000 + 0x40 + 0x8 = 0x2048Array element inside a based structure
Memory indirectFetch the word at 0x2008, then use it as the addressJump tables — and two memory accesses, not one
PC relativeEA = PC + displacementBranches, and position-independent code

The ALU is the arithmetic core of the last chapter wrapped in a function select: one adder-subtractor built as described earlier, a logic unit, a shifter, and a multiplexer choosing which result reaches the output, with the status flags — zero, carry, sign and overflow — generated as a side effect. The data path is the registers, the ALU, the buses and the memory interface; the control unit is what asserts the enable, select and write lines in the right sequence. Control comes in two flavours, and the trade is the same one that runs through this whole section. Hardwired control is a finite state machine of exactly the kind designed earlier in this chapter: fast, and fixed at fabrication. Microprogrammed control keeps a small memory whose words are the control signals themselves, so the instruction set can be changed by rewriting a table: flexible, and slower by the access time of that memory.

Instruction pipelining is the last item, and it is arithmetic on the same critical-path idea that governed the flip-flop stage. Split execution into stages with latches between them; the clock period is then the slowest stage plus the latch overhead, never the average. Take a four-stage pipeline whose stages need 1.8, 2.4, 2.0 and 1.6 ns with 0.2 ns of latch delay. The unpipelined machine takes 1.8 + 2.4 + 2.0 + 1.6 = 7.8 ns per instruction; the pipelined one clocks at 2.4 + 0.2 = 2.6 ns, so the ideal speedup is 7.8/2.6 = 3.0 — against four stages, because the imbalance wastes the difference. For a finite run of 100 instructions the pipeline needs (k + n − 1) cycles, that is (4 + 99) × 2.6 = 267.8 ns against 100 × 7.8 = 780 ns, a speedup of 2.91. Both numbers are below k, for two separate reasons, and a question usually applies exactly one of them.

ℹ️ Balance the stages before adding more of them
In the example above, splitting the 2.4 ns stage into two of 1.2 ns would drop the clock period to 1.6 + 0.2 = 1.8 ns and raise the speedup, while adding a fifth stage somewhere else would change nothing at all, because the slowest stage still sets the period. That is the practical reading of pipelining and it is worth stating as a rule: depth helps only after balance. The same arithmetic sets the limit on how deep it is worth going, since the latch overhead is paid once per cycle and becomes a larger fraction of a shorter cycle — at 0.2 ns of overhead, a design clocked at 1.0 ns is spending a fifth of every cycle on the latches alone. And this is the point at which an EC candidate should stop: hazards, forwarding and branch prediction are the Computer Science paper's material, not the four items named here.

Key takeaways

  • A latch is level sensitive and a flip-flop edge triggered; know the characteristic equations Q+ = D, Q+ = T ⊕ Q and Q+ = JQ′ + K′Q rather than the tables.
  • Setup fixes the clock: T_c ≥ t_pcq + t_pd + t_su + t_skew gave 4.7 ns and 212.8 MHz. Hold has no T_c in it, so a hold violation survives any frequency.
  • Ripple-counter delay accumulates as n × t_pd — 28 ns for four 7 ns stages — while a synchronous counter's period is one stage, t_pcq + t_comb + t_su, with no bit count in it.
  • Name FSM states by the longest pattern prefix that is still a suffix of the input, and overlap detection falls out — the 101 detector needs four Moore states or three Mealy ones.
  • For a 12-bit, 5 V converter one LSB is 1.2207 mV and the ideal SQNR is 74.0 dB; a 100 pF hold capacitor leaking 10 nA droops 0.1 mV/µs and may hold for only 6.1 µs.
  • SRAM costs six transistors a bit and reads non-destructively; DRAM costs one transistor and a capacitor, reads destructively, and must refresh 4096 rows every 64 ms, one row per 15.625 µs.
  • A pipeline's clock is the slowest stage plus latch overhead: stages of 1.8, 2.4, 2.0 and 1.6 ns clock at 2.6 ns, giving an ideal speedup of 3.0 and 2.91 over 100 instructions.

Practice questions (8)

Attempt each one before opening the answer. Every explanation names the tempting wrong option as well as the right one, because that is where marks are lost.

  1. A shift register built from six flip-flops is wired as a twisted-ring (Johnson) counter, the complement of the last stage output being returned to the first stage input. How many distinct states does its repeating cycle contain?

    1. 12
    2. 6
    3. 64
    4. 63
    Show answer

    Answer: A — 12

    A Johnson counter returns the complement of the last stage to the first, so the register fills with ones and then empties again, visiting 2n distinct patterns for n stages: 2 x 6 = 12. The tempting 6 is the count for a plain ring counter, which feeds back the true output and therefore just circulates one hot bit through n positions. The value 64 is the full binary count 2^6 that a synchronous binary counter of six flip-flops would reach, and 63 is the cycle length of a six-bit maximal linear feedback shift register, which omits only the all-zero word.
  2. Five identical flip-flops, each with a propagation delay of 6 ns, are connected first as an asynchronous ripple counter and then re-connected as a synchronous counter in which 3 ns of enable-chain logic sits between stages and every flip-flop requires 2 ns of setup time. By what factor does the highest usable clock frequency improve on re-connection?

    1. 3.33
    2. 5.00
    3. 2.73
    4. 1.83
    Show answer

    Answer: C — 2.73

    In a ripple counter each flip-flop clocks the next, so the delays accumulate and the outputs are unsettled for 5 x 6 = 30 ns, capping the clock at 1/30 ns. A synchronous counter clocks every stage together, so its period is one stage of the loop, t_pcq + t_comb + t_su = 6 + 3 + 2 = 11 ns. The frequency ratio is therefore 30/11 = 2.73, and note that the bit count has vanished from the synchronous expression. The value 3.33 comes from writing the synchronous period as 6 + 3 = 9 ns and dropping the setup time, which is the commonest slip here; 5.00 comes from comparing 30 ns against a single flip-flop delay and ignoring the enable logic and setup time entirely.
  3. A flash analogue-to-digital converter resolves 7 bits by comparing its input against every threshold at once. How many comparators does its resistor-ladder network require?

    1. 128
    2. 127
    3. 126
    4. 7
    Show answer

    Answer: B — 127

    A flash converter of n bits divides the reference into 2^n equal steps, and the boundaries between those steps are the thresholds it must test, so it needs 2^n - 1 comparators: 2^7 - 1 = 127. The tempting 128 is 2^n itself, obtained by counting the output codes rather than the boundaries between them; there is no comparator needed above the top code or below the bottom one. The value 7 counts the bits, which is what a successive-approximation converter needs in clock cycles rather than in comparators, and 126 arises from subtracting two.
  4. Five arbitrary Boolean functions of the same six variables are to be implemented by a single ROM used as a lookup table, the six variables driving the address lines directly. What is the smallest ROM capacity, in bits, that will do it?

    1. 30
    2. 64
    3. 192
    4. 320
    Show answer

    Answer: D — 320

    Six address variables select one of 2^6 = 64 words, and each word must hold one output bit for each of the five functions, so the ROM is 64 words by 5 bits, that is 320 bits. No minimisation is possible or needed, because a ROM stores the truth table itself. The tempting 192 is 2^5 x 6, produced by swapping the roles of the two numbers and letting the function count set the address width; 64 counts the words but forgets that each word is five bits wide, and 30 is simply the product of the six variables and the five functions, which confuses a count of symbols with a count of stored bits.
  5. A processor has already fetched an instruction that reads two operands from memory, the first by register-indirect addressing and the second by memory-indirect addressing. Counting only the accesses made after the instruction word itself has been fetched, how many memory accesses are needed to bring both operands into the processor?

    1. 3
    2. 2
    3. 4
    4. 1
    Show answer

    Answer: A — 3

    Register-indirect addressing already holds the effective address in a register, so exactly one access fetches the operand. Memory-indirect addressing holds only a pointer to the address, so the address itself must be read first and the operand read second, which is two accesses. The total is 1 + 2 = 3. The tempting 2 treats memory-indirect as if it were register-indirect and charges one access for each operand, which is precisely the distinction the two modes exist to mark; 4 charges two accesses for both operands, and 1 counts only the final operand read.
  6. A machine's execution is split into four pipeline stages whose combinational delays are 3.0, 5.0, 4.0 and 2.0 ns, and every inter-stage latch adds 0.25 ns. The 5.0 ns stage is then divided into two stages of 2.5 ns each, with a further latch of the same 0.25 ns between them. What is the ideal speedup of the rebalanced pipeline over an unpipelined machine that performs the same work in one long stage?

    1. 2.67
    2. 3.29
    3. 3.50
    4. 5.00
    Show answer

    Answer: B — 3.29

    The unpipelined machine takes 3.0 + 5.0 + 4.0 + 2.0 = 14.0 ns for one instruction. After the split the stage delays are 3.0, 2.5, 2.5, 4.0 and 2.0 ns, so the slowest is now 4.0 ns and the clock period is the slowest stage plus one latch, 4.0 + 0.25 = 4.25 ns. The ideal speedup is 14.0/4.25 = 3.29. The tempting 2.67 is 14.0/5.25, the speedup of the original pipeline before the split, and it is wrong because the limiting stage has changed from the 5.0 ns stage to the 4.0 ns one. The value 3.50 is 14.0/4.0, obtained by forgetting that the latch is paid once every cycle, and 5.00 is just the new stage count, which the imbalance prevents the design from reaching.
  7. An asynchronous input arriving from an unrelated clock domain is captured by passing it through two flip-flops in series, both clocked by the destination clock. What does this arrangement actually achieve?

    1. It shortens the setup-time requirement of the capturing flip-flop, so the asynchronous input is allowed to change later.
    2. It guarantees that no metastable level can ever reach the logic downstream.
    3. It gives any metastable level a further full clock period in which to resolve, cutting the failure rate without ever driving it to zero.
    4. It removes the need for the asynchronous input to be stable at any time at all.
    Show answer

    Answer: C — It gives any metastable level a further full clock period in which to resolve, cutting the failure rate without ever driving it to zero.

    A flip-flop's two stable states are separated by an unstable balance point, and a data edge arriving inside the sampling window can leave the internal node near it. Resolution from there is exponential, so the probability of still being undecided after a time t falls as exp(-t/tau) but never reaches zero. The second flip-flop samples the first a whole clock period later, by which time that residual probability is negligible, so the synchroniser reduces a failure rate and is quoted as a mean time between failures. The tempting claim that no metastable level can ever reach the downstream logic is exactly the statement the exponential forbids: a synchroniser makes failure improbable, never impossible, and no circuit can be metastability-free.
  8. A synchronous design contains register-to-register paths with combinational logic between the flip-flops, and its control is written as a finite state machine. Which of the following statements about such a design are correct?

    1. A hold-time violation on one of those paths cannot be cured by lowering the clock frequency, because the clock period does not appear in the hold inequality.
    2. If the control is written as a Mealy machine its output can change part-way through a clock period, whereas a Moore output changes only just after a clock edge.
    3. Clock skew between the launching and the capturing flip-flop relaxes the setup constraint while tightening the hold constraint.
    4. A Moore machine recognising a given input pattern never needs more states than the equivalent Mealy machine.
    Show answer

    Answer: A — A hold-time violation on one of those paths cannot be cured by lowering the clock frequency, because the clock period does not appear in the hold inequality.; B — If the control is written as a Mealy machine its output can change part-way through a clock period, whereas a Moore output changes only just after a clock edge.

    The setup constraint reads T_c >= t_pcq + t_pd + t_su + t_skew and the hold constraint reads t_ccq + t_cd >= t_h + t_skew. The clock period appears only in the first, so a hold failure is a race against the same edge and survives any frequency, including zero; the cures are structural, such as added delay on the short path or a rebalanced clock tree. A Mealy output is a function of the state and the current input, so it follows an input change through combinational logic and can glitch within a period, while a Moore output depends on the registered state alone. Skew is not a trade between the two constraints: it appears with a plus sign on the right of the hold inequality and on the right of the setup inequality as well, so it eats into both budgets at once. And a Mealy machine usually needs fewer states than a Moore machine, not more, because the input itself does some of the discriminating.