← RTL Design Interviews · SoC Architecture Interviews

Interview Question · Define the Hardware–Software Contract

Scale an Interrupt Controller to 32 Sources

L1 JuniorL3 Seniorhardware software contracts

The Question

The interviewer asks

Extend a single-hart interrupt controller to 32 device sources for one processor. How would an event reach the interrupt wire and eventually become a handler’s responsibility?

Reveal the Model Answer

Give each source a gateway with one request in flight. Choose among enabled pending sources by priority and then source ID. Compare the winner’s priority with the threshold for notification. A claim read returns its ID and clears that pending bit. Reserve ID zero for an empty claim.

Self-Check

Tick each key point you covered in your answer.

What Interviewers Want to Hear (Junior)

Predict the claimed ID from the eligible set.

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 ranked the requests.

S6.3 starts with pending=1111. UART0 and GPIO have priority five, timer two and SPI seven. The claim sequence is 1,2,3,0. Explain the missing 4.

Reveal the Model Answer

SPI is disabled, so priority seven never competes. UART0 wins the tie by lower ID, then GPIO and timer follow. With only disabled SPI pending, the next claim returns zero. Enabling SPI before the first claim makes ID 4 win.

Self-Check

Tick each key point you covered in your answer.

Defend the 32-Source Service Order

A low-priority sensor has a service deadline. Does the deterministic tie rule guarantee it, and what needs to change when the design grows to 32 sources?

Reveal the Model Answer

IDs zero through 32 need six bits. The 16-source ap_plic uses five. Preserve the specified winner as arbitration grows. Repeated higher-priority service can delay the sensor indefinitely. Bound competing arrivals and handler times, then compare the worst service delay with its deadline.

Self-Check

Tick each key point you covered in your answer.

I used the threshold in arbitration.

In S6.3 the threshold drops from five to four and irq rises. Before that write, what would a claim have returned?

Reveal the Model Answer

Priority five equals the old threshold, so notification was suppressed. This controller still lets a software claim take the best enabled pending source, UART0. Lowering the threshold changes notification without adding an event. A diagnostic claim would consume the evidence.

Self-Check

Tick each key point you covered in your answer.

Defend the 32-Source Service Order

A low-priority sensor has a service deadline. Does the deterministic tie rule guarantee it, and what needs to change when the design grows to 32 sources?

Reveal the Model Answer

IDs zero through 32 need six bits. The 16-source ap_plic uses five. Preserve the specified winner as arbitration grows. Repeated higher-priority service can delay the sensor indefinitely. Bound competing arrivals and handler times, then compare the worst service delay with its deadline.

Self-Check

Tick each key point you covered in your answer.

I completed as soon as I had an ID.

At tick 10 S6.3 completes UART0 with busy=1110. At tick 11 pending=1001 and irq=1. Did a second byte necessarily arrive?

Reveal the Model Answer

At tick 10 level=1111 shows UART0 still requesting when completion reopens its gateway. Tick 11 can therefore report the old cause again. Service and clear the device cause before completing with the claimed ID.

Self-Check

Tick each key point you covered in your answer.

Defend the 32-Source Service Order

A low-priority sensor has a service deadline. Does the deterministic tie rule guarantee it, and what needs to change when the design grows to 32 sources?

Reveal the Model Answer

IDs zero through 32 need six bits. The 16-source ap_plic uses five. Preserve the specified winner as arbitration grows. Repeated higher-priority service can delay the sensor indefinitely. Bound competing arrivals and handler times, then compare the worst service delay with its deadline.

Self-Check

Tick each key point you covered in your answer.

I widened the winner ID.

Thirty-two sources can compete together. What else changes besides the ID width?

Reveal the Model Answer

Measure the longest path from pending, enable and priority to the selected ID. Compare groups in parallel, then compare group winners using the same priority and lower-ID tie rule. If another register stage is needed, account for its extra cycle and recheck claim behavior.

Self-Check

Tick each key point you covered in your answer.

Defend the 32-Source Service Order

A low-priority sensor has a service deadline. Does the deterministic tie rule guarantee it, and what needs to change when the design grows to 32 sources?

Reveal the Model Answer

IDs zero through 32 need six bits. The 16-source ap_plic uses five. Preserve the specified winner as arbitration grows. Repeated higher-priority service can delay the sensor indefinitely. Bound competing arrivals and handler times, then compare the worst service delay with its deadline.

Self-Check

Tick each key point you covered in your answer.

I considered a pulse during service.

The handler cleared the device flag but has yet to complete. Where can a second edge wait?

Reveal the Model Answer

The device sticky flag sets again and holds the request. The gateway can admit it after completion. Several edges while the flag stays set merge into one indication. Use a counter or queue if every arrival must be counted.

Self-Check

Tick each key point you covered in your answer.

Defend the 32-Source Service Order

A low-priority sensor has a service deadline. Does the deterministic tie rule guarantee it, and what needs to change when the design grows to 32 sources?

Reveal the Model Answer

IDs zero through 32 need six bits. The 16-source ap_plic uses five. Preserve the specified winner as arbitration grows. Repeated higher-priority service can delay the sensor indefinitely. Bound competing arrivals and handler times, then compare the worst service delay with its deadline.

Self-Check

Tick each key point you covered in your answer.

What People Get Wrong

Common wrong answers and why they fail.

Misconception

Claiming a source clears the device.

A claim consumes the controller’s pending indication. The peripheral may still request service.

Source S6.1, claim, device service and completion.

Misconception

Give the highest numbered source the tie.

The lab breaks equal priorities in favor of the smaller ID.

Source S6.3, equal-priority claim order.

Learn It, Then Prove It