简体   繁体   English

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

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

Here's my problem, I define a port list as so: 这是我的问题,我将端口列表定义为:

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

Looks quite nice. 看起来很不错。

Now lets say I add a new signal to this list or just hit TAB and this is what happens: 现在让我说我在这个列表中添加一个新信号,或者只是点击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

Not sure why it did this to my comments, anyone know how I turn off this? 不知道为什么它对我的评论这样做,有谁知道我如何关闭它? Its really frustrating. 它真的很令人沮丧。

Another thing I don't understand is that if I hit TAB on a list of regular signals (not in a port list) it doesn't mess with my comments. 另一件我不明白的事情是,如果我在常规信号列表(而不是端口列表)中点击TAB,它就不会弄乱我的评论。 These comments stay aligned after 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

Anyone know how can I fix this? 任何人都知道如何解决这个问题? Thanks. 谢谢。

This seems to be a side-effect of auto-lineup behavior. 这似乎是auto-lineup行为的副作用。 The documentation of Ch v verilog-auto-lineup enter describes the behavior 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;

However it seems in this process it deletes the extra spaces between the code and the comments, I could not find a way to keep it from messing up with comments (you may want to report a bug to its maintainers do Mx verilog-submit-bug-report RET ). 然而,在这个过程中它似乎删除了代码和注释之间的额外空格,我找不到一种方法来防止它搞乱评论(你可能想向其维护者报告一个错误做Mx verilog-submit-bug -report RET )。 One option might be to disable this behavior by customizing the variable verilog-auto-lineup . 一种选择可能是通过自定义变量verilog-auto-lineup来禁用此行为。 There are a couple of ways to do so 有几种方法可以做到这一点

1) You can use emacs' customize UI for doing so. 1)您可以使用emacs的自定义UI来执行此操作。 Just do Mx customize-variable RET verilog-auto-lineup RET . 只做Mx自定义变量RET verilog-auto-lineup RET And select the desired value for the variable. 并为变量选择所需的值。

2) You can add one of the following to your init file 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