I don't quite understand that syntax of HDL

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

I don't quite understand that syntax of HDL

Jeff22
I've read over chapter one tons of times and checked out the powerpoints but I just don't understand the syntax of HDL. I understand the
CHIP: "Whatever Name"{
header, and the
PARTS: "Whatever parts"
parts listing, but when I get to the actual writing I just don't get it.
For a NAND gate I tried
Not(a OUT = nota);
Not(b OUT = notb);
And(a, b, OUT = out);
}
But that doesn't work. So, any help with this language's syntax you can provide would be of great help.
Also, what does the author mean when he refers to multibits? I don't get if they're just a list of inputs in an order like
a,[0],a[1],a[2],a[3],etc or if they're a multiple bit number, like.
a = 0001000110101100
Reply | Threaded
Open this post in threaded view
|

Re: I don't quite understand that syntax of HDL

cadet1620
Administrator
Jeff22 wrote
I've read over chapter one tons of times and checked out the powerpoints but I just don't understand the syntax of HDL.
You also need to read Appendix A.  It starts with an example HDL file.

You are not writing a program; you are describing a circuit diagram.  The PARTS: lines describe the connections of wires between parts used to build the circuit.
        SomePart(ioPinName1=wireName1, ioPinName2=wireName2, ... );

Multi-bit buses are multi-wire cables.  The [] selects which wire(s) in the cable you are referring to.
Helpfu HDL philosophy should help you too.

--Mark

[edit: I guess you've read Appendix A since this is in the Appendix A sub-forum; I need more coffee this morning. --M]
Reply | Threaded
Open this post in threaded view
|

Re: I don't quite understand that syntax of HDL

Jeff22
Okay, so I understand the multibit part now, thanks for that, but I'm still not quite getting the syntax. This stuff may just be too high level for me, I'm 14, but if you could reword what you've said to be a bit more detailed and comprehensive, that would be awesome... sorry if this message sounded rude in any way, that isn't my intention, I'm just a bit thick skulled :P
Reply | Threaded
Open this post in threaded view
|

Re: I don't quite understand that syntax of HDL

cadet1620
Administrator
Jeff22 wrote
Okay, so I understand the multibit part now, thanks for that, but I'm still not quite getting the syntax. This stuff may just be too high level for me, I'm 14, but if you could reword what you've said to be a bit more detailed and comprehensive, that would be awesome... sorry if this message sounded rude in any way, that isn't my intention, I'm just a bit thick skulled :P
I think it's great that your tackling this (on your own?) at 14. You should become a registered forum user so you can exchange private mail with other forum members. We can give you more direct help than we might want to post in the forums.

Think about having two physical Integrated Circuits (ICs), one is a NOT chip and the other is an AND chip. We want to solder wires to these chips to make a NAND circuit. There are also 3 special wires that connect to other parts of the machine that we're building: two of them, 'a' and 'b', supply the signals we're supposed to NAND together, and the other one, 'out', is where we're supposed to deliver the answer.

The NOT IC has four pins: pin1 is the input to the gate, pin2 is the output, pin3 and pin4 are the power supply pins. (In HDL we don't need to worry about power.)

The AND IC has 5 pins: pin1 and pin2 are its inputs, pin3 is its output, pin4 and pin5 are its power supply pins.

Let's start soldering wires to the parts. We need to connect the 'a' and 'b' wires to the AND IC's inputs and a red wire to its output.

    AND(pin1=a, pin2=b, pin3=red);
The parameters to AND() are simply a list of which pins of the AND IC are connected to which wires. Now we need to connect the NOT IC to the red and 'out' wires and the circuit is done.
    NOT(pin1=red, pin2=out);
For TECS the chips use descriptive names for their I/O connections instead of pin numbers, and it is better to uses descriptive names for the connecting wires rather than colors. This can get confusing when the chips you're using as parts have the same I/O names as the part you are designing:
    Swapper(a=b, b=c, out=out);
The Swapper chip's I/O pin 'a' is connected to wire 'b'. Swapper I/O pin'b' is connected to wire 'c'. I/O pin 'out' is connected to the 'out' wire. The trick is to remember that the name on the left of the '=' refers to the pin you're connecting to and the name on the right refers to the wire.

Keep asking questions. I'm an ex-teacher; you'll get tired of me before I get tired of you 8^)

--Mark

Reply | Threaded
Open this post in threaded view
|

Re: I don't quite understand that syntax of HDL

Jeff22
Wow, that was really good! I think I really understand it now! So then, just to verify, each chip has a set number of pins, and the names of those pins are identified in the PARTS: section, correct? Okay then, so now, how do I write a multi-bit input? ( At least that's what I think it's called ) Would it be something like
IN a[16],b;
OUT out;
In order to make 16 possible values for a?
Reply | Threaded
Open this post in threaded view
|

Re: I don't quite understand that syntax of HDL

Patrick
Yes, that would be it.