← RTL Design Interviews · SoC Architecture Interviews

Interview Question · Define the Hardware–Software Contract

Share One GPIO Port

L0 FresherL2 Mid-Levelhardware software contracts

The Question

The interviewer asks

Two tasks drive separate lamps. A handler also watches input pins. What should a driver be able to change with a single register write?

Reveal the Model Answer

Give each writer a mask for the pins it drives. Keep input observation, raw interrupt status and interrupt enable separate. Set up OUT before enabling its driver with DIR.

Self-Check

Tick each key point you covered in your answer.

What Interviewers Want to Hear (Fresher)

Distinguish the saved output value from the sampled pin.

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 updated OUT.

S7.2 shows “both lamps ... out=0009”, then “stale store ... out=0000”. How could the foreground code turn off the other lamp?

Reveal the Model Answer

Its whole-word write used an older snapshot. To turn off pin 0, write 0001 to CLR. The clear command prints “oe=0009 out=0008”. Pin 3 stays on. Assign ownership if both writers need the same pin.

Self-Check

Tick each key point you covered in your answer.

Specify the Driver Interface

Would you keep the extra SET and CLR addresses if software already has a writable OUT word?

Reveal the Model Answer

Keep them for independent writers. The extra addresses buy single-write changes. TGL is optional because retrying a toggle undoes it. Give the handler a write-one clear mask for only the events it serviced.

Self-Check

Tick each key point you covered in your answer.

I disabled interrupts during setup.

In the separate S6.2 two-pin slice the first rise leaves “pins=01 raw=11 en=00”. Which event can still be seen after its pin goes low?

Reveal the Model Answer

Pin 1 stores a captured rising edge. Pin 0 reports its present level. Enabling both exposes the saved cause. A sticky bit cannot count multiple edges while already set.

Self-Check

Tick each key point you covered in your answer.

Specify the Driver Interface

Would you keep the extra SET and CLR addresses if software already has a writable OUT word?

Reveal the Model Answer

Keep them for independent writers. The extra addresses buy single-write changes. TGL is optional because retrying a toggle undoes it. Give the handler a write-one clear mask for only the events it serviced.

Self-Check

Tick each key point you covered in your answer.

I cleared the saved flag.

S6.2 prints “access=1 rise=1 clear=1”. The faulty copy reports raw=00. What must firmware observe on the good copy?

Reveal the Model Answer

The fresh edge wins and raw remains 10. Clearing the old event must leave the new one pending for service. The later clear without a rise brings raw to 00.

Self-Check

Tick each key point you covered in your answer.

Specify the Driver Interface

Would you keep the extra SET and CLR addresses if software already has a writable OUT word?

Reveal the Model Answer

Keep them for independent writers. The extra addresses buy single-write changes. TGL is optional because retrying a toggle undoes it. Give the handler a write-one clear mask for only the events it serviced.

Self-Check

Tick each key point you covered in your answer.

What People Get Wrong

Common wrong answers and why they fail.

Misconception

Use toggle for every retry.

Repeating the same toggle reverses the first write.

Source S7.2, toggle operation.

Misconception

Clearing status removes an active level.

The request persists while that level and its enable remain active.

Source S7.2, acknowledged status=0004 irq=1.

Learn It, Then Prove It