原创 What is "this" in System Verilog ?

2013-5-27 13:09 4663 1 1 分类: 消费电子

 

Dear Readers,

 

Here I would like to share some understanding on keyword called "this". What is "this" in System Verilog? How does it used? Usage of "this" is simple but important in test bench development.

 

First of all lets understand What is "this" in System Verilog?

 

"this" is a key word in System Verilog used to unambiguously refer to class properties or methods of current object. The "this" keyword shall only used within a non-static class methods otherwise an error shall occur.

 

As example is the best way to understand the most of the things, let me take a example and try to explain.

Example to understand the usage of "this" in System Verilog:

 

#############################################


     class ASICwithAnkit ;

        int a ;


        function new (int a);

           this.a = a;

        endfunction : new


     endclass : ASICwithAnkit


//Class instantiation and usage


ASICwithAnkit  AwA = new (123);

$display ("AwA.a = %d,", AwA.a);


##########################################

 

In above example we can see that 'a' is a member of class "ASICwithAnkit". When we initialize the memory for class for usage, we have passed a integer value '123' to its constructor (function new). The variable 'a' is local to class instance "AwA and is now 123 as we have passed this from constructor.

 

Hope this is useful to understand the meaning and usage of "this" in System Verilog.

 

Happy Reading !

ASIC With Ankit

文章评论0条评论)

登录后参与讨论
相关推荐阅读
ankitgopani 2015-03-16 06:30
System Verilog : Functional Coverage Guidelines
We have been implementing every possible checks to make sure design is verified but what have we d...
ankitgopani 2014-11-14 09:12
Semicon M&A, takeover & impacts!
Dear Readers,   Mergers and acquisition are common in today’s global market. If you take a his...
ankitgopani 2013-05-19 00:52
System Verilog Queues which can shrink and grow !
Dear Readers, System Verilog has new data type called ‘queue’ which can grow and shrink. With SV ...
ankitgopani 2013-05-01 01:03
Verilog to System Verilog : A Successful journey towards SV
Dear Readers, We have been using standard languages and methodologies for ASIC/FPGA design and Ve...
ankitgopani 2013-03-13 21:53
What are the major factor which could trigger re-spin?
Dear Readers, I have been hearing on re-spins of chips. Many companies have gone through this pa...
广告
EE直播间
更多
我要评论
0
1
广告
关闭 热点推荐上一条 /4 下一条