Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Stable sort transaction handles

Hardware interview practice

Stable sort transaction handles

MediumVerification UtilitiesSystemVerilog

Sort a queue of transaction handles by address while preserving the original order of equal-address transactions.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Reviewed example

Work through one case

Input
transactions in arrival order=[(addr=0x20,A),(addr=0x10,B),(addr=0x20,C)]
Expected output
sorted handles=[B,A,C]

Address 0x10 sorts first, while the original positions keep A before C for the equal 0x20 keys; the same handles are retained.

What to cover

Requirements

  1. Do not clone or replace the transaction objects.
  2. Preserve input order when addresses are equal.
  3. Use the original position as an explicit tie-breaker.
asic.fyi · Learn silicon end to end.info@asic.fyi