What SystemVerilog Adds to Verilog
Understand the role of SystemVerilog and select useful features for RTL design and verification.
An extension of Verilog
SystemVerilog builds on Verilog with richer types, more precise procedural blocks, interfaces, and a complete set of verification features. A .sv file can contain synthesizable RTL, a testbench, or both.
The language does not change the nature of hardware design. You still describe a circuit, manage data widths, separate combinational and sequential logic, and check timing. Its main benefit is clearer intent and more opportunities for tools to report mistakes.
A small RTL module
module event_counter #(
parameter int unsigned WIDTH = 16
) (
input logic i_clk,
input logic i_rst,
input logic i_event,
output logic [WIDTH-1:0] o_count
);
always_ff @(posedge i_clk) begin
if (i_rst)
o_count <= '0;
else if (i_event)
o_count <= o_count + 1'b1;
end
endmodulelogic replaces the old reg usage here. always_ff states that the block describes flip-flops. The parameter has a type and its value must be unsigned.
These keywords cannot make a design correct by themselves. They do give the compiler more information. For example, a tool can reject a variable written by an always_ff block if another block also writes it.
Two sides of the language
The most useful RTL additions include:
logicand better-defined integer types;always_comb,always_ff, andalways_latch;typedef, enumerations, structures, and arrays;- packages, interfaces, and modports;
- value and type parameters.
For verification, SystemVerilog provides:
- classes and objects;
- constrained randomization;
- temporal assertions;
- functional coverage;
- communication mechanisms between tasks.
Classes, randomization, and coverage normally describe testbench behavior rather than hardware.
Keep a clear boundary
A sound project separates synthesizable RTL from verification code. RTL should use a controlled set of constructs supported by the synthesis tool. The testbench can use richer language features to generate cases, observe the DUT, and check results.
This boundary prevents a common mistake: assuming that every simulatable construct can become hardware. The synthesis tool documentation remains the reference for the supported subset.
Key points
- SystemVerilog includes Verilog and adds RTL and verification features.
- Specialized blocks and types make intent easier to check.
- Simulatable code is not always synthesizable.
- The
.svextension normally enables SystemVerilog parsing. - RTL and testbench code are easier to maintain when separated.
📝 Test your knowledge - Chapter quiz