Find an input on which a design and its rewrite give different outputs.
Two designs differ on an input when some pair of their outputs differs there, which is where the exclusive-or of that pair is 1. A path from the root of that exclusive-or's BDD to the terminal 1 is a cube: an assignment to some of the inputs. Every input that agrees with the cube is a counterexample, whatever the inputs the cube leaves free.
Design A computes y = p ^ q. Design B, a rewrite, computes y = p ^ q | p & q & r.
y = p ^ q
y = p ^ q | p & q & r
Their exclusive-or is p & q & r: B adds a term that is 1 only where p ^ q is 0, so the two differ exactly where that term is 1.
p & q & r
p ^ q
Its BDD has one path to the terminal 1, the cube p = 1, q = 1, r = 1. On that input A gives 0 and B gives 1.
p = 1, q = 1, r = 1
The cube sets every input, so this pair of designs has exactly one counterexample among the 8 inputs.
Design A returns y, the larger of two 4-bit numbers a and b. Design B is the same module as a colleague rewrote it. Both are shown in the work area, with the lines that differ marked.
y
a
b
Find an input on which the two designs give different outputs.
A value for each input port, as an unsigned whole number: a and b, each from 0 to 15. Bit 0 of the value is bit 0 of the port, so a 3-bit port set to 6 has bits 2 and 1 equal to 1 and bit 0 equal to 0.
a and b from 0 to 15.
The two designs' outputs differ on the input.
Watch the conditions: they check that each value fits its 4-bit port.
Press Try this input: it shows each design's output on your input, so you can see whether they differ before you submit.
Before you try, compare the conditions the two designs test, as the example compares the two expressions: look for inputs on which the conditions disagree.
Kata 6.1 of Binary Decision Diagrams with CUDD on formal.org. The site checks the answer when you press Check answer; sign in to keep your progress.