Coding Style Guidelines - VHDL & Verilog
Coding Style Guidelines - VHDL & Verilog
r_ and w_ prefix
This is the second most important style you need to use. Indicating if your signal is a register or a wire is hugely important
Search nandland.com:
to writing good code. Verilog is nice in that it forces you to declare your signal as a reg or a wire, but VHDL has no such
Custom Search requirement! Therefore this style is especially important for VHDL coders. All signals declared with r_ should have initial
Search conditions. All signals declared with w_ should never appear to the left hand side of an assignment operator in a
sequential process (in VHDL) or a clocked always block (in Verilog). Examples: r_Row_Count, w_Pixel_Done.
The rule you should be following is this: All registers (as identified by r_ prefix) should always have an initial condition
applied to them. No wires (as identified by w_ prefix) should EVER have an initial condition applied to them. When you
simulate your design, all signals should be a nice happy green before the simulation even starts. If this is true, you will be
much happier.
The above guidelines are what I've adopted over many years of Digital Design. I do these things because I find them very
beneficial to the quality and speed of my work.