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

Scope Resolution Operator: Defining an extern Function

SystemVerilog Advanced Features

Runnable example from the SystemVerilog Scope Resolution Operator tutorial (Defining an extern Function)

Open in IDE
testbench.sv
class ABC;
	int 	data;

	extern virtual function void display();
endclass

// Definition of an external function using scope
// resolution operator
function void ABC::display();
	$display("data = 0x%0h", data);
endfunction

module tb;
	initial begin
		ABC abc = new();
		abc.data = 32'hface_cafe;
		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.