create() vs new() in UVM: d1 built with type_id::create becomes tav_err_drv, d2 built with new stays tav_drv. The Art of Verification

create() vs new() in UVM: What Changes, Tested on VCS

In short: In UVM, new() builds exactly the class you named, while type_id::create() asks the UVM factory which class to build. Only create() follows a type or instance override. It still calls new() in the end, just of the class the factory picked, so use create() for every component and transaction you might want to replace from a test.

This is one of the first UVM rules people learn, and one of the first they break. One stray new() in an env and a test’s override silently does nothing.

In this lesson we prove the difference with 8 self-checks in one UVM bench. I ran it on Synopsys VCS, and the planted bug shows something the factory print will not tell you.

Start here: the simplest example

One override, two ways to build the same class.

// tav_create_simple.sv : the smallest create() vs new() example (UVM 1.2)
// The Art of Verification | theartofverification.com
// Run on Synopsys VCS X-2025.06-SP1 with UVM 1.2 (EDA Playground), 30 Nov 2026.
// EDA Playground: Synopsys VCS, UVM 1.2, top module "tav_top".

`include "uvm_macros.svh"
import uvm_pkg::*;

class tav_item extends uvm_object;
  `uvm_object_utils(tav_item)
  function new(string name = "tav_item");
    super.new(name);
  endfunction
endclass

class tav_err_item extends tav_item;
  `uvm_object_utils(tav_err_item)
  function new(string name = "tav_err_item");
    super.new(name);
  endfunction
endclass

module tav_top;
  tav_item a, b;

  initial begin
    tav_item::type_id::set_type_override(tav_err_item::get_type());   // "build tav_err_item instead"
    a = new("a");                                                      // skips the factory
    b = tav_item::type_id::create("b");                                // asks the factory
    `uvm_info("TAV_SIMPLE", {"1  new()    built a ", a.get_type_name()}, UVM_NONE)
    `uvm_info("TAV_SIMPLE", {"2  create() built a ", b.get_type_name()}, UVM_NONE)
  end
endmodule

Here is what VCS printed:

UVM_INFO testbench.sv(30) @ 0: reporter [TAV_SIMPLE] 1  new()    built a tav_item
UVM_INFO testbench.sv(31) @ 0: reporter [TAV_SIMPLE] 2  create() built a tav_err_item
  • Line 1: new() goes straight to the class you named, so the override is ignored.
  • Line 2: create() asks the factory first, and the factory hands back tav_err_item.

The rest of this lesson builds on this. The full bench further down tests the same idea from more angles, with a planted bug.

What you will learn

  • What type_id::create() does that new() does not.
  • The order the factory checks overrides in.
  • How the call differs for objects and components.
  • Why a registered override can still be skipped, and how to catch it.
  • The few places where plain new() is the right call.

Cheat sheet: create() vs new()

new()type_id::create()
Who picks the classYou, at compile timeThe factory, at run time
Follows a type overrideNoYes
Follows an instance overrideNoYes, matched on the full path
Calls a constructorYes, of the named classYes, of the class the factory chose
Needs registrationNoYes: `uvm_object_utils or `uvm_component_utils
Object callb = new("b");b = tav_item::type_id::create("b");
Component calld = new("d", this);d = tav_drv::type_id::create("d", this);
Diagram: d2 = new("d2", this) goes straight to tav_drv::new() and the result is tav_drv, the override is ignored. d1 = tav_drv::type_id::create("d1", this) goes to the UVM factory, which checks an instance override at uvm_test_top.env.d1, then a type override for tav_drv, then falls back to tav_drv; it finds tav_err_drv and calls tav_err_drv::new()
How env.d1 and env.d2 were built in the bench, with an instance override set on env.d1.

How create() picks the class

When you call tav_drv::type_id::create("d1", this), the factory builds the full path uvm_test_top.env.d1 and looks for a match. It checks in this order:

  1. Instance override for tav_drv at that path.
  2. Type override for tav_drv, anywhere.
  3. No override: build tav_drv itself.

Whatever it finds, it calls that class’s new(). So create() is not a replacement for the constructor, it is a lookup in front of it.

Analogy: new() is ordering a part by its exact part number. create() is ordering through the store counter, which checks the substitution list first and hands you the newer part if one is listed.

Objects vs components

Object (transaction, sequence, config)Component (driver, monitor, env)
Register with`uvm_object_utils(tav_item)`uvm_component_utils(tav_drv)
Create withtav_item::type_id::create("b")tav_drv::type_id::create("d1", this)
Parent argumentNoneRequired: it sets the path the instance override matches
Where to createAnywhere, any timeIn build_phase of the parent

Going further: one bench, 8 checks

  • Objects: tav_item and its child tav_err_item. Each constructor adds a word to a static trace string, so we can see which constructors ran.
  • Components: tav_drv and its child tav_err_drv.
  • Env: builds d0 and d1 with create() and d2 with new().
  • Test: sets a type override tav_item → tav_err_item and an instance override on env.d1 only, then runs 8 checks and prints the factory in report_phase.
  • Planted bug: +BUG=1 builds d1 with new().

Run it yourself: the same file is on GitHub, with the expected output from both runs.

// tav_create_uvm.sv : create() vs new() in UVM, a complete working example (UVM 1.2)
// The Art of Verification | theartofverification.com
// Run on Synopsys VCS X-2025.06-SP1 with UVM 1.2 (EDA Playground), 30 Nov 2026.
// EDA Playground: Synopsys VCS, UVM 1.2, top module "tav_top".
// Paste this whole file into testbench.sv and leave design.sv empty.
//
// What is in here:
//   tav_item / tav_err_item   a transaction and a child of it (objects)
//   tav_drv  / tav_err_drv    a driver-like component and a child of it (components)
//   tav_env                   builds three drivers: d0 and d1 with create(), d2 with new()
//   tav_create_test           sets a type override (objects) and an instance override (components),
//                             then makes 8 self-checks with `uvm_info and `uvm_error
//
// Run options:
//   (none)   all 8 checks pass, 0 errors
//   +BUG=1   tav_env builds d1 with new() instead of create(), so its instance override is lost

`include "uvm_macros.svh"

