← RTL Design Interviews · SoC Architecture Interviews

Interview Question · Define the Hardware–Software Contract

Give a Task Its Share of SRAM

L1 JuniorL2 Mid-Levelhardware software contracts

The Question

The interviewer asks

A proposed controller runs a task at fixed physical addresses. It may execute code, update its stack and touch one four-byte device register. Does it need translation?

Reveal the Model Answer

In the physical memory protection (PMP) model, describe each region and its permitted operations. The address stays the same. Translation serves a different requirement when software needs virtual names mapped to physical frames. The machine-mode-only ap_soc has neither PMP nor address translation.

Self-Check

Tick each key point you covered in your answer.

What Interviewers Want to Hear (Junior)

Apply both the address range and the operation to a request.

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 assigned a stack region.

The S3.10 store at 80008ffc succeeds. The next aligned word at 80009000 faults. Why would widening the region change the contract?

Reveal the Model Answer

The four-byte store covers ffc through fff within entry 2’s 4 KiB data region, 80008000–80008fff. The next word starts outside it. In the widened run, “entry 2 NAPOT 80008000 to 80009fff RW-” allows the store at 80009000. The separate four-byte entry likewise covers only 10000000 through 10000003.

Self-Check

Tick each key point you covered in your answer.

Choose the Address Contract

The fixed-address task now needs to run two copies that both expect the same private address. Would you retain the original scheme?

Reveal the Model Answer

Retain physical protection if software can relocate the copies and accept different addresses. If both require the same private name, choose translation with separate mappings. Budget page tables and the time for a walk when the translation is missing.

Self-Check

Tick each key point you covered in your answer.

I added a smaller guard.

In S3.25 the user stores at 80008800 and 80008020 both match the broad writable region. Why does only one pass?

Reveal the Model Answer

Entry 0 denies the first 64 bytes, including offset hex 20. It wins because it has the lower entry number. Offset hex 800 lies outside that guard and reaches writable entry 1.

Self-Check

Tick each key point you covered in your answer.

Choose the Address Contract

The fixed-address task now needs to run two copies that both expect the same private address. Would you retain the original scheme?

Reveal the Model Answer

Retain physical protection if software can relocate the copies and accept different addresses. If both require the same private name, choose translation with separate mappings. Budget page tables and the time for a walk when the translation is missing.

Self-Check

Tick each key point you covered in your answer.

I relied on machine privilege.

S3.25 allows a machine store to 80008020. It faults twice at 80000100, even after a write to entry 2. Why?

Reveal the Model Answer

The guard is unlocked, so machine mode passes it. Entry 2 is locked, so its read and execute permissions also bind machine mode. A store is denied until reset allows reconfiguration. The attempted change leaves it intact. Lock only after checking the final region and permissions.

Self-Check

Tick each key point you covered in your answer.

Choose the Address Contract

The fixed-address task now needs to run two copies that both expect the same private address. Would you retain the original scheme?

Reveal the Model Answer

Retain physical protection if software can relocate the copies and accept different addresses. If both require the same private name, choose translation with separate mappings. Budget page tables and the time for a walk when the translation is missing.

Self-Check

Tick each key point you covered in your answer.

I protected the CPU path.

Entry 0 stops the user store at 80008020 in S3.25. Can the DMA write into that guard?

Reveal the Model Answer

PMP checks accesses from one processor. The DMA issues its own writes. Check them before they reach memory if the guard must hold against both writers.

Self-Check

Tick each key point you covered in your answer.

Choose the Address Contract

The fixed-address task now needs to run two copies that both expect the same private address. Would you retain the original scheme?

Reveal the Model Answer

Retain physical protection if software can relocate the copies and accept different addresses. If both require the same private name, choose translation with separate mappings. Budget page tables and the time for a walk when the translation is missing.

Self-Check

Tick each key point you covered in your answer.

What People Get Wrong

Common wrong answers and why they fail.

Misconception

A permitted load also permits fetch.

Execute permission is separate.

Source S3.10, user fetch at 80008010 hits RW- and traps.

Misconception

A locked entry can be relaxed by machine software.

The lock holds until reset in this model.

Source S3.25, entry 2 write and repeated machine store.

Learn It, Then Prove It