# \#function-new

**URL:** https://verificationacademy.com/forums/tag/function-new/5323.md

[Latest](https://verificationacademy.com/forums/latest.md) · [Categories](https://verificationacademy.com/forums/categories.md) · [Tags](https://verificationacademy.com/forums/tags.md)

---

## [Loops inside Function new in OVM](https://verificationacademy.com/forums/t/loops-inside-function-new-in-ovm/34363)

<div class="topic-metadata">

**Author:** [@SivaNamathoti](https://verificationacademy.com/forums/u/SivaNamathoti)\
**Replies:** 5\
**Last updated:** [November 25, 2022, 1:31pm UTC](https://verificationacademy.com/forums/t/loops-inside-function-new-in-ovm/34363 "2022-11-25T13:31:24Z")

</div>

function new (string str=“pmc\_svt\_i2c\_system\_configuration”); super.new(str); num\_slaves = 128; // 128 new slaves int i; /\*\* Create port configurations \*/ create\_sub\_cfgs(num\_masters, num\_slaves); for(i=32'h20 ; i…

---

## [Function new() in user defined UVM classes](https://verificationacademy.com/forums/t/function-new-in-user-defined-uvm-classes/38785)

<div class="topic-metadata">

**Author:** [@bachan21](https://verificationacademy.com/forums/u/bachan21)\
**Replies:** 3\
**Last updated:** [March 6, 2021, 6:07pm UTC](https://verificationacademy.com/forums/t/function-new-in-user-defined-uvm-classes/38785 "2021-03-06T18:07:56Z")

</div>

// constructor function new (string name, uvm\_component parent); super.new(name, parent); endfunction : new Why do we have to declare new constructor in every extended UVM class as its already available in UVM b…

---

## [Function new() with virtual keyword](https://verificationacademy.com/forums/t/function-new-with-virtual-keyword/38708)

<div class="topic-metadata">

**Author:** [@bachan21](https://verificationacademy.com/forums/u/bachan21)\
**Replies:** 4\
**Last updated:** [February 12, 2021, 4:17am UTC](https://verificationacademy.com/forums/t/function-new-with-virtual-keyword/38708 "2021-02-12T04:17:24Z")

</div>

We implement constructor function new() in each class. Its defined as function with no return type. Why cant we specify it as virtual ? Like virtual function new();

---

## [Need of function new in every object/component class](https://verificationacademy.com/forums/t/need-of-function-new-in-every-object-component-class/38567)

<div class="topic-metadata">

**Author:** [@bachan21](https://verificationacademy.com/forums/u/bachan21)\
**Replies:** 1\
**Last updated:** [January 9, 2021, 6:17pm UTC](https://verificationacademy.com/forums/t/need-of-function-new-in-every-object-component-class/38567 "2021-01-09T18:17:19Z")

</div>

Why do we need function new() in every user defined classes extending from UVM base classes? What will happen if we don’t define in user defined classes?

---

## [Why function new() is used in derived class in UVM testbench?](https://verificationacademy.com/forums/t/why-function-new-is-used-in-derived-class-in-uvm-testbench/42921)

<div class="topic-metadata">

**Author:** [@nimitz\_class](https://verificationacademy.com/forums/u/nimitz_class)\
**Replies:** 1\
**Last updated:** [April 20, 2020, 3:00am UTC](https://verificationacademy.com/forums/t/why-function-new-is-used-in-derived-class-in-uvm-testbench/42921 "2020-04-20T03:00:55Z")

</div>

class simple\_driver extends uvm\_driver#(simple\_item); simple\_item item; virtual dut\_if vif; \`uvm\_component\_utils(simple\_driver) function new(string name = "simple\_driver",uvm\_component parent); super.new(name, parent)…

---

## [Why do we use uvm\_component parent in function new()?](https://verificationacademy.com/forums/t/why-do-we-use-uvm-component-parent-in-function-new/34927)

<div class="topic-metadata">

**Author:** [@UVM\_LOVE](https://verificationacademy.com/forums/u/UVM_LOVE)\
**Replies:** 2\
**Last updated:** [August 27, 2018, 1:12pm UTC](https://verificationacademy.com/forums/t/why-do-we-use-uvm-component-parent-in-function-new/34927 "2018-08-27T13:12:01Z")

</div>

Dear All, When you make data modeling with uvm, data constructor with string instance name argument and default value be used in function new(), such as function new (string name = "yapp\_packet"); super.new(name); …

---

## [Difference between function new () and function build()](https://verificationacademy.com/forums/t/difference-between-function-new-and-function-build/30954)

<div class="topic-metadata">

**Author:** [@manavshah33](https://verificationacademy.com/forums/u/manavshah33)\
**Replies:** 4\
**Last updated:** [December 22, 2017, 12:20pm UTC](https://verificationacademy.com/forums/t/difference-between-function-new-and-function-build/30954 "2017-12-22T12:20:44Z")

</div>

Whats is the main difference between function new() and function build? Also can I create instance of sequence item in my uvm\_sequence inside function new()? or it has to be in function build() I am creating instance i…

---

## [Difference between creating a object in function new constructor and a task](https://verificationacademy.com/forums/t/difference-between-creating-a-object-in-function-new-constructor-and-a-task/33749)

<div class="topic-metadata">

**Author:** [@rakesh2learn](https://verificationacademy.com/forums/u/rakesh2learn)\
**Replies:** 1\
**Last updated:** [November 24, 2017, 8:06am UTC](https://verificationacademy.com/forums/t/difference-between-creating-a-object-in-function-new-constructor-and-a-task/33749 "2017-11-24T08:06:56Z")

</div>

In example 1 and example 2, does creating object ‘gen\_h’ and ‘drv\_h’ have any difference? Is there any drawback in creating objects in a task rather than in function ‘new’ constructor? Thank you. EXAMPLE 1: class env; …

---

## [What is difference between below two code execution](https://verificationacademy.com/forums/t/what-is-difference-between-below-two-code-execution/31379)

<div class="topic-metadata">

**Author:** [@JDS1](https://verificationacademy.com/forums/u/JDS1)\
**Replies:** 2\
**Last updated:** [February 16, 2016, 6:34am UTC](https://verificationacademy.com/forums/t/what-is-difference-between-below-two-code-execution/31379 "2016-02-16T06:34:48Z")

</div>

Code 1: class\_p p1,p2; p1 = new(); p2 = new(); p2 = p1; Code 2: class\_p p1,p2; p1 = new(); p2 = new p1; What is difference between above two. I understand both are same. (like, p2 = new p1; would in turn do p2 = …

---

## [Uvm\_registry: Too many arguments to 'new'](https://verificationacademy.com/forums/t/uvm-registry-too-many-arguments-to-new/31289)

<div class="topic-metadata">

**Author:** [@trogers](https://verificationacademy.com/forums/u/trogers)\
**Replies:** 4\
**Last updated:** [December 8, 2015, 8:14am UTC](https://verificationacademy.com/forums/t/uvm-registry-too-many-arguments-to-new/31289 "2015-12-08T08:14:47Z")

</div>

hello everyone! i’m facing a trouble with my virtual sequence (or, more likely, with my parameterized sequencer) class enchancer\_virtual\_sequence extends uvm\_sequence#( uvm\_sequence\_item ); v\_data\_sequencer #( .V…

---

## [Class having object of itself](https://verificationacademy.com/forums/t/class-having-object-of-itself/31278)

<div class="topic-metadata">

**Author:** [@JDS1](https://verificationacademy.com/forums/u/JDS1)\
**Replies:** 2\
**Last updated:** [December 3, 2015, 6:40am UTC](https://verificationacademy.com/forums/t/class-having-object-of-itself/31278 "2015-12-03T06:40:36Z")

</div>

In below code a class is having object of itself. Object of own type is created before class definition completes (before endclass.) This is working. Compiler do not give any error. Can anyone explain me how this works? …
