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: Referencing Package Members

SystemVerilog Advanced Features

Runnable example from the SystemVerilog Scope Resolution Operator tutorial (Referencing Package Members)

Open in IDE
testbench.sv
package my_pkg;
	typedef enum bit {FALSE, TRUE} e_bool;
endpackage

module tb;
  bit val;
  
  initial begin
  	// Refer to types that have been declared
  	// in a package. Note that package has to
  	// be included in compilation but not
  	// necessarily "imported"
    val = my_pkg::TRUE;
    $display("val = 0x%0h", val);
  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.