- Joined
- Sep 10, 2013
- Messages
- 7,944
- Helped
- 1,823
- Reputation
- 3,656
- Reaction score
- 1,808
- Trophy points
- 1,393
- Location
- USA
- Activity points
- 60,209
I'm not against simple stuff like that, but if you look up that notation (see the wiki page) the plethora of single characters that get attached to some signal leave the name nearly unreadable. I also upper case port names so they are immediately distinguishable from internal signals of a module. constants always have pUPPERCASE (parameter) or gUPPERCASE (generic). Chip pins always have i, o, or b on the end of the name. That makes it easy to know if you have the signal in the code somewhere you better deal with it properly.mrflibble said:for the "No Ukranian notation" XD, how do you handle things like active low, asynchronous, metastables, stuff like that? For example, for an async reset that's active low, I would use rst_async_n.
I actually use a separate module that has a synchronizer with a very distinctive name for the flip-flops and I've got all kinds of attributes on the reg declarations to make sure the FFs are located in the same slice/alm/etc.And for metastables, if they are part of the functionality, and it's important that I know it is metastable, then I use my_signal_meta for the metastable part, and my_signal after synchronization.
I agree with you about the writing it differently, I just like the lack of large white space in front of my lines of code. I could live with 4 spaces, but those that use 8??? an always block in my code is indented as it's inside a module so an "if" is another indent and the assignment is another indent...that's 24 spaces!!! :-OWell, it's 4 spaces over here. If I have to intend so much that I cannot read it anymore then that is a big hint that I should probably write it a bit differently.
The waterfall of nonsense characters of which you speak is indeed something I steer clear of. Maybe it had it's place eons ago for programming against windoze api's or something, but I don't see it being useful in the HDL area.I'm not against simple stuff like that, but if you look up that notation (see the wiki page) the plethora of single characters that get attached to some signal leave the name nearly unreadable. I also upper case port names so they are immediately distinguishable from internal signals of a module. constants always have pUPPERCASE (parameter) or gUPPERCASE (generic). Chip pins always have i, o, or b on the end of the name. That makes it easy to know if you have the signal in the code somewhere you better deal with it properly.
I actually use a separate module that has a synchronizer with a very distinctive name for the flip-flops and I've got all kinds of attributes on the reg declarations to make sure the FFs are located in the same slice/alm/etc.
Ouchie! Who the hell uses 8 spaces? In the past I've experimented a bit with indent size, and I found 4 to be a happy medium that works well (for me) for the various languages used.I agree with you about the writing it differently, I just like the lack of large white space in front of my lines of code. I could live with 4 spaces, but those that use 8??? an always block in my code is indented as it's inside a module so an "if" is another indent and the assignment is another indent...that's 24 spaces!!! :-O
PS: How is using pUPPERCASE (parameter) or gUPPERCASE (generic) not on the slippery Hungarian slope? The i, o, b at the end for chip pins indeed is useful.On that subject, what do you do for differential signals? MY_OUTPUT_SIGNALop and MY_OUTPUT_SIGNALon for the pos and neg output?
vead said:Top module:mc8051
there are many sub module
mc8051_acc
mc8051_alu
mc8051_pc
mc8051_port
Exceeding laziness is a Good Thing [tm].I'm exceedingly lazy and don't like to search all over the file to figure out if a signal is coming/going out of the module.
This is very recognizable. Did I mention shit tools yet? *scrolls up* So I did. Well, shit tools. They are the main reason for having to hunt through files in a way that is annoying. IMO there is nothing wrong with the following:Most of this just came about because months later I get asked to add something to my design and I pull up the code and found myself searching around the file over and over looking to see where some signal name is defined and if it's a reg/wire/port/parameter. Got tired of moving around the file so much I started adding "clues" to where something comes from. Nothing as crazy as Hungarian, but just some small number of general stuff... *_n for the oddball active low. _n/_p for those diff ports, i/o/b for I/O pins, pUPPERCASE for parameters, using the module name as the instance name with a _1/2/3/4 etc on the end of the name, easier to trace through your netlist when you have the module name and not something like inst_1.
Victory! I strive to have my name cursed a maximum of 12 times a day.mrfibble, we seem to have very similar coding standards that have been developed over many trials and tribulations. At the very least if I had to pick up code you left behind I wouldn't be cursing your name 20 times a day (been there, done that). ;-)
Exceeding laziness is a Good Thing [tm].
Regarding the instance names, do you also use module_name_1 even if there is just a single instance? If so, any particular reason? I tend to use module_name_inst when it's a single instance.
OMG! That's three extra characters! And two more than your previous naming convention. :-o
See the first line of your quote...all those extra characters to type is giving my carpal tunnels sympathy pains. ;-)
Seriously, it's just by habit from a company I worked years for that had a requirement that all instances be numbered even the singletons.
Do you remember what the rationale was behind this requirement? Right now I don't really see the benefit, but maybe I am missing something.
I think thats not enough information to write codeI only use the p so that I know at a glance it's a parameter or localparam and not a module port. I uppercase my port names so I immediately know that it's going in or out of the module. I'm exceedingly lazy and don't like to search all over the file to figure out if a signal is coming/going out of the module.
The i,o,b at the end was done because I don't like typing pin_module_port or ipin_module_port or opin_module_port, so instead I type MODULE_PORTi, MODULE_PORTo. And for those pesky differential ports MODULE_PORTo_n, MODULE_PORTo_p.
Most of this just came about because months later I get asked to add something to my design and I pull up the code and found myself searching around the file over and over looking to see where some signal name is defined and if it's a reg/wire/port/parameter. Got tired of moving around the file so much I started adding "clues" to where something comes from. Nothing as crazy as Hungarian, but just some small number of general stuff... *_n for the oddball active low. _n/_p for those diff ports, i/o/b for I/O pins, pUPPERCASE for parameters, using the module name as the instance name with a _1/2/3/4 etc on the end of the name, easier to trace through your netlist when you have the module name and not something like inst_1.
mrfibble, we seem to have very similar coding standards that have been developed over many trials and tribulations. At the very least if I had to pick up code you left behind I wouldn't be cursing your name 20 times a day (been there, done that). ;-)
There isn't really a good reason as I see to name all your submodules mc8051_<module_name>.
Having a simple acc module instantiated in your mc8051 module should be fine.
I don't know how to decide Input and output but I try
Top module:mc8051
there are many sub module
mc8051_acc
mc8051_alu
mc8051_pc
mc8051_port
question:- how to connect top module with other sub module
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?