NOT GATE HDL ERROR

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

NOT GATE HDL ERROR

zacharyross
* Not gate:
 * if (in) out = 0, else out = 1
 */
CHIP Not {
    IN in;
    OUT out;

    PARTS:
    // NAND(a=in, b=in , out=out)


I sim this HDL and get an error "Simulation error: The output file differs from the compare file"

I get a red error for the first line as 0 |  0

Green for                                      1 |   0
                                                   0 |  1

Anyone know why I run into this error between the compare and output file?



Reply | Threaded
Open this post in threaded view
|

Re: NOT GATE HDL ERROR

WBahn
Administrator
Because you don't have a valid implementation of a Not gate.

You have NO parts in your design -- the NAND that you have is commented out. In these tools, unused outputs are treated as 0, so your Not gate outputs a 0 all the time. The first test input (line 2) the input is a 0 so the output should be 1. But your chip outputs a 0 all the time, so you have a comparison failure on line 2.

Another problem you are going to have is that part names are case sensitive. So NAND is not the same as Nand.


Reply | Threaded
Open this post in threaded view
|

Re: NOT GATE HDL ERROR

zacharyross
 Ok I follow.

But are these not the parts of a not gate?

"NAND(a=in,b=in,out=out)"


"Another problem you are going to have is that part names are case sensitive. So NAND is not the same as Nand."
 
Could you elaborate on this more?



Reply | Threaded
Open this post in threaded view
|

Re: NOT GATE HDL ERROR

Renslay
Case sensitivity means the program differentiates between lower case and upper case letters. If you have a variable named "ABC", and a variable named "abc", and another one called "Abc", these are 3 different variables.

A chip named NAND is different than a chip named nand or a chip named Nand, and if you use the wrong one, the software won't find it.
Reply | Threaded
Open this post in threaded view
|

Re: NOT GATE HDL ERROR

WBahn
Administrator
In reply to this post by zacharyross
zacharyross wrote
But are these not the parts of a not gate?

"NAND(a=in,b=in,out=out)"
It would be, if it weren't in a comment (preceded by '//'). In your code, as posted, that entire line doesn't exist as far as the simulator is concerned.

"Another problem you are going to have is that part names are case sensitive. So NAND is not the same as Nand."
 
Could you elaborate on this more?
Upper and lower case letters are not the same thing, as far as the simulator is concerned, so a chip named "NAND" is as different from a chip named "Nand" as it is from a chip named "fred" or "bob". They are completely different and unrelated names.

If you remove the '//' from the commented out NAND part, you should discover that now the simulator complains about not being able to find the NAND part, or a mismatched name, depending on whether you are using the web-based or the desktop-based tools.