Skip to content
Tactiverge

Learning Rooms/□ Level 4 · Systems Engineer/Computing and algorithms

Advanced CPU Designs: Crash Course Computer Science #9

CrashCourse · Length: see YouTube · captions on YouTube · nothing loads until you press play

By the end you can…

  • Identify data (read-after-write), control and structural hazards in a short program.
  • Count stall cycles with and without forwarding, including the load-use case.
  • Explain branch prediction and compute the CPI cost of mispredictions.
?Predict▶Watch✓Practise⚙Build

Watch it all: no segment has been checked by hand for this video yet.

1.Predict before you press play

add r1, r2, r3 is followed immediately by sub r4, r1, r5. With no forwarding (results read from the register file), how many stall cycles?

Pick one before you press play. A wrong guess is fine: it is what makes the video stick.

2.See the idea first

Play with this diagram for a minute. It gives you something to hang the video on.

Loading the interactive…

Can't use the diagram? Read a description instead

The Iron Law calculator shows CPI as base + branch stalls + memory stalls. With 20% branches, 10% mispredicted at 2 cycles, and 30% memory instructions missing 5% at 40 cycles, CPI = 1 + 0.04 + 0.6 = 1.64, and T = IC × CPI ÷ f.

3.Watch, actively

Covers caches, pipelining, branch prediction and multiple cores: the tricks that make processors fast, in one sitting.

Length: see YouTube · captions on YouTube · source

Nothing loads from YouTube until you press play.

Watch for…

  • → Watch the section on pipelining and branch prediction: note what happens to instructions fetched down the wrong path.

Pause whenever you like. Rewatching a hard minute is a good habit, not a failure.

Can't stream it? Read the idea instead

Processors overlap work to go faster: pipelining starts the next instruction before the last finishes, caches keep recently used data close, and branch prediction guesses which way a decision will go. A wrong guess means throwing away the instructions fetched down the wrong path.

What the video covers (our own note, written when we verified it): Covers caches, pipelining, branch prediction and multiple cores: the tricks that make processors fast, in one sitting.

Written by Tactiverge in our own words, not a transcript. The full lesson below explains the idea without the video.

Jot down one thing that surprised you and one question you still have.

Private: saved only on this device, never sent to Tactiverge.

4.Practise what you just saw

These come from the lesson that use this video and are checked on the server. Wrong answers get a hint and another try.

Practice 1 · a fresh version every time

A pipeline has base CPI 1. Branches are 15% of instructions, 20% of them are mispredicted, costing 2 cycles each. Loads and stores are 20% of instructions, 10% of them miss in the cache, costing 100 cycles each. What is the effective CPI?

Practice 2

Design B doubles the pipeline depth of A, raising the clock 1.6× and the branch penalty from 2 to 5 cycles. Branch fraction 20%, mispredict 10%, base CPI 1 for both, memory ignored. Which is faster?

Practice 3 · a fresh version every time

A pipeline has base CPI 1. Branches are 20% of instructions, 10% of them are mispredicted, costing 15 cycles each. Loads and stores are 35% of instructions, 4% of them miss in the cache, costing 50 cycles each. What is the effective CPI?

Practice 4

On the classic 5-stage pipeline with no forwarding, a chain of 4 ALU instructions each uses the previous one's result. How many total cycles? (Ideal is 8.)

cycles

6.Build something with it

Follow-up project

Take the 'Loop with a taken branch' program in the pipeline diagram. Reorder instructions (on paper) to remove the load-use stall without changing the result, then count the cycles you save over 1,000 iterations with predict-not-taken versus a perfect predictor.

Where this video lives

In the course catalogue: ARCH-510 Microarchitecture, memory and chips

The video is by CrashCourse, embedded from YouTube with privacy-enhanced mode and never autoplayed. The room around it (prompts, notes, practice, projects) is Tactiverge's, written with AI assistance and checked by automated tests only.