Project 1: Nand outputs 1 with inputs of a=1 b=1

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

Project 1: Nand outputs 1 with inputs of a=1 b=1

gaudetmi
I just unzipped the files, I haven't messed around with any of the classes or anything. I tried the very first exercise, and I'm finding that my Nand chip is outputting a 1 when the inputs are 1,1. Strangely this doesn't happen when the Nand chip is used by itself. Is this a bug with the hardware simulator?

Nand by itself outputs 0 with inputs of 1 and 1. Okay, no problem.

Nand by itself.


I added a Not gate after it, and now for some reason the nand gate outputs 1.

Nand outputting 1 with inputs of 1 and 1

Did I miss something? Am I misunderstanding how this is supposed to work?
Reply | Threaded
Open this post in threaded view
|

Re: Project 1: Nand outputs 1 with inputs of a=1 b=1

cadet1620
Administrator
I don't think that this relates to your bug, but you must never change the IN and OUT line in any of the supplied HDL files. The pin names in those lines are the chip's contract. It's what other chips and the test files expect those names to be.

After you changed the a and b inputs, was the eval (calculator) button enabled?  There are some strange bugs, including the eval button sometimes not being enabled, that occur when you try to use chips that you haven't built yet.

For instance, if you have not built the Not chip, there is a Not.hdl prototype file in your nand2tetris/01 directory that has no implementation in its PARTS section.  

This is why you need to build the parts in the order listed in the book: Not, And, Or, Xor, etc. Each chip you build adds more chips to the "toolkit" you can use to build the next chip.

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

Re: Project 1: Nand outputs 1 with inputs of a=1 b=1

gaudetmi
Thanks for your (super quick) help, Mark--you've resolved my issue!

You are also correct that the eval button was not enabled prior to the second screenshot.

I changed the OUT line back to the original "OUT=out", and then built and tested the Not chip in the Project 1 folder. My Nand gate is now returning the correct value.



Just out of curiosity I changed the OUT back to "output" to see what impact that was having on my reported issue. The Nand gate returned the correct output value, but testing the script resulted in an "Unknown variable: out" error. Good to know.

Thanks again.