I am trying to implement clock gating logic manually using a latch and an AND gate as shown in the figure.
The latch has an enable (en) and a done signal which are both asserted only for one clock cycle. When the en is asserted, the output of the latch (latch_en) needs to be a one until reset(done) is asserted. When the done signal is asserted the output of the latch needs to be a zero until en is asserted again. The latch is transparent on the negative half of the clock (clk).
Images below show the waveforms for the behavior of the latch from RTL simulation and post synthesis gate level netlist simulation. I am using Synopsys DC for performing synthesis. I am using Modelsim for simulation. Additionally, for synthesis, we are using TSMC 28 nm technology.
The RTL simulation before synthesis works as expected.
Issue description
The gate level netlist simulation after synthesis does not work as expected. The latch_en is high only for the negative half of the clk during which the latch is transparent. It does not continue to hold the signal value.
The following is my SystemVerilog RTL for the clock gating unit:
module latch_clkgating (
input logic clk,
input logic en,
input logic done,
output logic gated_clk);
logic latch_en;
always_latch begin
if(~clk) begin
if(done)
latch_en <= 0;
else if (en)
latch_en <= 1;
end
end
assign gated_clk = clk & latch_en;
endmodule
What can be done to get the expected behavior of the latch post synthesis?


