Simulator not computing Xor gate correctly?

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

Simulator not computing Xor gate correctly?

eggs
I'm trying to implement the Mux chip. On paper my implementation seemed to work fine, but it kept failing during the comparaison. I tracked the error down to a Xor chip that isn't working as it should. (see screenshot, the Xor chip is just passing input "a" to the output!). The Xor chip works fine in my DMux implementation. But just to be sure, I've removed my Xor implementation from the working directory and am using the built in Xor chip, but the same thing happens!

I've been playing around with this for 2 days now, any ideas?

Reply | Threaded
Open this post in threaded view
|

Re: Simulator not computing Xor gate correctly?

cadet1620
Administrator
There is a bug in the Hardware Simulator that causes it to behave strangely when there are unused internal pins. In this case, 'c1' is created but not connected to anything.

You can work around this bug while you are debugging your HDL by adding a line like
    Not(in=c1); // dummy connection

When you get your HDL passing the test you can remove these dummy lines and retest. If it then fails, look for the dangling connection.

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

Re: Simulator not computing Xor gate correctly?

eggs
Thanks for the reply.

Added a dummy Not gate, the exact same problem occurs.

I then removed the dummy Not gate, uncommented the 3 other gates from my code, and changed "out=out" to "out=c0" in the first And gate (ie. changed the code back to the entire implementation). Ran the test script, adding output for c0, c1, c2, and c3. This is the result:


Something really wonky appears to be going on, none of the first 3 gates in the code seem to be working at all? The Xor gate is acting differently than from before as well...
Reply | Threaded
Open this post in threaded view
|

Re: Simulator not computing Xor gate correctly?

cadet1620
Administrator
The HDL in this screen shot works for me. It even passes the Mux test! There must be a problem in one of the underlying chips.

Create a subdirectory and copy only Mux.hdl, Mux.tst and Mux.cmp into it.
Run the test, it should work.
Copy And, Or and Xor HDL files in one at a time running the test to determine which one is causing the problem. (I suggest that order since your Xor likely uses Or which may use And.)

If the test is still passing with after bringing in those HDL files, the problem must be in one of the HDL files they use.

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

Re: Simulator not computing Xor gate correctly?

eggs
Copied Mux.hdl and .tst to a new directory, still does the same thing.

In the interest of nobody (whether me or someone else) spending a bunch of time trying to figure this out, I'll just install the simulator on my laptop and assume my desktop is haunted.

Thanks for your help in confirming that I'm not just making some dumb scripting error and that there is in fact something wonky going on in the simulator!