Skip to content
BIASED

The datapath and pipelining

Block 1 of 4~2 min

The single-cycle datapath

Open the processor. A datapath moves values through the PC, instruction memory, register file, ALU and data memory; control sets muxes from the opcode and funct fields. Beside ALUOp the classic design needs RegWrite, MemRead, MemWrite, MemtoReg, ALUSrc, RegDst, Branch and Jump.

Single-cycle: every instruction finishes in one long clock. With IM 250 + regs 150 + ALU 200 + DM 250 + write 100 ps, lw sets Tc=950T_c=950 ps (f≈1.05f\approx1.05 GHz) and CPI =1=1. An add was ready at 700 ps — the common case pays for the slowest path, and most units idle most of the cycle. Raising frequency means shortening that path or overlapping different instructions’ work in time.

Worked example. A loop of 10 iterations, run 100 times; its closing branch goes taken 9 times and then not taken once. Always-not-taken is right 10 % of the time and backward-taken 90 %. The one-bit predictor is right 80 %: it mispredicts the exit, stores “not taken”, and mispredicts again on the first iteration of the next run. The two-bit counter is right 90 %: the exit moves it from 11 to 10, which still predicts taken. The static rule ties here, but put the same pattern on a forward branch (an if that is usually true) and backward-taken drops to 10 % while the counter still gets 90 %: the counter learns the bias of each branch, whatever its direction. Modern predictors combine the histories of many branches and reach far higher accuracy on real programs; the next section returns to them, because deeper pipelines make each misprediction cost many more cycles than 2.

Answers are saved on the server and tied to this browser until you sign in.

Go deeper — optional

Code and labs do not count toward the main percentage or the certificate.

  • Hazards: forwarding vs stalloptional

    On a 5-stage pipeline for 3 instruction pairs choose forward, stall, or none; count bubbles.

    ~20 min · easier on a computer · The matching course topic has been read.

    Self-check in the notebook — not part of mastery or the certificate.