← RTL Design Interviews · SoC Architecture Interviews

Interview Question · Define the Hardware–Software Contract

Specify What a Store Does

L2 Mid-LevelL3 Seniorhardware software contracts

The Question

The interviewer asks

A cache experiment reports seven hits under both write-through and write-back, yet counts eight memory writes versus one. What would you specify for stores?

Reveal the Model Answer

Specify what a hit updates and, separately, whether a store miss allocates a block. Write-through sends each update to memory. Write-back marks the cached block dirty and combines repeated updates until eviction. Allocation lets later stores hit, at the price of fetching the block.

Self-Check

Tick each key point you covered in your answer.

What Interviewers Want to Hear (Mid-Level)

Track which copy contains the latest value.

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 chose write-back.

S3.17 shows WRITE_BACK for words 68 through 6b at e11–e15. At e16 ALLOCATE requests word a8. Why save the old tag?

Reveal the Model Answer

Form the eviction address from the victim tag and index. Preserve the dirty data until its writes finish. Using the incoming tag would write the old words over block a8 and leave 68–6b stale. With write-back skipped, memory word 69 still holds c0de0069.

Self-Check

Tick each key point you covered in your answer.

Choose a Policy for the Write Stream

S3.17 shows zero hits with no allocation and seven with allocation. Would you always fetch a block on the first store?

Reveal the Model Answer

Repeated writes in this trace benefit from keeping the block. For a stream written once, fetching each block may waste bandwidth and displace useful reads. Compare fetches, writes and completion time, including the final dirty evictions.

Self-Check

Tick each key point you covered in your answer.

I completed the load on a refill.

For the read of 1a4, S3.5 returns word 68 at e4. The line fills at e7. Why does the recorded controller wait until e8?

Reveal the Model Answer

Word 68 starts the block. The requested word 69 arrives at e5. This controller fills the whole line, installs its tag and retries the saved read. At e8 the compare hits and ready qualifies c0de0069.

Self-Check

Tick each key point you covered in your answer.

Choose a Policy for the Write Stream

S3.17 shows zero hits with no allocation and seven with allocation. Would you always fetch a block on the first store?

Reveal the Model Answer

Repeated writes in this trace benefit from keeping the block. For a stream written once, fetching each block may waste bandwidth and displace useful reads. Compare fetches, writes and completion time, including the final dirty evictions.

Self-Check

Tick each key point you covered in your answer.

I buffered writes to hide latency.

S3.18 buffers 2222 for word 20 at tick 1. A miss reads 1111 at tick 5. Why can later hits stay wrong after memory catches up?

Reveal the Model Answer

The miss installed stale data in the cache. Wait for pending writes to drain, then refill from memory, as at tick 10. Alternatively compare addresses and supply the matching buffered word, as at tick 2.

Self-Check

Tick each key point you covered in your answer.

Choose a Policy for the Write Stream

S3.17 shows zero hits with no allocation and seven with allocation. Would you always fetch a block on the first store?

Reveal the Model Answer

Repeated writes in this trace benefit from keeping the block. For a stream written once, fetching each block may waste bandwidth and displace useful reads. Compare fetches, writes and completion time, including the final dirty evictions.

Self-Check

Tick each key point you covered in your answer.

I wanted to answer at e5.

What would answering at e5 require? Why does simply advancing ready fail for a read of 1ac?

Reveal the Model Answer

Match the returning word to the saved offset and deliver that valid word directly to the requester. Track the unfinished refill so later requests cannot hit missing words. For 1ac, raising ready one edge early returned xxxxxxxx because its word was still missing.

Self-Check

Tick each key point you covered in your answer.

Choose a Policy for the Write Stream

S3.17 shows zero hits with no allocation and seven with allocation. Would you always fetch a block on the first store?

Reveal the Model Answer

Repeated writes in this trace benefit from keeping the block. For a stream written once, fetching each block may waste bandwidth and displace useful reads. Compare fetches, writes and completion time, including the final dirty evictions.

Self-Check

Tick each key point you covered in your answer.

What People Get Wrong

Common wrong answers and why they fail.

Half-Truth

A store miss always fetches a block.

The no-allocate row sends a missed write straight to memory.

Half-Truth

A successful issue means memory has the new value.

A pending write can still sit in a buffer.

Learn It, Then Prove It