package tav_create_pkg;
  import uvm_pkg::*;
  `include "uvm_macros.svh"

  // ---------------------------------------------------------------
  // Objects: a transaction and an error variant
  // ---------------------------------------------------------------
  class tav_item extends uvm_sequence_item;
    `uvm_object_utils(tav_item)
    static string tav_trace;   // records which constructors ran
    function new(string name = "tav_item");
      super.new(name);
      tav_trace = {tav_trace, "item.new "};
    endfunction
  endclass

  class tav_err_item extends tav_item;
    `uvm_object_utils(tav_err_item)
    function new(string name = "tav_err_item");
      super.new(name);
      tav_trace = {tav_trace, "err.new "};
    endfunction
  endclass

  // ---------------------------------------------------------------
  // Components: a driver-like component and an error variant
  // ---------------------------------------------------------------
  class tav_drv extends uvm_component;
    `uvm_component_utils(tav_drv)
    function new(string name, uvm_component parent);
      super.new(name, parent);
    endfunction
  endclass

  class tav_err_drv extends tav_drv;
    `uvm_component_utils(tav_err_drv)
    function new(string name, uvm_component parent);
      super.new(name, parent);
    endfunction
  endclass

  // ---------------------------------------------------------------
  // Env: three drivers, built two different ways
  // ---------------------------------------------------------------
  class tav_env extends uvm_env;
    `uvm_component_utils(tav_env)
    tav_drv d0, d1, d2;
    int     tav_bug;

    function new(string name, uvm_component parent);
      super.new(name, parent);
    endfunction

    function void build_phase(uvm_phase phase);
      super.build_phase(phase);
      void'($value$plusargs("BUG=%d", tav_bug));
      d0 = tav_drv::type_id::create("d0", this);       // through the factory
      if (tav_bug == 1)
        d1 = new("d1", this);                          // BUG: skips the factory
      else
        d1 = tav_drv::type_id::create("d1", this);     // through the factory
      d2 = new("d2", this);                            // plain new(): never overridden
    endfunction
  endclass

  // ---------------------------------------------------------------
  // The test
  // ---------------------------------------------------------------
  class tav_create_test extends uvm_test;
    `uvm_component_utils(tav_create_test)

    tav_env env;
    int     tav_pass, tav_fail;

    function new(string name, uvm_component parent);
      super.new(name, parent);
    endfunction

    function void build_phase(uvm_phase phase);
      super.build_phase(phase);
      // Objects: every tav_item built through the factory becomes a tav_err_item
      tav_item::type_id::set_type_override(tav_err_item::get_type());
      // Components: only the driver at this path becomes a tav_err_drv
      tav_drv::type_id::set_inst_override(tav_err_drv::get_type(), "env.d1", this);
      env = tav_env::type_id::create("env", this);
    endfunction

    function void tav_check(string what, string got, string exp);
      if (got == exp) begin
        tav_pass++;
        `uvm_info("TAV_CREATE", $sformatf("PASS %s: %s", what, got), UVM_LOW)
      end
      else begin
        tav_fail++;
        `uvm_error("TAV_CREATE", $sformatf("FAIL %s: got %s, expected %s", what, got, exp))
      end
    endfunction

    task run_phase(uvm_phase phase);
      tav_item    a, b, c;
      uvm_object  o;
      uvm_factory f = uvm_factory::get();
      phase.raise_objection(this);

      // 1. new() ignores the type override
      tav_item::tav_trace = "";
      a = new("a");
      tav_check("1 new(\"a\") type", a.get_type_name(), "tav_item");
      tav_check("2 new(\"a\") constructors", tav_item::tav_trace, "item.new ");

      // 3. create() follows the type override
      tav_item::tav_trace = "";
      b = tav_item::type_id::create("b");
      tav_check("3 create(\"b\") type", b.get_type_name(), "tav_err_item");
      // 4. create() still calls new(): the override class's constructor ran
      tav_check("4 create(\"b\") constructors", tav_item::tav_trace, "item.new err.new ");

      // 5. Creating by name goes through the same factory, so the override applies
      o = f.create_object_by_name("tav_item", "", "c");
      if (!$cast(c, o)) `uvm_error("TAV_CREATE", "create_object_by_name did not return a tav_item")
      tav_check("5 create_object_by_name(\"tav_item\") type", c.get_type_name(), "tav_err_item");

      // 6-8. Components: the instance override hits env.d1 only, and only through create()
      tav_check("6 env.d0 (create, no override at this path)", env.d0.get_type_name(), "tav_drv");
      tav_check("7 env.d1 (create, instance override)", env.d1.get_type_name(), "tav_err_drv");
      tav_check("8 env.d2 (new, never overridden)", env.d2.get_type_name(), "tav_drv");

      `uvm_info("TAV_CREATE", $sformatf("env.d1 full name: %s", env.d1.get_full_name()), UVM_LOW)
      `uvm_info("TAV_CREATE", $sformatf("Checks: %0d pass, %0d fail", tav_pass, tav_fail), UVM_NONE)
      phase.drop_objection(this);
    endtask

    function void report_phase(uvm_phase phase);
      uvm_factory::get().print();   // shows the overrides that were registered
    endfunction
  endclass

