veripool / verilog-mode

Verilog-Mode for Emacs with Indentation, Hightlighting and AUTOs. Master repository for pushing to GNU, verilog.com and veripool.org.
http://veripool.org/verilog-mode
GNU General Public License v3.0
253 stars 90 forks source link

Question: Module port list using AUTOARG cant pass an Interface #1646

Closed veripoolbot closed 4 years ago

veripoolbot commented 4 years ago

Author Name: Vinit Shah Original Redmine Message: 3209 from https://www.veripool.org


Hi,

I am trying to pass interfaces across modules. Modules are using AUTOARG to populate inputs, outputs and inouts in the module port list. I tried doing the same for Interfaces. It didnt work. I tried using AUTOINOUTMODPORT. It didnt work.

Can you point me to an example on the site (if this is supported)?

Also how can I declare interfaces automatically for modules using AUTOINST and passing interfaces across them?

Thanks

veripoolbot commented 4 years ago

Original Redmine Comment Author Name: Wilson Snyder (@wsnyder) Original Date: 2020-01-26T02:10:17Z


There's an example on the [[Faq]]. Beyond that I'm not sure what you are trying to do so would need an example.

veripoolbot commented 4 years ago

Original Redmine Comment Author Name: Vinit Shah Original Date: 2020-01-26T02:44:11Z


Adding Example

Issue 1


interface calc_if (
input clk, input rst
);

logic add_sub;
logic [3:0] num1;
logic [3:0] num2;
logic [4:0] num3;

modport master (
output add_sub,
output num1,
output num2,
input num3
);

modport slave (
input add_sub,
input num1,
input num2,
output num3
);

endinterface

// Above code is part of an include file (calc_if.sv)

`include "calc_if.sv"
module top (/*AUTOARG*/);

calc_if.slave dut_calc_if;

dut DUT_INST (/*AUTOINST*/
               // Interfaces
               .dut_calc_if (dut_calc_if)
               // Inputs
               .dut_clk (dut_clk),
               .dut_rst (dut_rst)
              );

module dut (/*AUTOARG*/
             dut_clk,
             dut_rst
             );

Question : For both modules (top and dut) will the AUTOARG automatically populate the interface in the port list? Am I missing something or this is incorrect?

If you have a solution can you point to me the FAQ?

Issue 2


// Interface declaration
calc_if dut1_to_dut2_calc_if();

dut1 DUT (/*AUTOINST*/
           // Interfaces
           .dut1_to_dut2_calc_if (dut1_to_dut2_calc_if),
          --- Other ports ---
           );

dut2 DUT (/*AUTOINST*/
           // Interfaces
           .calc_if (dut1_to_dut2_calc_if),
          --- Other ports ---
           );

Does the above interface declaration need to be added explicitly? Is there any AUTO function that allows to do this?

Thanks

veripoolbot commented 4 years ago

Original Redmine Comment Author Name: Wilson Snyder (@wsnyder) Original Date: 2020-01-27T13:58:40Z


For both modules (top and dut) will the AUTOARG automatically populate the interface in the port list? Am I missing something or this is incorrect?

No because it doesn't know if the interface is for connection or for a port. Use ANSI style ports instead with input/output/interfaces in the module (...) instead of using AUTOARG.

Does the above interface declaration need to be added explicitly? Is there any AUTO function that allows to do this?

Using ANSI as above should make this work.