← RTL Design Interviews · SoC Architecture Interviews

Interview Question · Reason About Traffic and Performance

Spend 2116 Bits on the Next Fetch

L1 JuniorL3 Seniortraffic and performance

The Question

The interviewer asks

Your predictor has 2116 bits. How would you tell whether it sends fetch to the right instruction soon enough?

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.

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?

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?

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?

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?

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?

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?

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?

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?

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