- 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
Re: verilog code for microcontroller
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.