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

PD: 32-bit Adder, One Stage

Verilog Physical Design

A 32-bit adder between input and output registers (97 flip-flops). In the lab flow it misses 6 ns and closes at 7 ns with a setup margin.

Open in IDE
design.v
module add32 (
  input             clk,
  input      [31:0] a,
  input      [31:0] b,
  output reg [32:0] s
);
  reg [31:0] ra, rb;

  always @(posedge clk) begin
    ra <= a;
    rb <= b;
    s  <= ra + rb;
  end
endmodule
constraints.sdc
# Synthesis STA constraints. Place and Route takes its clock period from the panel (try 6 ns and 7 ns).
create_clock -name clk -period 7 [get_ports clk]
set_input_delay  1.0 -clock clk [get_ports {a* b*}]
set_output_delay 1.0 -clock clk [get_ports {s*}]
Admin mode — edit and delete controls are visible on each row. Use the IDE to add new snippets via File → Save as Snippet.