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

'unique' and 'priority' case: unique: No items match for given expression

SystemVerilog Control Flow & Loops

Runnable example from the SystemVerilog 'unique' and 'priority' case tutorial (unique: No items match for given expression)

Open in IDE
testbench.sv
module tb;
  bit [1:0] 	abc;

  initial begin
    abc = 0;

    // First match is executed
    priority case (abc)
      0 : $display ("Found to be 0");
      0 : $display ("Again found to be 0");
      2 : $display ("Found to be 2");
    endcase
  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.