What is X-optimism?

In HDL simulation, the tendency for conditions containing unknown X to resolve to definite values instead of propagating X, hiding bugs.

Field: HDL & Verification

Japanese name: X楽観主義

What happens

A Verilog if statement treats an X condition as false and executes the else branch. In 'if (sel) y = a; else y = b;', for example, y receives b when sel is X. If a is 1 and b is 0, y is 0 in simulation. In the real circuit sel is either 0 or 1. If it is 1, y becomes 1. The simulation shows one of the two possible outcomes and hides the other.

Why bugs are hidden

X is a marker that a value is unknown. A register whose reset was forgotten starts at X, which is noticeable in the waveform. Once that X is used in a condition, however, downstream signals turn into definite 0s and 1s. The waveform looks normal and the test passes. In the real chip the value can differ from one power-up to the next, giving a failure that appears now and then. Note that an AND with one input at 0 correctly outputs 0, and this is not X-optimism.

Countermeasures

Registers used for control are given a reset so that their initial value is defined. Assertions are another method. An assertion states a condition that must hold, and a violation is reported. Here the condition is that the control signals are not X. Code can also be written so that the output becomes X when the condition is X. Some simulators have a mode that propagates X more strictly. Gate-level simulation can also be used as a check, although there X may spread too far instead.

Try it: questions about X-optimism

What is the main purpose of simulating the post-synthesis or post-layout gate-level netlist with delay information?

  1. ATo run many tests faster than RTL simulation
  2. BTo check issues invisible in RTL simulation, such as initialization or reset bugs, synthesis differences and delay-related problems
  3. CTo reduce circuit area
Show answer and explanation

Answer: B. To check issues invisible in RTL simulation, such as initialization or reset bugs, synthesis differences and delay-related problems

RTL simulation is fast but cannot reveal unknown-value problems hidden by X-optimism, or cases where synthesis produced a circuit different from the description. Gate-level simulation exercises the actual gates and flip-flops, and with each gate's and wire's delay supplied in SDF format, delay-related problems also show up. It is very slow, so it is generally run on a limited set of tests.

FAQ

How does it differ from X-pessimism?

The direction is opposite. X-optimism makes a value that should be unknown appear definite. X-pessimism turns even values that real hardware would resolve into X, and it tends to occur in gate-level simulation.

Does a real chip have a value called X?

No. A real signal is either 0 or 1 once it has settled. X is a value inside the simulation that means which of the two is not known.

Questions that mention X-optimism (1)

X-optimism appears in 2 practice questions across 1 topic, including HDL & Verification.

  1. In the code above, when sel is X, Verilog simulation selects b for y. Why is this a problem for verification?

Books on HDL & Verification Ad

As an Amazon Associate I earn from qualifying purchases.

This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.

Back to the glossary