Saturday 16 April 2016

SystemVerilog FAQ2

What is the difference between void and null pointer?
So, once again, null pointer is a value, while void pointer is a type.
Null pointer is a special reserved value of a pointer. A pointer of any type has such a reserved value. 
A null pointer is one which is not pointing to anything
Void pointer is a specific pointer type - void * - a pointer that points to some data location in storage, which doesn't have any specific type.



Do we need to call super.new() when extending class? What happens if we don’t call?
A super.new call shall be the first statement executed in the constructor.
This is because the superclass shall be initialized before the current class and, if the user code does not provide an initialization, the compiler shall insert a call to super.new automatically.




What is the difference between initial block and final block?
Initial block is getting executed at start of simulation while Final block is getting executed at end of simulation.
Both of them gets executed only once during the simulation
You can schedule an event or have delay in initial block But you can’t schedule an event or have delay in final block.



What is the use of abstract class?
Using abstract class you can Not only define a template for child, but Abstract Classes offer the added benefit of letting you define functionality that your child classes can utilize later.

A base class may be characterized as being abstract by identifying it with the keyword virtual:
virtual class BasePacket;
...
endclass
An object of an abstract class shall not be constructed directly. Its constructor may only be called indirectly through the chaining of constructor calls originating in an extended non-abstract object
A virtual method in an abstract class may be declared as pure virtual.



Where to use abstract class and where to use interface class?
Abstract Class
Interface Class
Abstract Classes are a good fit if you want to provide implementation details to your child but don't want to allow an instance of your class to be directly instantiated (which allows you to partially define a class).
Interface classes are good if you want to provide only templates to child class
You can only extend one abstract class.
you can implement as many interface classes as you want.
methods of abstract can be virtual or pure virtual
methods of interface class shall be pure virtual




How you call task in derived class which is defined in parent class?
  1. If derived class overrides the task then you can call parent class’s task using super.
  2. If derived class does not override the task then you can call parent class’s task directly be using name of task



How to check whether a handle is holding object or not?
Check it special string called “null”.



What is "this"?
"this" pointer refers to current instance.


 
How to avoid race condition between DUT and Test-bench? 
In Verilog, VHDL,
1) Clock which is given to DUT and Test-bench should have phase difference  (DUT should work on posedge of clk and Test-bench should work on negedge of clk). 
In SV,
2) Using Clocking block, 
3) Using Program block,
 


What is the difference between  bit [7:0] sig_1; and byte sign_2; ?
Byte is signed data type and bit [7:0] is unsigned data type.

1 comment:


  1. Thank you for sharing such important information. It will be very useful for us in future. Good keep it up and keep writing. Read more about
    Free Source Code
    Free Source code For Academic
    Academic Project Download
    Academic Project Free Download
    Freelancer In India

    ReplyDelete