# Parameterized UVM test

**URL:** <https://verificationacademy.com/forums/t/parameterized-uvm-test/42730>\
**Category:** UVM\
**Tags:** UVM\
**Created:** [November 21, 2023, 12:30pm UTC](https://verificationacademy.com/forums/t/parameterized-uvm-test/42730 "2023-11-21T12:30:13Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![cgales](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/ccd318/32.png) [@cgales](https://verificationacademy.com/forums/u/cgales)\
**Post date:** [November 21, 2023, 2:46pm UTC](https://verificationacademy.com/forums/t/parameterized-uvm-test/42730/2 "2023-11-21T14:46:41Z")

</div>

_In reply to [jjych](https://verificationacademy.com/forums/t/parameterized-uvm-test/42730):_

You need to create a parameterized typedef in your testbench so that it can be registered with the factory.

Here is a working example:

```verilog

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

class mytest#(int NUM) extends uvm_test;
  typedef uvm_component_registry#(mytest#(NUM),$sformatf("mytest#(%1d)",NUM)) type_id;
  static function type_id get_type();
    return type_id::get();
  endfunction

  virtual function uvm_object_wrapper get_object_type();
    return type_id::get();
  endfunction

  const static string type_name = $sformatf("mytest#(%1d)",NUM);
  virtual function string get_type_name();
    return type_name;
  endfunction
  
  function new(string name="mytest", uvm_component parent=null);
    super.new(name, parent);
  endfunction
  //function build_phase
endclass

module testbench();
  parameter NUM = 3;
  typedef mytest#(NUM) mytest_typed;
  
  initial begin
    run_test($sformatf("mytest#(%1d)",NUM));
  end
endmodule

```

---

_[View the full topic](https://verificationacademy.com/forums/t/parameterized-uvm-test/42730)._
