
When to Use .sv vs. .svh
- Use
.svfor functional code that defines modules, interfaces, or testbenches. - Use
.svhfor reusable definitions or configuration that multiple.svfiles will include.
Practical Considerations
-
Avoid cyclic dependencies: Be cautious when including
.svhfiles to prevent circular inclusions. -
Organize headers logically: Keep macros and global parameters in
.svhfiles for consistency and maintainability. -
Simulator behavior: Some simulators might not distinguish between
.svand.svh, but following the convention makes your project more maintainable and readable. -
you must explicitly include
.svhfiles using the include directive, even if they are in the same directory as the.svfile. The SystemVerilog compiler does not automatically process.svhfiles unless they are explicitly included. This is because.svhfiles are considered header files, and they are not standalone compilable units like.svfiles.