SoC ์„ค๊ณ„/Verilog, SystemVerilog

Combinational Logic in Clock path

yztech 2025. 2. 1. 08:30
๋ฐ˜์‘ํ˜•

Issues with Combinational Logic in Clock Paths

Using combinational logic in clock signals (also known as "gated clocks") can lead to various issues in digital design. Below are the key problems and best practices.


๐Ÿšจ Issues with Combinational Logic in Clocks

1. Clock Skew & Timing Violations

  • Combinational logic delays the propagation of the clock signal.
  • Different parts of the circuit might receive the clock at different times, leading to hold and setup timing violations.

2. Glitches & Metastability

  • If the combinational logic changes asynchronously, it can cause glitches in the clock.
  • A glitchy clock can lead to metastability, making the design unpredictable.

3. Clock Gating Issues

  • Using combinational logic for clock gating (instead of a proper clock-gating cell) can cause:
    • Unintended clock pulses.
    • Unbalanced clock tree, leading to power and timing issues.

4. Increased Power Consumption

  • Combinational logic in the clock path prevents the synthesis tool from optimizing the clock tree properly.
  • This results in unnecessary power consumption due to unintended switching.

Best Practices

1. Use Clock Enable Instead of Gated Clocks

Instead of modifying the clock, use clock enable signals inside the flip-flop.

always @(posedge clk) begin
    if (enable)
        data_out <= data_in;
end

2. Use Synchronous Clock Gating

  • If clock gating is needed, use clock gating cells provided in standard cell libraries.
  • Example of a recommended clock gating approach:
    module gated_clock (
        input  logic clk,
        input  logic enable,
        output logic gated_clk
    );
        assign gated_clk = clk & enable;  // Not recommended for synthesis
    endmodule
    • This should be replaced with a proper clock gating cell in real ASIC/FPGA designs.

3. Keep Clocks in a Dedicated Clock Tree

  • Always route clocks through a dedicated clock distribution network rather than logic.
  • Use synthesis constraints to prevent logic in the clock path.

Summary

Issue Impact Solution
Clock Skew Setup/Hold violations Use dedicated clock routing
Glitches Unstable clock pulses Avoid combinational logic in the clock path
Clock Gating Issues Extra power consumption, timing issues Use clock enable signals or proper clock gating
Increased Power Consumption More switching activity Optimize with proper clock gating techniques

Using combinational logic in clock paths is generally not recommended due to these risks. Instead, use clock enables, synchronous logic, and dedicated clock gating cells for a robust and reliable design.

๋ฐ˜์‘ํ˜•