endpackage

module tav_top;
  import uvm_pkg::*;
  import tav_create_pkg::*;
  initial run_test("tav_create_test");
endmodule

How to run it

  1. Open EDA Playground and pick Synopsys VCS with UVM 1.2.
  2. Paste the file into testbench.sv and leave design.sv empty.
  3. Run it once as is, then add +BUG=1 to the run options and run again.

What VCS returned

#CheckResultWhat it proves
1new("a") typetav_itemnew() ignores the type override
2new("a") constructorsitem.newOnly the named class was built
3create("b") typetav_err_itemcreate() follows the type override
4create("b") constructorsitem.new err.newcreate() still runs new(), of the override class
5create_object_by_name("tav_item")tav_err_itemCreating by name uses the same factory
6env.d0 (create)tav_drvThe instance override does not touch other paths
7env.d1 (create)tav_err_drvThe instance override hit its path
8env.d2 (new)tav_drvnew() is never overridden

Result: 8 pass, 0 fail. Here is the log from the clean run.

UVM_INFO @ 0: reporter [RNTST] Running test tav_create_test...
UVM_INFO testbench.sv(110) @ 0: uvm_test_top [TAV_CREATE] PASS 1 new("a") type: tav_item
UVM_INFO testbench.sv(110) @ 0: uvm_test_top [TAV_CREATE] PASS 2 new("a") constructors: item.new 
UVM_INFO testbench.sv(110) @ 0: uvm_test_top [TAV_CREATE] PASS 3 create("b") type: tav_err_item
UVM_INFO testbench.sv(110) @ 0: uvm_test_top [TAV_CREATE] PASS 4 create("b") constructors: item.new err.new 
UVM_INFO testbench.sv(110) @ 0: uvm_test_top [TAV_CREATE] PASS 5 create_object_by_name("tav_item") type: tav_err_item
UVM_INFO testbench.sv(110) @ 0: uvm_test_top [TAV_CREATE] PASS 6 env.d0 (create, no override at this path): tav_drv
UVM_INFO testbench.sv(110) @ 0: uvm_test_top [TAV_CREATE] PASS 7 env.d1 (create, instance override): tav_err_drv
UVM_INFO testbench.sv(110) @ 0: uvm_test_top [TAV_CREATE] PASS 8 env.d2 (new, never overridden): tav_drv
UVM_INFO testbench.sv(147) @ 0: uvm_test_top [TAV_CREATE] env.d1 full name: uvm_test_top.env.d1
UVM_INFO testbench.sv(148) @ 0: uvm_test_top [TAV_CREATE] Checks: 8 pass, 0 fail
UVM_INFO /apps/vcsmx/vcs/X-2025.06-SP1//etc/uvm-1.2/src/base/uvm_objection.svh(1276) @ 0: reporter [TEST_DONE] 'run' phase is ready to proceed to the 'extract' phase
UVM_INFO /apps/vcsmx/vcs/X-2025.06-SP1//etc/uvm-1.2/src/base/uvm_factory.svh(1645) @ 0: reporter [UVM/FACTORY/PRINT] 
#### Factory Configuration (*)

