← Design Verification Interviews
Interview Question · Concept
Components vs Objects
The Question
The interviewer asks
What is the difference between a uvm_component and a uvm_object? Is a transaction a component?
You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
A component is a fixed part of the testbench tree. It is built once in the build phase, has a parent and a full name, and runs every phase. An object is data with no place in the tree and no phases. You can create and discard it at any time. Drivers, monitors, agents and scoreboards are components. Transactions, sequences and configuration objects are objects.
Read the diagram as text
- uvm_test_top: The test: root of the tree
- env: Built by the test
- agent: Built by env; builds its children
- agent config: Settings passed down during build
- sequencer: Lives for the whole run
- driver: Pulls items and drives the pins
- sequence: Runs for a while on the sequencer
- sequence item: One transaction, then discarded
- uvm_test_top → env: creates
- env → agent: creates
- agent → sequencer: creates
- uvm_test_top → agent config: creates, sets
- agent config → agent: read in build
- sequencer → driver: hands items
- sequence → sequencer: runs on
- sequence → sequence item: creates each
A sequence runs over time, but it is still an object. It borrows the sequencer, and the sequencer is the component.
Component
class my_driver extends uvm_driver #(item);
`uvm_component_utils(my_driver)
function new(string name, uvm_component parent);
super.new(name, parent);
endfunction
endclass
Has a parent, lives for the whole run, gets phases
Object
class item extends uvm_sequence_item;
`uvm_object_utils(item)
function new(string name = "item");
super.new(name);
endfunction
endclass
No parent, made and thrown away freely, no phases
Self-Check
Tick each key point you covered in your answer.
What Interviewers Listen For (Fresher)
A good fresher answer sorts the usual classes into the right group. It points to the two constructors: a component takes a name and a parent, an object takes only a name.
What Interviewers Listen For (Junior)
A good junior answer explains why a sequence is an object even though it runs over time. The sequence borrows a sequencer, and the sequencer is the component.
What Interviewers Listen For (Mid-Level)
A good mid-level answer adds that every component must exist before the build phase ends. It also says that configuration objects carry settings down the tree.
Cross-Questions
Where the interviewer goes next. Open a node to practise that follow-up.
WhyWhat IfProve ItCompare
- Components vs Objects
-
WhyWhy Components Are Fixed After BuildL1 JuniorL2 Mid-Level
Why can't the scoreboard be created in
connect_phaseorrun_phase?2:30You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
Every phase after build walks a tree that must already be complete. Connections, configuration lookups and end-of-elaboration checks all assume that no new parts appear. The library enforces this. Once build is done,
new()on a component reports a fatalILLCRTerror.Self-Check
Tick each key point you covered in your answer.
Misconception
"Creating it in
connect_phaseis fine because nothing runs yet."Build is over by then, so the library refuses. Its children would also miss their own build phase.
Source uvm-core 2020.3.1 (IEEE 1800.2 library) source, base/uvm_component.svh, new(): "illegal to create a component ... after the build phase has ended"
-
CompareSequence Item vs SequenceL1 Junior
Compare a sequence item with a sequence. Both are objects, so what is the difference?
2:30You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
An item is one transaction's data, such as an address and a payload. A sequence is an object whose
body()task creates items and sends them through a sequencer. A sequence can also start other sequences, which is how you build long scenarios from small ones.Self-Check
Tick each key point you covered in your answer.
Wrong Altitude
"Put the randomization loop in the item class."
An item should describe one transaction. Ordering and scenario logic belong in the sequence, so the same item can serve many scenarios.
Source Accellera, UVM 1.1 User's Guide, §3.10 Enabling Scenario Creation (PDF p55)
-
What IfWho Owns an Item After It Is SentL2 Mid-Level
What if a driver changes an item after
item_done(), while the sequence still holds the same handle?2:30You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
Both sides see the change, because they share one object. Agree on ownership. After sending, the sender does not touch the item. A receiver that must change it works on a
clone(). Check this when a sequence reads back fields of an item it already sent.Self-Check
Tick each key point you covered in your answer.
Misconception
"
finish_itemcopies the item into the sequencer."It passes the handle. The driver receives the very object the sequence created.
Source Verification Academy, UVM Cookbook, Driver/Sequence API: the driver gets a pointer to the same item (PDF p216)
-
Prove ItSolve U2.4.1: Pack a Frame Whose Payload Has Its Own LengthSimulator-graded
Show it, don't just say it: this Silicon Lab problem is graded by the simulator.
What People Get Wrong
Common wrong answers and why they fail.
Misconception
"A sequence is a component, because it runs over time."
A sequence derives from uvm_sequence_item, which is an object. It runs its body() on a sequencer, and the sequencer is the component.
Source uvm-core 2020.3.1 (IEEE 1800.2 library) source, seq/uvm_sequence_base.svh (class uvm_sequence_base extends uvm_sequence_item)
Buzzword Without Mechanism
"Components are static and objects are dynamic."
Both are class instances made at run time. The real difference is the tree: a parent, a name and phases.
Missed Corner
"You can add a component whenever a test needs one, even in run_phase."
The library stops the run with a fatal error if a component is created after the build phase has ended.
Source uvm-core 2020.3.1 (IEEE 1800.2 library) source, base/uvm_component.svh, fatal ILLCRT in new()