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 8-Bit Adder: One Stage

Verilog Static Timing Analysis

An 8-bit adder between two register stages; the carry chain limits the clock to about 2.95 ns

Open in IDE
design.v
module add1 (input clk, input [7:0] a, b, output reg [8:0] s);
  reg [7:0] ra, rb;
  always @(posedge clk) begin ra <= a; rb <= b; s <= ra + rb; end
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 1.2 [get_ports clk]
set_input_delay  0.1 -clock clk [get_ports {a[*] b[*]}]
set_output_delay 0.1 -clock clk [get_ports {s[*]}]

# Exercise: raise the period until the worst setup slack is positive (the smallest period is the period minus the worst slack).
Admin mode — edit and delete controls are visible on each row. Use the IDE to add new snippets via File → Save as Snippet.