Ready-to-run snippets

Code Examples

Ready-to-run Verilog, SystemVerilog, and UVM examples. Click any to open it live in the IDE.

← All examples

STA Clock Gate: Gating Check

Verilog Static Timing Analysis

An AND gate in the clock path with the enable from a rising-edge flip-flop violates the gating hold check

Open in IDE
design.v
module sta_gate (input clk, a, d, output q);
  reg en, r;
  always @(posedge clk)
    en <= a;
  wire gclk = clk & en;
  always @(posedge gclk)
    r <= d;
  assign q = r;
endmodule
constraints.sdc
# Run synthesis first, then STA. With PRO you can edit this file and run STA again without synthesis,
# and pick another library and corner in the drop-down.
create_clock -name clk -period 2.0 [get_ports clk]
set_input_delay  0.4 -clock clk [get_ports {a d}]
set_output_delay 0.4 -clock clk [get_ports q]

# Exercise: change the enable flip-flop in design.v to always @(negedge clk) and run again.
Admin mode — edit and delete controls are visible on each row. Use the IDE to add new snippets via File → Save as Snippet.