Home / Learn Verilog / Case Equality === and !==

Case Equality === and !==

Compare including x and z.

Quick summaryCompare including x and z.

How to think about this

== vs ===4'b10x1 == 4'b10x1x (unknown)4'b10x1 === 4'b10x11 (identical)
== vs ===

The basic idea

=== matches x and z literally; == gives x if either side has x.

Why this comes up

Testbenches use it to detect unknown outputs.

The mechanics

Never synthesizable; for checking only.

Where it is used

  • Everyday RTL design
  • FPGA and ASIC projects
  • Testbenches and debugging

Try it

x comparisonVerilog: edit and run

Use !== to catch unexpected x in self-checking tests.

Quick check

1. === treats x as...