Thursday, May 19, 2016

Extern Keyword in System Verilog

Class methods and Constraints can be defined in the following places:
 inside a class.
 outside a class in the same file.
 outside a class in a separate file.

The process of declaring an out of block method involves:
 declaring the method prototype or constraint within the class declaration with extern qualifier.
 declaring the full method or constraint outside the class body.

The extern qualifier indicates that the body of the method (its implementation) or constraint block is to be found outside the declaration.

NOTE : class scope resolution operator :: should be used while defining.



EXAMPLE:
class B;
extern task printf();
endclass

task B::printf();
$display(" Hi ");
endtask

program main;
initial
begin
B b;
= new();
b.printf();
end
endprogram


RESULT:

Hi

#from testbench.in

Ethernet and more

Ethernet is a protocol under IEEE 802.33 standard User Datagram Protocol (UDP) UDP is a connectionless transport protocol. I...