Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 37 ยท Getting Started

What Is Verilog? Hardware Description Languages

Understand what Verilog and SystemVerilog are, how a hardware description language differs from software, and what a simulator and a synthesizer do with your code.

Verilog is a hardware description language (HDL). You use it to describe digital circuits: wires, gates, registers, counters and whole processors. Chip designers write Verilog, then tools turn that text into either a simulation (to check the behavior) or a real circuit on an FPGA or in silicon (a process called synthesis).

SystemVerilog is the modern superset of Verilog. It keeps everything you learn in this track's first chapters and adds cleaner syntax (logic, always_ff), interfaces, enumerations, structures and a large verification language. Almost every Verilog lesson here also applies to SystemVerilog.

What runs on this site. There is no Verilog simulator or synthesizer in your browser. Every Verilog listing in this track is shown read-only, and I only show simulator output when I am certain of it. To let you experiment, each lesson has runnable C stand-ins that model the same logic with bit operations. Those are labelled "stand-in" and are not Verilog. To run the real thing, use a free tool such as Icarus Verilog, Verilator or an online EDA playground.

Software versus hardware

A C program is a list of instructions that one processor executes one after another. A Verilog design is a description of structure and behavior that exists all at once. When you write two assign statements, you are not writing "do this, then that". You are describing two pieces of hardware that both operate continuously and in parallel.

VERILOG
assign sum   = a ^ b;   // an XOR gate, always active
assign carry = a & b;   // an AND gate, always active

These two lines produce two gates side by side. If a changes, both outputs react at the same moment. That parallelism is the first idea to absorb.

Idea Software Hardware description
Execution Statements run in order Blocks run concurrently
Time Not modeled Clocks and delays matter
Variables Memory locations Wires and flip-flops
Loops Repeat at run time Replicate hardware at build time
Result A program A circuit

What the tools do with Verilog

The same source file is read by different tools for different jobs.

  • Simulator. Runs your design (and a testbench) over simulated time and shows waveforms and printed messages. Examples: Icarus Verilog, Verilator, ModelSim/Questa, VCS, Xcelium.
  • Synthesizer. Converts the synthesizable subset of the language into gates and flip-flops for a target device. Examples: Yosys, Vivado, Quartus.
  • Linter and formal tools. Check style, find latches and prove properties.

Not everything in Verilog can become hardware. Constructs such as $display, #10 delays and initial blocks are meant for simulation and testbenches. Throughout this track I mark which parts are synthesizable and which are simulation only.

flowchart LR
  A["Verilog source<br/>(design + testbench)"] --> B["Simulator"]
  A --> C["Synthesizer"]
  B --> D["Waveforms and messages"]
  C --> E["Gate-level netlist"]
  E --> F["FPGA bitstream or chip layout"]

One source, two paths: check it in simulation, then build it.

A first look at Verilog

Here is a complete module that describes a 2-input AND gate. Read it as a black box with two inputs and one output.

VERILOG
module and_gate (
    input  wire a,
    input  wire b,
    output wire y
);
    assign y = a & b;
endmodule

Even in this tiny example you can see the key parts: a module with a name, a list of ports, and a body that describes behavior. Everything in Verilog is built from modules, which you will connect together in later lessons.

Stand-in: an AND gate truth table

The C program below is not Verilog. It models the same gate with the & operator and prints a truth table, the standard way to describe a combinational circuit.

C Stand-in: AND gate truth table in C

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

In Verilog the same & operator exists with the same meaning on single bits, and it also works bit by bit on wider values.

Where Verilog is used

  • FPGA design: prototypes, accelerators, video and signal processing, soft CPUs.
  • ASIC design: nearly all modern chips contain Verilog or SystemVerilog RTL.
  • Verification: SystemVerilog and the UVM methodology test those chips.
  • Education: computer architecture courses use Verilog to build CPUs.

Verilog, VHDL and SystemVerilog

Verilog and VHDL are the two classic HDLs. Verilog has a compact, C-like syntax and is common in industry, especially in the US and Asia. VHDL is more verbose and strongly typed. SystemVerilog (IEEE 1800) is the continuation of Verilog (IEEE 1364) and today's standard. In chapter 7 you will learn the SystemVerilog additions, and in chapter 8 how synthesis treats your code.

RTL: the abstraction level you will use

Most designs are written at the register-transfer level (RTL): you describe registers (flip-flops) and the combinational logic that computes the next values between them, clock edge by clock edge. RTL is high enough to be readable and low enough for tools to map to gates. Lower levels (gate and transistor) are rarely written by hand, and higher levels (behavioral models, C++ models) are used for exploration and verification.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does a Verilog design describe?

    An HDL describes hardware structure and behavior, and hardware blocks all work at the same time.
  2. 2. Which tool turns synthesizable Verilog into gates for an FPGA or chip?

    Synthesis maps the synthesizable subset of the language onto gates and flip-flops of a target technology.
  3. 3. Two assign statements in a module are executed:

    Each continuous assignment is always active, like a gate, so the order in the file does not matter.
  4. 4. What is SystemVerilog?

    SystemVerilog (IEEE 1800) extends Verilog with logic, always_ff, interfaces, classes and more.

Summary

  • Verilog is a hardware description language: you describe circuits, and the code has real parallelism.
  • Simulators check behavior over time; synthesizers turn the synthesizable subset into hardware.
  • SystemVerilog is the modern superset, and most of what you learn applies to both.
  • Most design work happens at the register-transfer level (RTL).
  • On this site Verilog is read-only; C stand-ins model the underlying logic.

Next: The Verilog Design Flow