Warm tip: This article is reproduced from serverfault.com, please click

How to get declaration order AUTOINST with emacs verilog-mode?

发布于 2020-12-10 16:42:51

When using vim autoinstantiation, I get an AUTOINST in declaration order as shown. But, I need to use emacs AUTO_TEMPLATE for multiple instantiations, so I am trying to use "emacs --batch file.v -f verilog-batch-auto". Unfortunately, this is giving a sorted order. How can I get this declaration order AUTOINST using emacs verilog-mode?

DWC_mipi_dsi_host i_DWC_mipi_dsi_host_left
    (/*AUTOINST*/
      //APB Interface
    .presetn                        (presetn                                              ), // input 
    .pclk                           (pclk                                                 ), // input 
    .paddr                          (paddr[9:0]                                           ), // input 
    .penable                        (penable                                              ), // input 
    .psel                           (psel                                                 ), // input 
    .pwrite                         (pwrite                                               ), // input 
    .pwdata                         (pwdata[31:0]                                         ), // input 
    .prdata                         (prdata[31:0]                                         ), // output
    .interrupt                      (interrupt                                            ), // output
      //DPI INTERFACE
    .dpipclk                        (dpipclk                                              ), // input 
    .dpivsync                       (dpivsync                                             ), // input 
    .dpihsync                       (dpihsync                                             ), // input 
    .dpipixdata                     (dpipixdata[`DSI_HOST_PIXELDATAWIDTH-1:0]             ), // input 
    .dpidataen                      (dpidataen                                            ), // input 
    .dpishutdn                      (dpishutdn                                            ), // input 
    .dpicolorm                      (dpicolorm                                            ), // input 
    .dpiupdatecfg                   (dpiupdatecfg                                         ), // input 
    .edpihalt                       (edpihalt                                             ), // output

According to the documentation at http://doc.endlessparentheses.com/Fun/verilog-auto-inst.html it seems I need to use verilog-auto-arg-sort:nil and verilog-auto-inst-sort:nil

I have tried to set them in ~/.emacs and in the bottom of the file, but there is no difference. Any ideas?

// Local Variables:
// verilog-library-flags:("-f ../src/files.vc")
// verilog-auto-arg-sort:nil
// verilog-auto-inst-sort:nil
// End:
Questioner
Omnivore
Viewed
0
Omnivore 2020-12-22 00:03:21

As it turns out, this is due to an older version of verilog-mode which came preinstalled with emacs.

emacs Verilog --> Version and FAQ
You are using verilog-mode 2017-08-07-c085e50-vpo-GNU

This can be fixed by updating verilog-mode according to instructions at https://www.veripool.org/wiki/verilog-mode