Instance Overrides:

  Requested Type  Override Path        Override Type
  --------------  -------------------  -------------
  tav_drv         uvm_test_top.env.d1  tav_err_drv

Type Overrides:

  Requested Type  Override Type      
  --------------  -------------------
  tav_item        tav_err_item

All types registered with the factory: 58 total
  Type Name
  ---------
  snps_uvm_reg_bank_group
  snps_uvm_reg_map
  tav_create_test
  tav_drv
  tav_env
  tav_err_drv
  tav_err_item
  tav_item
(*) Types with no associated type name will be printed as <unknown>

####


UVM_INFO /apps/vcsmx/vcs/X-2025.06-SP1//etc/uvm-1.2/src/base/uvm_report_server.svh(904) @ 0: reporter [UVM/REPORT/SERVER] 
--- UVM Report Summary ---

** Report counts by severity
UVM_INFO :   14
UVM_WARNING :    0
UVM_ERROR :    0
UVM_FATAL :    0
** Report counts by id
[RNTST]     1
[TAV_CREATE]    10
[TEST_DONE]     1
[UVM/FACTORY/PRINT]     1
[UVM/RELNOTES]     1

The planted bug: the override that did nothing

With +BUG=1, the env builds d1 with new(). Check 7 fails: VCS reported got tav_drv, expected tav_err_drv.

UVM_INFO @ 0: reporter [RNTST] Running test tav_create_test...
UVM_INFO testbench.sv(110) @ 0: uvm_test_top [TAV_CREATE] PASS 1 new("a") type: tav_item
UVM_INFO testbench.sv(110) @ 0: uvm_test_top [TAV_CREATE] PASS 2 new("a") constructors: item.new 
UVM_INFO testbench.sv(110) @ 0: uvm_test_top [TAV_CREATE] PASS 3 create("b") type: tav_err_item
UVM_INFO testbench.sv(110) @ 0: uvm_test_top [TAV_CREATE] PASS 4 create("b") constructors: item.new err.new 
UVM_INFO testbench.sv(110) @ 0: uvm_test_top [TAV_CREATE] PASS 5 create_object_by_name("tav_item") type: tav_err_item
UVM_INFO testbench.sv(110) @ 0: uvm_test_top [TAV_CREATE] PASS 6 env.d0 (create, no override at this path): tav_drv
UVM_ERROR testbench.sv(114) @ 0: uvm_test_top [TAV_CREATE] FAIL 7 env.d1 (create, instance override): got tav_drv, expected tav_err_drv
UVM_INFO testbench.sv(110) @ 0: uvm_test_top [TAV_CREATE] PASS 8 env.d2 (new, never overridden): tav_drv
UVM_INFO testbench.sv(147) @ 0: uvm_test_top [TAV_CREATE] env.d1 full name: uvm_test_top.env.d1
UVM_INFO testbench.sv(148) @ 0: uvm_test_top [TAV_CREATE] Checks: 7 pass, 1 fail
UVM_INFO /apps/vcsmx/vcs/X-2025.06-SP1//etc/uvm-1.2/src/base/uvm_objection.svh(1276) @ 0: reporter [TEST_DONE] 'run' phase is ready to proceed to the 'extract' phase
UVM_INFO /apps/vcsmx/vcs/X-2025.06-SP1//etc/uvm-1.2/src/base/uvm_factory.svh(1645) @ 0: reporter [UVM/FACTORY/PRINT] 
#### Factory Configuration (*)

Instance Overrides:

  Requested Type  Override Path        Override Type
  --------------  -------------------  -------------
  tav_drv         uvm_test_top.env.d1  tav_err_drv

