Comparison Failure for "AND" gate

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

Comparison Failure for "AND" gate

mohamad.ismail




Please help. what am i missing here? why is there a comparison failure?

Also, which line is line 5 exactly?
Reply | Threaded
Open this post in threaded view
|

Re: Comparison Failure for "AND" gate

WBahn
Administrator
This post was updated on .
You should have two files in your run folder named And.out and And.cmp. The first is the file that your gate produced and the second is the comparison file provided by the authors.

Post the contents of those files and we can take a better look.
Reply | Threaded
Open this post in threaded view
|

Re: Comparison Failure for "AND" gate

mohamad.ismail
Thank you WBahn. This is my first time ever posting on a forum and I really do appreciate you taking the time to help. Please find attached:

Reply | Threaded
Open this post in threaded view
|

Re: Comparison Failure for "AND" gate

WBahn
Administrator
If you look at your .out file, you see that the output is always 0, regardless of the input.

So that's a clue.

Your And gate uses a Nand gate and a Not gate.

The Nand gate, of course, in the intrinsic building block.

Have you implemented and tested your Not gate? If so, did it pass?

Is the Not.hdl file in the same folder as the And.hdl file you are trying to test?
Reply | Threaded
Open this post in threaded view
|

Re: Comparison Failure for "AND" gate

mohamad.ismail
Can't believe I missed that... understood.

I did not implement or test the Not gate yet... Thank you for the clue. I will work on that.  
Reply | Threaded
Open this post in threaded view
|

Re: Comparison Failure for "AND" gate

mohamad.ismail
And yes - to your question - the Not.hdl is in the same folder as the And.hdl
Reply | Threaded
Open this post in threaded view
|

Re: Comparison Failure for "AND" gate

WBahn
Administrator
In reply to this post by mohamad.ismail
Since the intent is that you move from nothing but Nand gates (and, later, D-type flip flops) to a (nearly) full-up computer, you need to implement each item using only previously-implemented items. If you do things in the order that they are presented in the chapter, this should take care of itself.

The authors do provide a mechanism for skipping things by letting you force the simulator to use built-in versions of gates. This happens when the simulator looks for a gate in the current folder and fails to find it. But since the authors also provide skeleton implementations of all the gates, the simulator will always find those .hdl files unless you move them or rename them.

Unfortunately, the current simulator treats a skeleton file improperly (in my view). At the very least, it should throw an error if an output is used that is not driven by something within the file. But, as it stands, it treats such undriven outputs as being 0, which leads to the behavior you experienced.
Reply | Threaded
Open this post in threaded view
|

Re: Comparison Failure for "AND" gate

mohamad.ismail
In reply to this post by mohamad.ismail
WBahn, thank you for the support and prompt. Just clicked in. feels great. Appreciate you.