internal pin naming conventions

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

internal pin naming conventions

ivan
I just completed project 1, and as I went through building the various chips, I found myself naming internal pins in a variety of ways, like a_or_b, aorb, orab, w1, sel101, sel00x, etc.

I even found that some of my chips got syntax erros if I used underscores in the names, whereas others did not.

What are the commonly used naming conventions for these?
Reply | Threaded
Open this post in threaded view
|

Re: internal pin naming conventions

cadet1620
Administrator
ivan wrote
I just completed project 1, and as I went through building the various chips, I found myself naming internal pins in a variety of ways, like a_or_b, aorb, orab, w1, sel101, sel00x, etc.

I even found that some of my chips got syntax erros if I used underscores in the names, whereas others did not.

What are the commonly used naming conventions for these?
The only documented characters that are legal for pin (wire) names are upper- and lower-case English alphabetic and numerals 0-9. Undocumented (aka BUG) '-' and '.' are allowed as second and following characters.

I name simple signals in lowercase, like the book uses for most I/O names.
For derived signals I usually use camelCaseNames that describe the derivation. For example
    Not(in=sel, out=notSel);
If the signal is a specific bit in a word I append the bit number.
    FullAdder(a=a[4], b=b[4], c=carry3, sum=out[4], carry=carry4);
Sometimes, for important parts like the DRegister in the CPU, I name the signals based on the part name:
    DRegister(in=dRegIn, load=dRegLoad, out=dReg);

Try to avoid names that are too similar.  In the ALU there are two functions Add and And.  I call the signals resulting from those operations 'and' and 'sum'.

And, alas, when I'm feeling lazy I use 'w1', 'w2' if they only connect from one line to the next line or two...

(I've never seen '_' work in a name.  If you still have an example of it working, I'd love to see it.)

--Mark