Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Systemverilog synthesizable Parameterized interfaces with modports;

1,239 views
Skip to first unread message

vijay

unread,
Dec 14, 2010, 11:07:49 PM12/14/10
to
I have an interface declaration as below
interface i #(parameter width=4);
logic [width:0] a;
modport out (output a);
modport in ( input a);
endinterface
//Now I want to create a module as follows
module b ( i#(.width(10)).in x, i#(.width(20)).out y);
assign y.a=x.a;
endmodule;

Compiling this with dc results in the following error message
test.sv:7: Syntax error at or near token '#'.

Any insight on what I am doing wrong and how to resolve this?
Regards
Vijay

Jonathan Bromley

unread,
Dec 15, 2010, 1:17:07 PM12/15/10
to

I don't think the language spec allows this.

You could try using a generic interface specification on
the ports:

module b (interface.in x, interface.out y);

and now you can hook the ports to any interface that has
modports "in" and "out", regardless of name or parameterization.
Of course it's now your responsibility to check that the actual
connected interface is appropriate, otherwise you'll get some
very strange error messages at elaboration time (or, worse,
very strange behaviour at runtime).

Interfaces really don't mix with any attempt to be rigorous
about data type. But that's a battle I almost certainly
have lost...
--
Jonathan Bromley

0 new messages