Dimitry wrote

I came up with a Xor gate that ends up technically using 1 less nand than the example in the appendix, but I am not sure if this would translate to an optimized Xor in reality. I came up with this solution by working with the binary outputs of each gate backwords. Here is my Parts code:

PARTS:

Not(in=a, out=notx);

Not(in=b, out=noty);

Or(a=a, b=b, out=orbin);

Nand(a=notx, b=orbin, out=nandone);

Nand(a=noty, b=orbin, out=nandtwo);

Nand(a=nandone, b=nandtwo, out=out);

Does this mean I have a faster Xor gate because it uses less fundamental parts?

The speed of a part is the time it takes signals to traverse the longest path from an input to the output. When built out of Nand gates, Not takes one gate delay and or takes two gate delays.

The longest path through your Xor is:

Or(a=a, b=b, out=orbin);

Nand(a=notx, b=orbin, out=nandone);

Nand(a=nandone, b=nandtwo, out=out);

which totals 4 gate delays.

By using DeMorgan's law to change the And/Or structure in Figure 1.5 to Nand/Nand, Xor can be implemented with 3 gate delays.

--Mark