I guess your interface does not contain internal signals of the DUT. Right?
If you want to connect your SV interface you to your DUT and maybe your TB you have to modle it correctly, i.e.
interface add_sub_if(input bit clk):
logic [7:0] a,
logic [7:0] b,
logic doAdd,
logic [8:0] result
);
This interface assumes that clk is input to all modules/units connected to.
Check the direction of the variables in the clocking block. All inputs to the DUT are outputs in the clocking block and outputs of the DUT are inputs to the clocking block.
As the other poster (Chris?) suggested - your interface code looks incorrect to me. Ideally it should have global signals such as clk, reset as inputs and rest all as internal signals within the interface. But what you have written doesn’t surprise me at all - many noivce users, first comers do this. This is why we developed some cool apps to automate this SV Interface creation given a RTL block. See http://verifworks.com/products/dvcreate-svi/
We also have TCL based apps to run with Xilinx and others, drop me an email srini @ cvcblr if interested.
the SV standard knows one SV interface construct only. See chapter 3.5 in the standard.
The most simple, but often used, definition looks like this (copied from the standard:
interface simple_bus(input logic logic clk);
logic req, gnt;
logic [7:0] addr, data;
logic [1:0] mode;
logic start, rdy;
endinterface: simple_bus
It starts with the keyword interface and may hav arguments. In this case it is clk.
Inside the definition there is a list of all variables belonging to this interface.
There is know data direction, because the interface might be connected to at least two blocks. In one of the block the variable might be an input and in the other one an output.
If you want to connect a module to variables internal to the DUT you can use the SV-bind construct. But this is not an SV interface.
What i meant was that, if the interface has all the signals in the portlist, i can just bind it with the .* notation, even if the interface needs to be bound to a submodule. The same cannot be achieved with the std/recommended interface(i might be wrong). You would either need to create a module to help with the bind or use hierarchical references for alias connections.
In reply to justrajdeep:
Hi Rajdeep,
the SV standard knows one SV interface construct only. See chapter 3.5 in the standard.
The most simple, but often used, definition looks like this (copied from the standard:
interface simple_bus(input logic logic clk);
logic req, gnt;
logic [7:0] addr, data;
logic [1:0] mode;
logic start, rdy;
endinterface: simple_bus
It starts with the keyword interface and may hav arguments. In this case it is clk.
Inside the definition there is a list of all variables belonging to this interface.
There is know data direction, because the interface might be connected to at least two blocks. In one of the block the variable might be an input and in the other one an output.
If you want to connect a module to variables internal to the DUT you can use the SV-bind construct. But this is not an SV interface.
I see your point, but fundamentally interfaces are supposed to be abstracting individual signals at the bare minimum - in your case it is not doing that. The instantiation is little verbose for a legacy RTL, but then can easily be automated. See what our recently released open-source Go2UVM (www.go2uvm.org) apps generated:
// Generating SystemVerilog interface for module: sprot
// ---------------------------------------------------------
// Using VW_CLK as a text macro for clock
// If your clock signal is named other than clk, change the macro below
`define VW_CLK clk
interface sprot_if (input logic `VW_CLK);
logic a;
logic b;
logic rst_n;
logic start;
logic prot_err;
logic xfer_end;
// End of interface signals
// Not showing modport/clocking blocks/assertions
The input to this DVC_Go2UVM app is your RTL top level, in this example it looks like this:
In reply to justrajdeep:
The standard/recommended way of interface definition works well for internal modules too - can you elaborate where it suffers?
Srini www.go2uvm.org
How can you bind an interface to RTL and hook up all the signals, unless they are all defined as ports? example please