I made a Xor gate without using the example

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

I made a Xor gate without using the example

Dimitry
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?
Reply | Threaded
Open this post in threaded view
|

Re: I made a Xor gate without using the example

cadet1620
Administrator
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