Skip to question and answer

Hardware interview practice

uvm_object vs. uvm_component

EasyUVM ComponentsMultiple choice

A reusable packet configuration has no hierarchy, ports, or phase behavior. Why is extending uvm_object usually preferable to extending uvm_component?

Answer choices

  1. A. Only uvm_object can be randomized
  2. B. uvm_object instances are lightweight data objects and do not participate in the component hierarchy or phasing
  3. C. uvm_component cannot be registered with the factory
  4. D. uvm_object automatically raises and drops run-phase objections

Concise answer

The answer and the key reason

Use `uvm_object` because the configuration is data rather than a structural testbench element. It needs neither a hierarchical parent nor phase callbacks, ports, or persistent component lifetime. Choosing an object keeps construction and reuse simpler without preventing factory registration or randomization.

Deeper explanation

Work through the implementation and tradeoffs

`uvm_component` is intended for entities that occupy the UVM hierarchy, such as environments, agents, drivers, monitors, and scoreboards. Components have parent-child relationships, names within that hierarchy, and participation in the UVM phase schedule. Those services are useful for testbench structure but unnecessary overhead for a packet configuration value.

`uvm_object` suits transient or portable data including transactions, sequence items, policies, and configuration records. It can still define random fields, constraints, copy and compare behavior, printing, and factory registration. If the class later needs ports, automatic phase methods, or a stable place in the component tree, converting its role to a component may then be justified.

What to remember

  • Objects represent data
  • Components form hierarchy
  • Both support the factory

Practice the complete prompt

Explain it first, then compare the reviewed solution.

Open this exact question in the practice bank to attempt it, check your reasoning, and access the full member solution.Practice this question

Keep practicing

UVM ComponentsUVM build_phase vs. connect_phaseUVM ComponentsHow UVM Phase Objections WorkUVM ComponentsHow UVM Factory Type Overrides Work