Wednesday, April 21, 2010

SystemVerilog interview Questions 4

1) How to call the task which is defined in parent object into derived class ?




Answer:
The super keyword is used from within a derived class to refer to members of the parent class. It is necessary to use super to access members of a parent class when those members are overridden by the derived class.

EXAMPLE:
    class parent;
        task printf();
            $display(" THIS IS PARENT CLASS ");
        endtask
    endclass
   
    class subclass extends parent;
        task printf();
            super.printf();
        endtask
    endclass
   
    program main;
   
        initial
        begin
            subclass s;
            s = new();
            s.printf();
        end
    endprogram

RESULT

 THIS IS PARENT CLASS

2)  What is the difference between rand and randc?


Answer:
rand  are standard random variables. When there are no other control on distrubution, these variables are uniformly distributed across valid values.

 randc are random cyclic that randomly iterates over all the values in the range and no value is repeated with in an iteration until every possible value has been assigned.    
 
3) What is solve...before constraint ?

Answer:
constraint order { solve a before b ;}
This guides the solver to give highest priority to a than b while picking the solution from solution space.

Answer:
4) What is the difference between fork/joins, fork/join_none fork/join_any ?

Fork Join None: The parent process continues to execute concurrently with all the processes spawned by the fork. The spawned processes do not start executing until the parent thread executes a blocking statement.

Fork Join Any:  The parent process blocks until any one of the processes spawned by this fork completes.

For Join All:   The parent process blocks until all the processes spawned by this fork complete.

No comments:

Post a Comment

Search This Blog