Verilog, VHDL and SystemVerilog
Digital hardware engineering relies on three primary Hardware Description Languages: Verilog, VHDL, and SystemVerilog.
All three languages describe identical digital logic gates, registers, and timing paths. This article compares their architectures and syntax implementations.
Verilog (IEEE 1364)
Phil Moorby and Prabhu Goel created Verilog in 1984 as an efficient logic simulation language. The IEEE standardized Verilog in 1995 (IEEE 1364-1995).
Verilog uses concise C-like syntax:
- Keywords
beginandendreplace C curly braces. - Control constructs include
if-elseandcasestatements. - Data types distinguish between continuous nets (
wire) and procedural variables (reg).
The Verilog-2001 standard (IEEE 1364-2001) added ANSI-style port lists, signed arithmetic operators, and multi-dimensional arrays. Verilog remains widespread in commercial ASIC design and open-source IP cores.
VHDL (IEEE 1076)
The United States Department of Defense commissioned VHDL in the early 1980s under the Very High Speed Integrated Circuits (VHSIC) program. The IEEE standardized VHDL in 1987 (IEEE 1076).
VHDL uses Ada-derived syntax with strict, static type safety:
- Strongly typed: The compiler prevents implicit type coercion between integers, bits, and arrays.
- Architecture separation: Divides designs into declarative
entityinterfaces and functionalarchitecturebodies. - High verbosity: Explicit syntax supports formal verification and documentation.
VHDL is the primary standard in European aerospace, defense, and safety-critical industries requiring DO-254 or ISO 26262 certification.
SystemVerilog (IEEE 1800)
SystemVerilog extends Verilog-2005 into an advanced unified design and verification language (IEEE 1800):
- Design Enhancements: Replaces
wireandregwith the unifiedlogicdata type. Introduces specialized procedural blocks (always_comb,always_ff,always_latch), user-defined structures, enumerations, and interface ports. - Verification Infrastructure: Adds object-oriented programming classes, constrained random stimulus, functional coverage, and SystemVerilog Assertions ($SVA$). SystemVerilog forms the basis of the Universal Verification Methodology (UVM).
Code Comparison: A Synchronous D Flip-Flop
Compare a D flip-flop with synchronous active-low reset across all three languages:
Verilog-2001 Implementation
`timescale 1ns / 1ps
`default_nettype none
module dff_v2001 (
input wire clk,
input wire rst_n, // Synchronous active-low reset
input wire d,
output reg q
);
always @(posedge clk) begin
if (!rst_n)
q <= 1'b0;
else
q <= d;
end
endmodule
VHDL-2008 Implementation
library ieee;
use ieee.std_logic_1164.all;
entity dff_vhdl is
port (
clk : in std_logic;
rst_n : in std_logic; -- Synchronous active-low reset
d : in std_logic;
q : out std_logic
);
end entity dff_vhdl;
architecture rtl of dff_vhdl is
begin
process(clk) is
begin
if rising_edge(clk) then
if rst_n = '0' then
q <= '0';
else
q <= d;
end if;
end if;
end process;
end architecture rtl;
SystemVerilog Implementation
`timescale 1ns / 1ps
`default_nettype none
module dff_sv (
input logic clk,
input logic rst_n,
input logic d,
output logic q
);
always_ff @(posedge clk) begin
if (!rst_n)
q <= 1'b0;
else
q <= d;
end
endmodule
The VHDL code requires explicit entity and architecture declarations. The SystemVerilog implementation replaces wire and reg with logic, and uses always_ff to ensure the synthesis tool infers flip-flops.
Rationale for Teaching Verilog-2001
This course teaches Verilog-2001 for three pedagogical and technical reasons:
- Universal Tool Support: Every commercial and open-source toolchain (including Icarus Verilog and Yosys) supports Verilog-2001 without compatibility limitations.
- Synthesizable Subset Understanding: SystemVerilog RTL is a direct refinement of Verilog-2001. Learning Verilog builds the foundation for SystemVerilog.
- Hardware Concept Clarity: Learning the explicit difference between
wire(continuous physical net) andreg(procedural variable assignment) prevents common RTL modeling misunderstandings.
Module 9 covers the transition to SystemVerilog constructs.
Language Comparison Matrix
| Metric | Verilog-2001 | VHDL-2008 | SystemVerilog |
|---|---|---|---|
| IEEE Standard | IEEE 1364-2001 | IEEE 1076-2008 | IEEE 1800-2017 |
| Syntactic Lineage | C | Ada | C with extensions |
| Primary Domain | Commercial ASIC/FPGA RTL | Aerospace, defense, safety-critical RTL | Modern ASIC design and UVM verification |
| Type Enforcement | Weak | Strong | Moderate |
| Open-Source Support | Icarus Verilog, Verilator | GHDL | Partial (Verilator, Icarus) |
Practice Exercises
Problem 1
Write a 4-bit synchronous binary counter in Verilog-2001, rewrite it in SystemVerilog, and identify the syntactic differences.
Solution
Verilog-2001:
`timescale 1ns / 1ps
`default_nettype none
module counter_v2001 (
input wire clk,
input wire rst_n,
output reg [3:0] count
);
always @(posedge clk) begin
if (!rst_n)
count <= 4'd0;
else
count <= count + 4'd1;
end
endmodule
SystemVerilog:
`timescale 1ns / 1ps
`default_nettype none
module counter_sv (
input logic clk,
input logic rst_n,
output logic [3:0] count
);
always_ff @(posedge clk) begin
if (!rst_n)
count <= 4'd0;
else
count <= count + 4'd1;
end
endmodule
Syntactic differences:
- SystemVerilog unifies
wireandreginto thelogicdata type. - SystemVerilog uses
always_ff @(posedge clk)to declare sequential intent. The synthesized gate netlist is identical.
The next article examines the essential mindset for RTL design: thinking in concurrent physical hardware rather than sequential software execution.