Altifigence Academy

12 / 37 · Concept

MUX verification: exhaustive tests and properties

Check combinational input coverage separately from storage behavior, and minimize counterexamples.

What will count as correct?

One-bit data a, b and select sel have eight combinations. At this size, checking every case is efficient. Exhaustively testing an entire width-W MUXMultiplexer A combinational circuit that connects one of several inputs to the output according to a select signal. Specify how select bits map to input numbers. Learn more takes 22W+12^{2W+1} combinations including select, so wider designs soon need another strategy.

For a width-W output, each bit follows

∀i∈{0,…,W−1},yi=s‾ai+sbi\forall i\in\{0,\ldots,W-1\},\quad y_i=\overline s a_i+s b_i

Choose stimuli for the faults you want to detect

Fault to checkUseful input or observation
Swapped a/b connectionsMake a and b different and compare sel=0 and 1
Reversed bit orderWalking-one patterns with one bit set
Stuck-at faultAll zeros, all ones and alternating patterns
Incorrect storage edgeChange inputs between edges and check that q holds
One-cycle latency errorMake expected values differ at consecutive edges

A large test count alone does not make verification effective. Be able to explain which faults each test detects.

The comparison below selects only cases where a and b differ. Each column is one test vector. The reversed selection expression produces the opposite of expected in all four columns.

Four combinations exposing reversed selection
View waveform data
Wave data: each character is one interval; a dot holds the previous state; p is a clock cycle.
SignalWaveBus values
a0.1.
b1.0.
sel0101
expected01.0
swapped bug10.1

Keep the reference model independent of the implementation

Copying DUT code can implement the same mistake twice. Generate expected values from the specified truth tableTruth table A table listing every possible input combination and its output. Changes over time are checked separately with waveforms. Learn more or indexed selection, and track q's earlier captured state separately. When a mismatch occurs, shorten the input sequence while preserving the failure, then explain the cause.

Instead of testing only final state, record actual value, expected value and inputs at every observation point. These records distinguish “the simulation ran” from “the specification was satisfied.”

Try it yourself

For an eight-bit MUX, you tested both select values only with a=0x00 and b=0xFF. Can this also detect reversed output bit order?

Read the explanation

No. Reversing the bit order leaves 0x00 and 0xFF unchanged. Choose position-sensitive patterns such as 0x01 and 0x02 and compare every output bit.

Your choice applies to this browser. Change it any time using the footer.