现在我正在努力实现时钟门控,如下所示。但我不明白为什么以及如何处理 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 ×1