小编gra*_*er3的帖子

我是否需要在连续的always 块中使用else 语句?

现在我正在努力实现时钟门控,如下所示。但我不明白为什么以及如何处理 De 信号?

module ClockGating( 


           input wire rst_n,
           input wire clk,
           input wire De,  
           input wire InReg,

           output reg OutReg

   );

   always @( posedge clk or negedge rst_n )
     begin
     if ( !rst_n ) begin   
            OutReg <= 0;
     end
     else begin
        if ( De ) begin
               OutReg  <= InReg;
            end
        else
               OutReg  <= OutReg;
     end
   end

endmodule
Run Code Online (Sandbox Code Playgroud)

但我想知道如果我使用不带 else 语句会发生什么?我可以在没有 else 语句的情况下使用吗?

module ClockGating( 


           input wire rst_n,
           input wire clk,
           input wire De,  
           input wire InReg,

           output reg OutReg

   ); …
Run Code Online (Sandbox Code Playgroud)

verilog

5
推荐指数
1
解决办法
5245
查看次数

标签 统计

verilog ×1