Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

question about this.ports in systemverilog

Status
Not open for further replies.

THUNDERRr

Full Member level 3
Joined
Nov 11, 2007
Messages
189
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Activity points
2,239
what is meant by this.ports in?
rts


function new (virtual port_nme ports)
begin
this.ports=ports
end
end function

this.ports refere to what?
 

THUNDERRr said:
what is meant by this.ports in?
rts


function new (virtual port_nme ports)
begin
this.ports=ports
end
end function

this.ports refere to what?

It is like in C++ - it refers to class level variables/properties. In your case "ports" is visible in 2 contexts:

Code:
function new (virtual port_nme ports)

A local variable called "ports" visible inside the function alone

Code:
class c;
virtual port_name ports;
function new (virtual port_nme ports)
begin
this.ports=ports
end
endfunction

The keyword "this" unambiguouly points to the "ports" at class level.

We cover these and related topics in our VSV class, see: https://sv-verif.blogspot.com

HTH
Ajeetha, CVC
www.noveldv.com
 

"this" is used to assign a class variable from a local varable having identical names.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top