ALU - Can't connect gate's output pin to part

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

ALU - Can't connect gate's output pin to part

bizobo
Hey All,

I keep getting this error message for various lines in my code (tried commenting some out to see if it would compile / see what other errors would pop up). I have a feeling this is an HDL syntax issue but I'm stuck trying to figure out what I'm doing wrong.

I'll show you one example below, which has to do with calculating the "ng" output (so don't read ahead if you don't want to see my possibly wrong implementation of this!).









//"zr" and "ng" creation; need to conduct comparisons for out==0, out<0
//"ng" creation

Mux(a=false, b=true, sel=out[0], out=ng);

//If the left-most bit is 0 then out is positive, so ng must be 0. Else 1.

This is the first place in my code when I get the "can't connect gate's output pin to part" error. I also get it in the code I wrote to deal with constructing "zr." ng and zr are the last portions of my ALU code, so it seems as though everything above compiles correctly.

Thanks for your help!
Reply | Threaded
Open this post in threaded view
|

Re: ALU - Can't connect gate's output pin to part

cadet1620
Administrator
As the error message says, you can't connect a pin declared in the chip's OUT section to a part's input.

What you can do is to connect a part's output to more than one pin:
    Somepart (..., out=out, out=x);
    Anotherpart (in=x, ...);
See Appendix A.5.2 to see how this works with buses.

WARNING! Hardware hardware bit 0 is the least significant bit.

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

Re: ALU - Can't connect gate's output pin to part

bizobo
Tried your multiple out fix but still getting the same problem. :(

Will address the most/least significant bit issue after I resolve this syntax question.

Any further ideas?

And thanks for your help, Mark. Your posts are always valuable, and I've benefited greatly even from ones you've made years ago. Thanks for taking the time to help!
Reply | Threaded
Open this post in threaded view
|

Re: ALU - Can't connect gate's output pin to part

bizobo
Also I may be getting confused by which chip you mean when you say,

"you can't connect a pin declared in the chip's OUT section to a part's input"

To clarify, I added the statement "out=out," to the lines affected so that the new code reads:


Mux(a=false, b=true, sel=out[0], out=out, out=ng);

thanks!

Reply | Threaded
Open this post in threaded view
|

Re: ALU - Can't connect gate's output pin to part

cadet1620
Administrator
In reply to this post by bizobo
If you are still getting the "Can't connect gate's output pin to part" message, then you have not created the extra out= connection, or you are not using the internal wire you also connected to the output.

You must do this on the part that generates the ALU's output, i.e., the part that has the  "out=out" connection. This part will need some more "out=" connections so that you can create the status signals. One of the additional connections can directly connect to the ng output; you don't need any extra logic for ng.

[Your followup just came in]

You don't want to add "out=out" to the errant lines.  You need to change what's connected to sel from "out[0]" to an internal wire.

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

Re: ALU - Can't connect gate's output pin to part

bizobo
YEEEEEEAH!

I did it! Yeah! I did it!

Oh my god you guys that felt so good to see "End of script - Comparison ended successfully"

YES!!!!!!!

And thanks Mark! Thanks for the tip re: most/least significant. I was thinking of how the first value in an array in the languages I've studied is [0], and "first" means left-most. Flipped in HDL.