Now I'm tying to implement the clock gating as the below. but I can't understand why and how do I handle the De signal?
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
but I want to know if I use without else statement then what happens? can I use without the else statement?
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
end
endmodule