Type Overrides:

  Requested Type  Override Type      
  --------------  -------------------
  tav_item        tav_err_item

All types registered with the factory: 58 total
  Type Name
  ---------
  snps_uvm_reg_bank_group
  snps_uvm_reg_map
  tav_create_test
  tav_drv
  tav_env
  tav_err_drv
  tav_err_item
  tav_item
(*) Types with no associated type name will be printed as <unknown>

####


UVM_INFO /apps/vcsmx/vcs/X-2025.06-SP1//etc/uvm-1.2/src/base/uvm_report_server.svh(904) @ 0: reporter [UVM/REPORT/SERVER] 
--- UVM Report Summary ---

** Report counts by severity
UVM_INFO :   13
UVM_WARNING :    0
UVM_ERROR :    1
UVM_FATAL :    0
** Report counts by id
[RNTST]     1
[TAV_CREATE]    10
[TEST_DONE]     1
[UVM/FACTORY/PRINT]     1
[UVM/RELNOTES]     1

Now look at the factory print at the end of that same run. It still lists the instance override for uvm_test_top.env.d1, so the override was registered correctly. It was simply never asked, because new() does not go through the factory.

The lesson: factory.print() shows what overrides you asked for, not what was built. To prove an override worked, print or check the type of the object you got, as checks 3, 5 and 7 do.

When new() is the right call

  • TLM ports and exports: uvm_analysis_port and friends are not registered with the factory, so they are built with new().
  • Covergroups: they are not classes, and new() is the only way to build them.
  • Inside the class’s own new(): super.new() is a constructor call by definition.

For drivers, monitors, agents, envs, sequences, sequence items and config objects, use create(). You may not need an override today, but a test writer will want one later.

Common mistakes to avoid

MistakeWhat you seeFix
A component built with new()Override is listed in the factory print but has no effect (+BUG=1)Use type_id::create()
Class not registeredCompile error on type_idAdd `uvm_object_utils or `uvm_component_utils
Override set after the object was builtThe old class is usedSet overrides in the test’s build_phase, before creating the env
Wrong instance pathThe override never matchesCheck get_full_name() and the factory print
Override class does not extend the originalFatal FCTTYP error when the object is createdThe override must be a child of the requested type
Wrong macro: `uvm_object_utils on a componentCompile errorComponents use `uvm_component_utils

How AI helps you master this

  • Scan for stray new() calls: paste an env and ask which components bypass the factory.
  • Explain an override that did not apply: paste your factory print and the path from get_full_name(), and ask why they do not match.
  • Write the check: ask for a small check that prints get_type_name() of every child of the env.

Warning: a convincing AI answer is not the same as a correct engineering result. If an AI tool says an override “should” work, run the bench and look at the type you actually got.

Interview questions on create() and new()

  • What is the difference between create() and new() in UVM? create() asks the factory which class to build, so it follows overrides. new() builds the named class only.
  • Does create() call new()? Yes. It calls the constructor of the class the factory picked.
  • Which wins, an instance override or a type override? The instance override for that path is checked first.
  • Why does a component’s create() need a parent? The parent sets the full path, and instance overrides match on that path.
  • Your override shows in factory.print() but has no effect. Why? The object was probably built with new(), or the path does not match.

More practice: UVM interview questions.

Practice challenge

  1. Run the bench and confirm 8 pass, 0 fail.
  2. Run with +BUG=1 and find the instance override in the factory print.
  3. Change the instance path from "env.d1" to "env.d*". Predict checks 6 and 7, then run.
  4. Bonus: replace the instance override with a type override for tav_drv. Which of d0, d1 and d2 change?

FAQ

What does type_id::create() do in UVM? It asks the UVM factory which class to build for the requested type and path, then calls that class’s constructor.

Is create() slower than new()? It adds a factory lookup. That cost is small and happens mostly in build_phase, so the flexibility is worth it.

Can I use new() for a sequence item? It compiles, but tests can no longer swap the item with an override. Use create().

Why does create() need a name argument? The name becomes part of the object’s full path, which instance overrides and reports use.

What is the difference between create() and create_object_by_name()? Both go through the factory. create_object_by_name() takes the type as a string, which is handy when the type comes from a plusarg or a config file.

References

  • Accellera UVM 1.2 Class Reference: uvm_factory, uvm_object_registry and uvm_component_registry (create, set_type_override, set_inst_override).
  • IEEE 1800.2-2020, UVM standard: section 8 (factory classes).

Keep learning

2 Comments

  1. Hii , i am a verification trainee and i need some suggestions regarding verification so that i can be a better verification engineer

Comments are closed.