Chap 1 Comparison Failure

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

Chap 1 Comparison Failure

JWal
I am attempting to build a And Gate and when I run the test script i am getting a comparison error at 3. Can anyone provide some insight?

Here my code. (I am using the provided test script)

CHIP And {
    IN a, b;
    OUT out;

    PARTS:
    Not(in = a, out = nota);
        Not(in = b, out = notb);
        Nand(a = nota, b = notb, out= out);
}
Reply | Threaded
Open this post in threaded view
|

Re: Chap 1 Comparison Failure

cadet1620
Administrator
JWal wrote
I am attempting to build a And Gate and when I run the test script i am getting a comparison error at 3. Can anyone provide some insight?
Look at the inputs, expected output and your output.  For line 3 you see that a=0, b=1, and the expected output is 0.

Your circuit computes ~a NAND ~b = 1 NAND 0 = 1, so it fails.

Note that you can hit the step button when a line fails to continue the test. Comparing the expected and actual outputs for later test lines may give you more clues.

Specifically for the And, note that the Nand is an And followed by a Not. How would you undo that Not?

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: Chap 1 Comparison Failure

JWal
Thank you for the speedy response, I really appreciate it.
I finally figured it out. Thank you for your help.