Wednesday, April 21, 2010

SystemVerilog Interview Question 9

1)  How to kill a process in fork/join?

The kill() task terminates the given process and all its sub-processes, that is, processes spawned using fork statements by the process being killed. If the process to be terminated is not blocked waiting on some other condition, such as an event, wait expression, or a delay then the process shall be terminated at some unspecified time in the current time step.

2)  What is cross coverage ?

Cross allows keeping track of information which is received simultaneous on more than one cover point. Cross coverage is specified using the cross construct.


    program main;
    bit [0:1] y;
    bit [0:1] y_values[$]= '{1,3};
   
    bit [0:1] z;
    bit [0:1] z_values[$]= '{1,2};
   
    covergroup cg;
        cover_point_y : coverpoint y ;
        cover_point_z : coverpoint z ;
        cross_yz : cross cover_point_y,cover_point_z ;                 
    endgroup
   
    cg cg_inst = new();
    initial
       foreach(y_values[i])
       begin
           y = y_values[i];
           z = z_values[i];
           cg_inst.sample();
       end
   
    endprogram








3)  Why always block is not allowed in program block?






The program block does not allow always block. Only initial and methods are allowed, which are more controllable.

4) What is final block ?



SystemVerilog final blocks execute in an arbitrary but deterministic sequential order. This is possible because final blocks are limited to the legal set of statements allowed for functions.


EXAMPLE :
   module fini;
 
      initial
         #100 $finish;
     
      final
         $display(" END OF SIMULATION at %d ",$time);
   endmodule
RESULTS:

No comments:

Post a Comment

Search This Blog