Problem with the ALU

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

Problem with the ALU

camelCase
ALU.hdl
Why do I get the error: Line 56 (The line after the "x+y if f" comment),
Can't connect part's output pin to gate's input pin?
Reply | Threaded
Open this post in threaded view
|

Re: Problem with the ALU

ybakos
I believe it's because false is not a 16-bit value, it is a single bit.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with the ALU

cadet1620
Administrator
In reply to this post by camelCase
Mux16(a=false, b=y2, sel=f, out=y_add);

Can't connect part's output pin to gate's input pin: load ALU.hdl
'_' is not a legal character in HDL names. You want to change "y_add" to "yAdd".

Why the strange error message?
The parser saw this as "out=y". "y" is the "gate's input pin" in the message.

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

Re: Problem with the ALU

camelCase
Thank you! You are right. After fixing a view little issues I finished my ALU!! Thank you for replying so fast! This book/course has a awesome community :)
Reply | Threaded
Open this post in threaded view
|

Re: Problem with the ALU

Mike2345
In reply to this post by ybakos
So how do we represent false as a 16 bit value
Reply | Threaded
Open this post in threaded view
|

Re: Problem with the ALU

WBahn
Administrator
As stated in A.5.3:

" The constants true and false may also be used as buses, in which case the required width is deduced implicitly from the context of the connection."
Reply | Threaded
Open this post in threaded view
|

Re: Problem with the ALU

Mike2345
So is there anyway to represent false as a 16 bit

On Sun, Oct 6, 2019, 12:41 AM WBahn [via Nand2Tetris Questions and Answers Forum] <[hidden email]> wrote:
As stated in A.5.3:

" The constants true and false may also be used as buses, in which case the required width is deduced implicitly from the context of the connection."



If you reply to this email, your message will be added to the discussion below:
http://nand2tetris-questions-and-answers-forum.32033.n3.nabble.com/Problem-with-the-ALU-tp4031419p4033721.html
To unsubscribe from Problem with the ALU, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: Problem with the ALU

WBahn
Administrator
As it says, the width of false and true, when used as buses, is determined by the width of the context in which they are used.

If you connect 'false' to an input pin that is 16-bits wide, then that particular 'false' is a sixteen-bit wide signal that is hard tied to a logic false.