D
David Antliff
Guest
I'm exploring the use of SystemVerilog in the context of OVM. I like
to create multiple source files, each dealing with a particular aspect
of the task at hand. I'm familiar with C-style #include & linker
mechanisms, and the Python package mechanism, but SV seems to provide
for both.
I'd like to know what the Best Practice is for managing this hierarchy
of files and layers. It seems to me that there are at least three
options:
1. files that refer to resources in other files simply `include what
they need. Seems to me that could lead to some horrendous 'compilation
unit' issues. A lot of the textbook examples use this system, but I
can't see it working well with large projects.
2. every file declares itself as a package, and other files import
those packages as they need to. However I believe a package
declaration is restricted to a single file, so that makes it difficult
to refactor a package into multiple files without making all of them
packages too.
3. a hybrid approach where a package is defined as being a certain
aspect of functionality, and if this involves multiple files then
these are `included but are not packages themselves. In OVM, such a
scheme might involve an Agent package containing one or more agents,
that `includes the constituent drivers, monitors, etc.
My chief concern is the scalability of these mechanisms. I want the
OVM structure to be as flexible and scalable as possible, so that new
OVC classes can be easily specialised and included with the top level
testbenches. If a particular specialisation is deemed suitable for the
main OVM framework, it would be good to have an easy way to add it to
the existing hierarchy.
What would you suggest?
to create multiple source files, each dealing with a particular aspect
of the task at hand. I'm familiar with C-style #include & linker
mechanisms, and the Python package mechanism, but SV seems to provide
for both.
I'd like to know what the Best Practice is for managing this hierarchy
of files and layers. It seems to me that there are at least three
options:
1. files that refer to resources in other files simply `include what
they need. Seems to me that could lead to some horrendous 'compilation
unit' issues. A lot of the textbook examples use this system, but I
can't see it working well with large projects.
2. every file declares itself as a package, and other files import
those packages as they need to. However I believe a package
declaration is restricted to a single file, so that makes it difficult
to refactor a package into multiple files without making all of them
packages too.
3. a hybrid approach where a package is defined as being a certain
aspect of functionality, and if this involves multiple files then
these are `included but are not packages themselves. In OVM, such a
scheme might involve an Agent package containing one or more agents,
that `includes the constituent drivers, monitors, etc.
My chief concern is the scalability of these mechanisms. I want the
OVM structure to be as flexible and scalable as possible, so that new
OVC classes can be easily specialised and included with the top level
testbenches. If a particular specialisation is deemed suitable for the
main OVM framework, it would be good to have an easy way to add it to
the existing hierarchy.
What would you suggest?