← RTL Design Interviews · SoC Architecture Interviews

Interview Question · Define the Hardware–Software Contract

What Does the Device Owe Its Handler?

L1 JuniorL2 Mid-Levelhardware software contracts

The Question

The interviewer asks

One pin says a queue still needs service. Another pulses once per arriving part. Software sometimes disables interrupts. Specify what it can read afterward.

Reveal the Model Answer

Report the first pin as a level while work remains. Latch each sampled rise of the second in raw status. Apply enable to delivery. Specify the clear operation and what happens if a new rise coincides with it.

Self-Check

Tick each key point you covered in your answer.

What Interviewers Want to Hear (Junior)

Predict raw status and delivery independently.

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 closed the enable during setup.

S6.2 shows “pins=01 raw=11 en=00 masked=00”. Why can an interrupt arrive on unmask even if neither pin rises again?

Reveal the Model Answer

Bit 0 follows the live high level. Bit 1 remembers a previous rise even though its pin is low. The unmask row gives masked=11 and irq=1. Draining the queue removes the level. Clearing the saved edge acknowledges the other cause.

Self-Check

Tick each key point you covered in your answer.

Invoice by Parts

The customer invoices by number of parts. Can software infer the total from the edge flag if two parts arrive before service?

Reveal the Model Answer

Use a counter with a specified overflow policy, or queue individual records. A sticky bit represents at least one arrival and merges later arrivals. More storage and an overflow test buy a defensible count. Keep the level for a queue that still needs draining.

Self-Check

Tick each key point you covered in your answer.

I acknowledged the edge.

The setup row has raw=10. The next access has rise=1 and clear=1. Why does only the faulty copy lose its interrupt?

Reveal the Model Answer

In the faulty copy the clear wins the tie. On the accepted access, apply the clear and give the new rise priority. The good copy keeps raw=10 and irq=1. The faulty copy reads “faulty_raw=00 faulty_irq=0”. A later clear with no arrival retires the event.

Self-Check

Tick each key point you covered in your answer.

Invoice by Parts

The customer invoices by number of parts. Can software infer the total from the edge flag if two parts arrive before service?

Reveal the Model Answer

Use a counter with a specified overflow policy, or queue individual records. A sticky bit represents at least one arrival and merges later arrivals. More storage and an overflow test buy a defensible count. Keep the level for a queue that still needs draining.

Self-Check

Tick each key point you covered in your answer.

I compared the final values.

Would checking raw status at the end of this test catch the faulty clear?

Reveal the Model Answer

No. Both copies read raw=00 after service. Compare raw status and IRQ on the access where clear and rise coincide.

Self-Check

Tick each key point you covered in your answer.

Invoice by Parts

The customer invoices by number of parts. Can software infer the total from the edge flag if two parts arrive before service?

Reveal the Model Answer

Use a counter with a specified overflow policy, or queue individual records. A sticky bit represents at least one arrival and merges later arrivals. More storage and an overflow test buy a defensible count. Keep the level for a queue that still needs draining.

Self-Check

Tick each key point you covered in your answer.

I wired the detector to the pad.

The pin is asynchronous to the peripheral clock. What comes before edge detection?

Reveal the Model Answer

Sample the level through two flip-flops, then detect a rise in the receiving clock domain. A pulse must last long enough to be sampled.

Self-Check

Tick each key point you covered in your answer.

Invoice by Parts

The customer invoices by number of parts. Can software infer the total from the edge flag if two parts arrive before service?

Reveal the Model Answer

Use a counter with a specified overflow policy, or queue individual records. A sticky bit represents at least one arrival and merges later arrivals. More storage and an overflow test buy a defensible count. Keep the level for a queue that still needs draining.

Self-Check

Tick each key point you covered in your answer.

What People Get Wrong

Common wrong answers and why they fail.

Misconception

Disabling delivery discards captured edges.

Raw status still records the edge while enable is zero.

Source S6.2, first-rise row.

Half-Truth

I would copy the status word back.

A write-one clear can acknowledge unrelated saved causes. Write only the bits serviced.

Source S6.2, Trap last paragraph, masked 11 written back.

Learn It, Then Prove It