The following code snippet shows the sample code for modeling a clock gating library cell. The latch is transparent on clock low. The reason for using latch is to have glitch free gated clock. When clock is high, clock gating signal can't reach to the and gate, and therefore high pulse is always a full half a period.
if (~ck_in)
enable_l = enable;
assign ck_out = ck_in && enable_l;
If clock gating control logic (enable_1) is from a different clock domain, then it must be synchronized to ck before being fed into the latch.
In Figure below, the output of the latch can become metastable and causes potential glitch in the gated clock.

No comments:
Post a Comment