修改状态机的缩进

时间:2018-04-19 00:15:01

标签: emacs verilog indentation system-verilog

有没有办法修改FSM状态的默认verilog模式缩进方案?

例如,默认的verilog-mode缩进方案如下所示,其中最后一个" end"与州名一致。

  //-------------------------------------------------
  //-- Device HW Configuration sub-routine
  //-------------------------------------------------
  HWADDR: begin
     register <= '{DC_WDEV_ADDR, 16'h0080, 1};   // Set Address = 0 upon Bus Reset, Bit[7] is device enable
     write    <= 1;
     start    <= 1;
     if (bus_done) begin
        start <= 0;
        st    <= MODE;
     end
  end
  MODE: begin
     register  <= '{DC_WMODE, 16'h0009, 1};      // Set Mode, Bit[3] = Interrupt Enable, Bit[0] = Soft Connect
     write     <= 1;
     start     <= 1;
     if (bus_done) begin
        start  <= 0;
        st     <= HWCFG;
     end
  end

我希望代码如下所示,其中&#34;开始和结束&#34;对齐。这样,州名更加突出。即使在VHDL中,这也是非常传统的缩进。

      HWADDR: begin
                 register <= '{DC_WDEV_ADDR, 16'h0080, 1};   // Set Address = 0 upon Bus Reset, Bit[7] is device enable
                 write    <= 1;
                 start    <= 1;
                 if (bus_done) begin
                    start <= 0;
                    st    <= MODE;
                 end
              end
      MODE: begin
               register  <= '{DC_WMODE, 16'h0009, 1};      // Set Mode, Bit[3] = Interrupt Enable, Bit[0] = Soft Connect
               write     <= 1;
               start     <= 1;
               if (bus_done) begin
                  start  <= 0;
                  st     <= HWCFG;
               end
            end

有一种简单的方法吗?

我可以使用空格键手动缩进,但如果我使用缩进区域或按TAB,则会返回第一个示例。

0 个答案:

没有答案