question about hdl syntax

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

question about hdl syntax

drobbins
Hey Folks,

Just getting going here, this looks like a great course.
Got a question though.
If you look at slide 14 on the pdf for chapter 1 they show the implementation and hdl code for an And gate.
the last parameter of the Nand gate:

out = x

seems backwards to me.
If the "action" in the implementation is progressing from left to right shouldn't x = out?
I'm trying to think of x as the value of a wire instead of a variable.
It just seems to me the value of the wire "x" should equal the value of the output pin "out"
Of course if I write the code the way that makes sense to me it doesn't work and if I write it like the pdf it works perfect.
Any ideas to help me get my head wrapped around this?

TIA
Dave  
Reply | Threaded
Open this post in threaded view
|

Re: question about hdl syntax

ybakos
I get what you're saying, but take a look at the appendix for the formal guide to the Hack HDL syntax.
Reply | Threaded
Open this post in threaded view
|

Re: question about hdl syntax

drobbins
Thanks for the quick feedback.
I read what you wrote in another post about thinking about things as wires not variables.
I'm trying  ;-)
I'll study the appendix more closely

Thanx
Dave
Reply | Threaded
Open this post in threaded view
|

Re: question about hdl syntax

cadet1620
Administrator
HDL is not a programming language; it is a Hardware Description Language. It tells how to connect the wires of a part together.

The "=" is not an assignment like you are used to seeing in a programming language. Rather, it is a wire connection. The name on the left of the "=" is always an I/O pin in the part being used. The name on the right is always an I/O pin or wire in the part being defined.

See this post.

Be sure to read the Hardware Construction Survival Kit.

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

Re: question about hdl syntax

drobbins
cadet1620 wrote
The name on the left of the "=" is always an I/O pin in the part being used. The name on the right is always an I/O pin or wire in the part being defined.
Thanks, that makes it clear

Dave