Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ025
Page ↗
Q025DVASIC interview problem

Stable sort transaction handles

TechniquesTransactionsStable sortDecorate-sort-undecorate
DifficultyMedium
TopicVerification Utilities
LanguageSystemVerilog
Requirements3 checkpoints
01

Problem

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

Example input and output

Use this case to check your interpretation
Input
transactions in arrival order=[(addr=0x20,A),(addr=0x10,B),(addr=0x20,C)]
Output
sorted handles=[B,A,C]
Explanation

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

02

Requirements (3)

  • Do not clone or replace the transaction objects.
  • Preserve input order when addresses are equal.
  • Use the original position as an explicit tie-breaker.