- Avoid more package references than needed
- Keep all objects and subprograms in the nearest possible scope
- Keep local objects invisible outside a package
- Transfer stable component declarations into components packages
- Re-use functionality of standard packages as much as possible
- Size of VHDL Units should be reasonable for synthesis
- A VHDL unit should not exceed 500 lines of code
- A process or subprogram should not exceed 100 lines of code
- Component instantiations should not exceed 4 levels of hierarchy
- An architecture should not contain more than 10 processes
- Structural and behavioral code should not be mixed
- Define project packages early in the project
- Hide old VHDL files
- Follow Naming conventions for VHDL units
- Follow Naming conventions for VHDL files
- Follow Naming conventions for VHDL objects
- Choose short instance names
- Keyword casing should be uniform in all VHDL code
- Use an intermediate signal for reading from an output port
- Self-defined conversion functions must assert un-mappable input values
- Use complex data types inside architectures
- Use a small number of self-defined global data types
- Insert test-enable for scan-test
- Use vector operations instead of loops
- Avoid unnecessary repetition of function calls
- Use efficient description for the wrap around of counters
- Build interface consistency checks into the model
- For soft-core development use generics, do not use constants
- A testbench has neither ports nor generics
- Variables of access types should be modified only in procedures defined in packages
- Use abstract, compact coding style in testbench and simulation models
- In case of accelerated simulation or emulation, the testbench must be synthesizable
- Stop the simulation from within the testbench
- Use assertion messages extensively
- Check the success of a read operation
- Use std.textio only, where really necessary
- Store file data to a VHDL variable, if read multiple times
- In association lists of subprogram calls use named association
- Indentation should be consistent in all VHDL code
- Align comments vertically
- Align declaration lists vertically
- Align association lists vertically
- Use closing labels for entity, architecture, process, loop, generate, etc.
- Indicate condition at remote ends of control structures (if ... then, case)
- Use one statement per line
- Group related constructs
- Group related port or signal declarations
- Switch constructs should not be nested to more than 4 levels
- Remove unnecessary code fragments
- Order of items should be the same in package header and body
- Use predefined attributes to make code generic and more re-usable
- Do not have code that have been commented out in checked-in versions
- Carefully use real values with PN-generators
- Be aware of operating-system-specific features
- Take care of array widths for std_logic_arith operators
- Use conversion functions around arithmetic operators
- Requirements for resource sharing
- EMC and transmission line effects need not be modeled
- Minimize the number of processes, signals, and signal assignments
- Replace signals by variables whenever possible
- Inhibit execution of statements where not necessary
- Divide large memories into blocks
- Avoid declaring constants within subprograms
- Always use deallocate(access_obj) to dereference allocated memory
- Use only well tested functions for object-initialization purposes
- Be aware of the use of the attributes DELAYED, STABLE, QUIET, and TRANSACTION
HDL Coding Guidelines - Part 7
Written by
Sunday, January 20, 2008
0
Hints
Your comments will be moderated before it can appear here. Win prizes for being an engaged reader.