← RTL Design Interviews · SoC Architecture Interviews
Interview Question · Reason About Traffic and Performance
Spend 2116 Bits on the Next Fetch
The Question
The interviewer asks
Your predictor has 2116 bits. How would you tell whether it sends fetch to the right instruction soon enough?
You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
Compare the predicted next address with the resolved next address. Count redirects and price each at the measured flush penalty. Include the storage for targets when comparing designs.
Self-Check
Tick each key point you covered in your answer.
What Interviewers Want to Hear (Junior)
Follow the younger instructions after a wrong fetch.
What Interviewers Want to Hear (Senior)
Price both the wrong addresses and the bits needed to avoid them.
Choose Your Follow-up
I’ve answered the opening question
Choose the route closest to your reasoning. Answer the follow-up aloud, then open the closing question.
I counted lost cycles.
The execute-stage trace says “1c 18 14 10 0c” and “go 08”. Which instructions lose their results?
You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
The branch at hex 14 redirects fetch to 08. Discard the instructions at 18 and 1c before either changes a register or memory. Two such redirects cost 2 × 2 = 4 cycles.
Self-Check
Tick each key point you covered in your answer.
Defend the Last 128 Bits
The calculated cycle sum for calls is 603 with the tournament and target buffer. What would you spend the remaining 128 bits on?
You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
Four 32-bit return addresses fit. Correct returns rise from 19 to 58, saving 39 × 2 = 78 cycles in the model. Total storage is 100 direction bits + 1888 bits for targets + 128 stack bits = 2116 bits. Check the workload mix and fetch timing before promising that gain.
Self-Check
Tick each key point you covered in your answer.
I counted correct directions.
With four entries, branches at hex 0c and 1c both index entry 3. What happens when they replace each other?
You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
The stored tag identifies only the latest branch. A tag mismatch leaves fetch without that target even when direction is correct. Four entries give 38 correct next fetches despite 111 correct directions. Eight entries separate those branches and give 111 correct next fetches.
Self-Check
Tick each key point you covered in your answer.
Defend the Last 128 Bits
The calculated cycle sum for calls is 603 with the tournament and target buffer. What would you spend the remaining 128 bits on?
You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
Four 32-bit return addresses fit. Correct returns rise from 19 to 58, saving 39 × 2 = 78 cycles in the model. Total storage is 100 direction bits + 1888 bits for targets + 128 stack bits = 2116 bits. Check the workload mix and fetch timing before promising that gain.
Self-Check
Tick each key point you covered in your answer.
I added branch history.
On the alternating branch, row 2 says taken from the plain table and not taken from gshare. The outcome is not taken. What changes?
You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
The chooser moves from 1 to 2 and selects gshare next time. Gshare uses recent outcomes to distinguish successive visits. Across the pattern trace, the tournament gets 147 directions right against 77 for the plain table. Gshare alone gets 139. The chooser buys 147 − 139 = 8 additional correct directions for 32 bits.
Self-Check
Tick each key point you covered in your answer.
Defend the Last 128 Bits
The calculated cycle sum for calls is 603 with the tournament and target buffer. What would you spend the remaining 128 bits on?
You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
Four 32-bit return addresses fit. Correct returns rise from 19 to 58, saving 39 × 2 = 78 cycles in the model. Total storage is 100 direction bits + 1888 bits for targets + 128 stack bits = 2116 bits. Check the workload mix and fetch timing before promising that gain.
Self-Check
Tick each key point you covered in your answer.
I sized the return stack.
On the nested-call trace, depths zero and two each predict 22 of 36 returns. Why does depth four reach 33?
You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
Three nested calls need three live return addresses. Overflow loses an older address. Four entries cover this trace. The first encounters still miss because the target buffer has yet to identify those returns.
Self-Check
Tick each key point you covered in your answer.
Defend the Last 128 Bits
The calculated cycle sum for calls is 603 with the tournament and target buffer. What would you spend the remaining 128 bits on?
You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
Four 32-bit return addresses fit. Correct returns rise from 19 to 58, saving 39 × 2 = 78 cycles in the model. Total storage is 100 direction bits + 1888 bits for targets + 128 stack bits = 2116 bits. Check the workload mix and fetch timing before promising that gain.
Self-Check
Tick each key point you covered in your answer.
What People Get Wrong
Common wrong answers and why they fail.
Half-Truth
Every correct taken prediction saves two cycles.
Fetch also needs the correct target in time.
Wrong Altitude
Give all the bits to direction counters.
A return can go to different addresses after different calls.
Learn It, Then Prove It
- Lesson S2.10Control Hazards: Flush and the Cost of a Branch
- Lesson S2.11Branch Prediction: Static, One-Bit and Two-Bit
- Lesson S2.12Better Predictors: Global History, Gshare and Local History
- Lesson S2.26Deciding Earlier, Jumps and Returns
- Lesson S2.27The Branch Target Buffer: Index, Tag and Aliasing
- Lesson S2.28Tournament Predictors, the Return Stack and the Bit Budget
- Problem S2.10.1Flush the Wrong Path
- Problem S2.27.1Who Shares an Entry
- Problem S2.28.1Push and Pop