繁体   English   中英

需要帮助关闭端口列表中信号后重新对齐注释。 (Verilog的模式)

[英]Need Help Turning off re-align comments after signals in port list. (Verilog-Mode)

这是我的问题,我将端口列表定义为:

module spi_jstk ( 
                  input        clk,     // System Clock (40MHz)
                  input        reset,   // Async Reset
                  input        START,   // Initialize SPI Transfer
                  input [39:0] DATA,    // Input Data to Transfer
                  input        SS,      // Chip Select
                  output       SCLK,    // Serial Clock
                  input        MISO,    // Master In Slave Out
                  output       MOSI );  // Master Out Slave In

看起来很不错。

现在让我说我在这个列表中添加一个新信号,或者只是点击TAB,这就是:

module spi_jstk ( 
                  input        clk, // System Clock (40MHz)
                  input        reset, // Async Reset
                  input        START, // Initialize SPI Transfer
                  input [39:0] DATA, // Input Data to Transfer
                  input        SS, // Chip Select
                  output       SCLK, // Serial Clock
                  output       NEW, // NEW SIGNAL
                  input        MISO, // Master In Slave Out
                  output       MOSI );  // Master Out Slave In

不知道为什么它对我的评论这样做,有谁知道我如何关闭它? 它真的很令人沮丧。

另一件我不明白的事情是,如果我在常规信号列表(而不是端口列表)中点击TAB,它就不会弄乱我的评论。 选项卡后这些注释保持对齐。

   // Signals
   reg [2:0]  q_state, n_state;
   reg        q_clk;
   reg        q_sck;    //1 MHz ticks
   reg [7:0]  q_mosi;   //1 MHz ticks  
   reg [7:0]  q_miso;   //1 MHz ticks

任何人都知道如何解决这个问题? 谢谢。

这似乎是auto-lineup行为的副作用。 Ch v verilog-auto-lineup enter的文档描述了该行为

Type of statements to lineup across multiple lines.
If 'all' is selected, then all line ups described below are done.

If 'declarations', then just declarations are lined up with any
preceding declarations, taking into account widths and the like,
so or example the code:
    reg [31:0] a;
    reg b;
would become
    reg [31:0] a;
    reg        b;

If 'assignment', then assignments are lined up with any preceding
assignments, so for example the code
    a_long_variable <= b + c;
    d = e + f;
would become
    a_long_variable <= b + c;
    d                = e + f;

然而,在这个过程中它似乎删除了代码和注释之间的额外空格,我找不到一种方法来防止它搞乱评论(你可能想向其维护者报告一个错误做Mx verilog-submit-bug -report RET )。 一种选择可能是通过自定义变量verilog-auto-lineup来禁用此行为。 有几种方法可以做到这一点

1)您可以使用emacs的自定义UI来执行此操作。 只做Mx自定义变量RET verilog-auto-lineup RET 并为变量选择所需的值。

2)您可以在init文件中添加以下内容之一

(setq verilog-auto-lineup nil)  ;; disable completely

(setq verilog-auto-lineup 'assignment)  ;; disable only for declarations

暂无
暂无

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

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