Why my And HDL implementation is not working?

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

Why my And HDL implementation is not working?

hdllearn
I have used the Nand gate as primitive as indicated by the book that all should be built from the Nand gate.
Here is my HDL file: Please anyone Help.

// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken, MIT Press.
// File name: projects/1/And.hdl
/**
 * And gate:
 * if (a and b) out = 1, else out = 0
 * here a and b are 1 bit pins
 */
CHIP And {
    IN a, b;
    OUT out;
   
    PARTS:
    //// Replace this comment with your code.
    //// Function: if ((a==1) and (b==1)) then out = 1, else out = 0
    Nand (a=a, b=b, out=w1);
    Not (a=w1, out=out);
}
John
Reply | Threaded
Open this post in threaded view
|

Re: Why my And HDL implementation is not working?

dolomiti7
Have a look at what the Hardware simulator returns as error message in the status bar. Depending on your OS and Java version, the status bar might be hidden at startup. You may have to enlarge the window of the simulator manually downwards to make it visible.

In your case: there is no such thing as an input pin named "a" in the Not Chip.
See file Not.hdl
Reply | Threaded
Open this post in threaded view
|

Re: Why my And HDL implementation is not working?

hdllearn
In reply to this post by hdllearn
Thanks Dolomit. It's working now!!! Thanks a million!
John
John