简体   繁体   English

在 verilog 模式下使用 AUTOINST 时如何不分离输出和输入

[英]How to no separate into Output and Input when using AUTOINST with verilog-mode

For InstModule like this对于像这样的 InstModule

        module InstModule (
           input i1,
           output [31:0] o1,
           input i2,
           output [31:0] o2);
        endmodule

verilog-mode will expand it verilog-mode 将扩展它

           InstModule instName
             (/*AUTOINST*/);

into this进入这个

           InstModule instName
             (/*AUTOINST*/
          // Outputs
          .o1           (o1[31:0]),
          .o2           (o2[31:0]),
          // Inputs
          .i1           (i1),
          .i2           (i2));

However, I hope it can be like this.但是,我希望它可以是这样的。 Just like declaration order and not separate into two groups.就像声明顺序一样,不分成两组。

           InstModule instName
             (/*AUTOINST*/
          .i1           (i1),
          .o1           (o1[31:0]),
          .i2           (i2),
          .o2           (o2[31:0]));

Is there a setting of verilog-mode I can rely on?是否有我可以依赖的 verilog 模式设置?

or is there a way I can modify verilog-mode.el to achieve this?或者有没有办法修改 verilog-mode.el 来实现这个?

I searched https://veripool.org/verilog-mode/help/ and verilog-auto-inst-sort isn't what I need.我搜索了https://veripool.org/verilog-mode/help/并且 verilog-auto-inst-sort 不是我需要的。

It changes the order in Outputs and Inputs list, but still separate into two groups.它改变了输出和输入列表中的顺序,但仍然分成两组。

Did some further research and find out it might be something with interface from system-verilog.做了一些进一步的研究,发现它可能与 system-verilog 的接口有关。

    module_a U_A(/*AUTOINST*/);
        
    interface_io U_IF(clk);
    interface interface_io;
        modport A(
            input i1 ,
            output [31:0] o1
        );  
        modport B(
            input i2 ,
            output [31:0] o2
        );  
    endinterface

However, it results in this, similar to implementation in 2010 https://github.com/veripool/verilog-mode/issues/270然而,它导致了这个,类似于 2010 年的实施https://github.com/veripool/verilog-mode/issues/270

    module_a U_A(/*AUTOINST*/
         // Interfaces
         .U_IFA         (U_IFA.A),
         .U_IFB         (U_IFB.B));

I was expecting something like this, which is what I want.我期待这样的事情,这就是我想要的。

    module_a U_A(/*AUTOINST*/
         // U_IFA Interface
          .i1           (i1),
          .o1           (o1[31:0]),
         // UIFB Interface
          .i2           (i2),
          .o2           (o2[31:0]));

TL:DR Someone is already trying to add this feature, just wait. TL:DR有人已经在尝试添加此功能,请稍等。

Someone already created an issue asking the exact same question.有人已经创建了一个问题,询问完全相同的问题。

https://github.com/veripool/verilog-mode/issues/1745 https://github.com/veripool/verilog-mode/issues/1745

The contributor's answer as followed.贡献者的回答如下。

No, because the // Input and // Output comments are "magic" so they need to be in that order.不,因为 // Input 和 // Output 注释是“神奇的”,所以它们需要按此顺序排列。 Sorry.对不起。

According to this answer, the best result I can expect would be like this.根据这个答案,我能期望的最好结果是这样的。

    module_a U_A(/*AUTOINST*/
         // U_IFA Interface
           // Inputs
          .i1           (i1),
           // Outputs
          .o1           (o1[31:0]),
         // UIFB Interface
           // Inputs
          .i2           (i2),
           // Outputs
          .o2           (o2[31:0]));

Another people also created a similar issue, saying he/she would give it a try to add this feature.另一个人也创建了一个类似的问题,说他/她会尝试添加这个功能。 I'll count on him/her.我会指望他/她。

https://github.com/veripool/verilog-mode/issues/1816 https://github.com/veripool/verilog-mode/issues/1816

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM