Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ673
Page ↗
Q673DVASIC interview problem

Merge sorted transaction queues

TechniquesQueueStable mergeTransactions
DifficultyEasy
TopicReference Models
LanguageSystemVerilog
Requirements3 checkpoints
01

Problem

Merge two queues of transactions sorted by id into one stable sorted queue.

Example input and output

Use this case to check your interpretation
Input
queue A=[(id1,A1),(id3,A3)]; queue B=[(id1,B1),(id2,B2),(id3,B3)]
Output
merged=[A1,B1,B2,A3,B3]
Explanation

On equal IDs the first queue wins, preserving stable order while neither input queue is mutated.

02

Requirements (3)

  • Prefer the first queue when ids are equal.
  • Do not mutate the input queues.
  • Append every remaining transaction.