RE: [sv-bc] Interfaces in port lists

From: Brad Pierce <Brad.Pierce@synopsys.com>
Date: Fri Sep 17 2010 - 17:27:23 PDT

See

   http://www.eda.org/svdb/view.php?id=905
   http://www.eda.org/svdb/view.php?id=2502

And what would be the fully qualified interface-type of port "bot.ifc3" in the following example?

interface IFC1#(parameter type T = logic);
  wire [$bits(T)-1:0] w_in, w_out;
  assign w_out = w_in;
endinterface

interface IFC2#(parameter type T = logic)(IFC1 ifc1);
  wire [$bits(T)-1:0] w_in, w_out;
  assign ifc1.w_in = w_in;
  assign w_out = ifc1.w_out;
endinterface

interface IFC3#(parameter type T = logic)(IFC2 ifc2);
  wire [$bits(T)-1:0] w_in, w_out;
  assign ifc2.w_in = w_in;
  assign w_out = ifc2.w_out;
endinterface

module test#(parameter N = 8)(input [N-1:0] in, output [N-1:0] out);
  typedef struct packed {logic [N-1:0] f;} T1;
  typedef struct packed {T1 f;} T2;
  typedef struct packed {T2 f;} T3;
  IFC1#(T1) ifc1();
  IFC2#(T2) ifc2(ifc1);
  IFC3#(T3) ifc3(ifc2);
  bot#(N) bot(ifc3, in, out);
  initial begin
    force in = 8'b11110000;
    #1 $displayb(out);
  end
endmodule

module bot#(parameter N=6)(IFC3 ifc3,
                           input [N-1:0] in, output [N-1:0] out);
  assign ifc3.w_in = in;
  assign out = ifc3.w_out;
  initial begin
    force in = 8'b11110000;
    #1 $displayb(out);
  end
endmodule

-----Original Message-----
From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of Maidment, Matthew R
Sent: Friday, September 17, 2010 5:12 PM
To: SV_BC List
Cc: james@keithan.com; neil.korpusik@oracle.com
Subject: RE: [sv-bc] Interfaces in port lists

Dave replied to the same thread started elsewhere:

http://verificationguild.com/modules.php?name=Forums&file=viewtopic&p=18772

--
Matt Maidment
mmaidmen@ichips.intel.com
 
>-----Original Message-----
>From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of Neil
>Korpusik
>Sent: Friday, September 17, 2010 4:40 PM
>To: SV_BC List
>Cc: james@keithan.com
>Subject: [sv-bc] Interfaces in port lists
>
><forwarding bounced email from james@keithan.com>
><Was originally posted to sv-ec - redirecting to sv-bc>
>
>-------- Original Message --------
>Date: Thu, 16 Sep 2010 08:17:54 -0500
>From: Keithan <james@keithan.com>
>To: "sv-ec@eda.org" <sv-ec@eda.org>
>Subject: Interfaces in port lists
>
>
>Folks,
>   A question about parameterized interfaces in a module port list.
>   It is my understanding that the following is the SV way to use
>   interfaces in module port lists:
>
>   interface A #( int unsigned WIDTH = 32);
>     logic[WIDTH-1:0] a;
>     logic[WIDTH-1:0] b;
>     modport o_a(
>        output a,
>        input  b);
>     modport i_a(
>        input  a,
>        output b);
>   endinterface
>
>   module B (interface b); // this works
>     // use example
>     initial b.a <= 1;
>     initial b.c <= 0; // this will compile?
>   endmodule
>
>   module C (A#(16) c); // This does not compile
>   //
>   endmodule
>
>The question is, why can't you declare an interface
>[and parameter] [and modport]
>in the port list directly? It is a fully qualified type. The corollary
>doesn't this introduce virtual interfaces into modules? Is this good?
>
>How does the compiler resolve interface pin references (ex. b.a)
>with just the 'interface' type? Doesn't this only get resolved
>at load time?
>
>My objective here is to use interfaces in module port lists
>to simplify connections and catch directional issues early,
>through the use or modports. It does not seem that is the case
>with the 'interface' key word.
>
>James Keithan
>
>
>
>
>
>--
>This message has been scanned for viruses and
>dangerous content by MailScanner, and is
>believed to be clean.
-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Fri Sep 17 17:27:44 2010

This archive was generated by hypermail 2.1.8 : Fri Sep 17 2010 - 17:30:17 PDT