I'm writing the hdl code for a DMux based on the Nand2Tetris course.
CHIP DMux {
IN in, sel;
OUT a, b;
PARTS:
And(a = sel, b = in, out = b);
Not(in = sel, out = selNot);
And(a = in, b = selNot, out = a);
}
For some reason, this code fails on the test script values of in = 1 and sel = 0
. It evaluates a
and b
both to 0 in this case.
I have written out the gates multiple times, and I can't figure out why the result is not a = 1 and b = 0
Can someone explain to me what is happening?