Ready-to-run snippets

Code Examples

Ready-to-run Verilog, SystemVerilog, and UVM examples. Click any to open it live in the IDE.

← All examples

'extern': Basic Syntax

SystemVerilog Advanced Features

Runnable example from the SystemVerilog 'extern' tutorial (Basic Syntax)

Open in IDE
testbench.sv
class ABC;
  
  // Let this function be declared here and defined later
  // by "extern" qualifier
  extern function void display();
  
endclass
  
// Outside the class body, we have the implementation of the
// function declared as "extern"
function void ABC::display();
  
   $display ("Hello world");
  
endfunction

module tb;
  
  // Lets simply create a class object and call the display method
  initial begin
    ABC abc = new();
    abc.display();
  end
endmodule
Admin mode — edit and delete controls are visible on each row. Use the IDE to add new snippets via File → Save as Snippet.