A
Andrew FPGA
Guest
Hi,
I'm trying to use the SystemVerilog interface construct to connect my
class based testbench environment to the instantiation of the device
under test. As I understand it, this is a classic use of the SV
interface construct, since I have seen several examples in Chris
Spears SV for verification book and read the Jonathon Bromley/mentor
graphics paper discussing some of the problems with SV interfaces. My
problem is, the examples in Chris Spears book are simplified to the
point where the scoping issues are unclear.
Where/how do I define the dut interfaces in such a way that they can
be shared(used) by the module instantiating the dut and in my class
based testbench environment?
My first attempt was to define the interfaces inside a package, and
then import the package into the module instantiating the dut, and
importing the package into a driver class that drives the dut pins. Of
course this is illegal, since interfaces cannot be defined inside a
package, they can only be defined inside a compilation unit, module,
or another interface.
Presumably I need to define the interfaces in a compilation unit (i.e.
a file). But then how do I include this in other files? If defined
like this, do they have global scope? Maybe this question has nothing
to do with interfaces - it might be I just dont understand SV
compilation units and scoping issues properly yet. I also have a
problem where I define a class in one file, then in another file I try
to declare and construct an object of that class, but it errors saying
its an unknown type....
I'm an experienced VHDL guy, learning SV for the first time. Modelsim
Questa 6.3. The dut is VHDL.
Regards
Andrew
I'm trying to use the SystemVerilog interface construct to connect my
class based testbench environment to the instantiation of the device
under test. As I understand it, this is a classic use of the SV
interface construct, since I have seen several examples in Chris
Spears SV for verification book and read the Jonathon Bromley/mentor
graphics paper discussing some of the problems with SV interfaces. My
problem is, the examples in Chris Spears book are simplified to the
point where the scoping issues are unclear.
Where/how do I define the dut interfaces in such a way that they can
be shared(used) by the module instantiating the dut and in my class
based testbench environment?
My first attempt was to define the interfaces inside a package, and
then import the package into the module instantiating the dut, and
importing the package into a driver class that drives the dut pins. Of
course this is illegal, since interfaces cannot be defined inside a
package, they can only be defined inside a compilation unit, module,
or another interface.
Presumably I need to define the interfaces in a compilation unit (i.e.
a file). But then how do I include this in other files? If defined
like this, do they have global scope? Maybe this question has nothing
to do with interfaces - it might be I just dont understand SV
compilation units and scoping issues properly yet. I also have a
problem where I define a class in one file, then in another file I try
to declare and construct an object of that class, but it errors saying
its an unknown type....
I'm an experienced VHDL guy, learning SV for the first time. Modelsim
Questa 6.3. The dut is VHDL.
Regards
Andrew