My TB is in VHD and I created a bfm(mdio_phy) in verilog as follows:
*************************************
interface mdio_if;
logic clk;
logic nRst;
logic mdio;
endinterface:mdio_if
There are no ports in your interface, so there are no ports to connect when you instantiate the interface
Code:
interface mdio_if;
logic clk;
logic nRst;
wire mdio; // needs to be a wire to be connected to an inout port.
endinterface:mdio_if
//Interface instance
mdio_if ports_if (); // empty port list
//module instance
mdio_phy phy(.mdclk(ports_if.clk),.nReset(ports_if.nRst),.mdio(ports_if.mdio) ); // hierarchical references to signals inside the interface.
Alternatively, you could change your interface definition to have ports
And then the interface instantiation you wrote would work. In both case, the connections to the interface are the same as if the interface was defined as a module.
Second solution seems to have syntax error and I am getting error for that.
As I told you that my top TB is in VHDL so I don't think taking an instance of interface at top will work. That's why I was taking intance of interface inside mdio_phy module and from there I was doind port map to the ports coming through mdio_phy module and from here only I will pass this interface handle to other classes.
Regards,
Ashish
- - - Updated - - -
Hi Dave,
Second solution was perfect. I had to add ; after the brace and it worked. Thanks a lot.