Skip to content
Tutorials Center
My learning

Topics

Lesson 2 of 37 Β· Getting Started

The Verilog Design Flow: From Idea to Chip

Walk through the hardware design flow: specification, RTL coding, simulation, synthesis, place and route, timing and programming an FPGA, and how to install free tools.

Writing Verilog is only one step of making hardware. A design goes through a repeatable flow, and knowing the stages tells you why certain rules exist: why a #10 delay is allowed in a testbench but not in a design, or why a clock must reach every flip-flop. This lesson walks the flow for an FPGA and notes where an ASIC differs.

The stages

The hardware design flow

Specify Inputs, outputs, behavior
Write RTL Verilog modules
Simulate Testbench and waveforms
Synthesize Gates and flip-flops

Fix bugs early: simulation is cheap, hardware is not

1 / 2
  1. Specification. Decide what the block does: ports, widths, reset behavior, timing in clock cycles. Draw a block diagram. A thirty-second sketch saves hours of rewrites.
  2. RTL coding. Write modules in Verilog describing registers and combinational logic.
  3. Simulation. Write a testbench that drives inputs and checks outputs. Run it, read waveforms, fix bugs. Most bugs are found here.
  4. Synthesis. The tool reads the synthesizable subset and produces a netlist of gates, lookup tables (LUTs) and flip-flops. It reports warnings such as unintended latches.
  5. Implementation (place and route). For an FPGA the tool assigns logic to physical cells and routes wires between them.
  6. Timing analysis. Static timing analysis checks that every path from one flip-flop to the next finishes within one clock period. If not, you must change the design or lower the clock.
  7. Programming and testing. A bitstream is loaded into the FPGA and you test on the board. For an ASIC, the equivalent steps end in layout, signoff checks and fabrication.

RTL versus gate-level simulation

You normally simulate RTL (fast, readable). Before signoff, teams may also simulate the gate-level netlist with real delays to catch issues RTL cannot show. A mismatch between the two is often caused by code that simulates one way but synthesizes another, such as a missing sensitivity item or reading an uninitialized reg.

Typical project layout

A small project folder might look like this:

TEXT
counter/
  rtl/counter.v          design source (synthesizable)
  tb/counter_tb.v        testbench (simulation only)
  constraints/board.xdc  pin assignments and clock definition
  Makefile               compile and run commands

Keep design and testbench in separate files. The testbench is never synthesized.

Free tools

You do not need a license to start.

  • Icarus Verilog (iverilog) compiles and runs Verilog; a typical session is iverilog -g2012 -o sim counter.v counter_tb.v then vvp sim.
  • GTKWave displays the .vcd waveform file your testbench dumps.
  • Verilator turns SystemVerilog into fast C++ models and is also a strong linter.
  • Yosys is an open source synthesizer; with nextpnr it supports several FPGA families.
  • Vendor suites (Vivado, Quartus, Libero) are free for small devices.

None of these run here, so treat the commands above as reference. They are widely documented, and a one-line command is usually all it takes.

Stand-in: the cost of finding a bug late

The C program below is not Verilog. It is a small model of a rule of thumb: a bug found in a later stage costs far more to fix. The numbers are illustrative assumptions of mine, not measurements.

C Stand-in: relative cost of a late bug (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.

The point is not the exact numbers: it is why thorough simulation matters, and why chapters 5 and 8 spend so much time on testbenches and verification.

Anatomy of a simulation run

When you run a simulator, it works in time steps. At a given simulated time it evaluates every block whose inputs changed, schedules the resulting updates, and moves to the next time. A testbench provides the clock and stimulus; the simulator advances time until the testbench calls $finish. You will see exactly how this scheduling works when you meet blocking and non-blocking assignments in chapter 4.

Because everything is event driven, an idle design costs almost nothing to simulate, and a design where a signal toggles every picosecond costs a great deal. That is one reason testbenches use a sensible clock period such as 10 ns.

Check your understanding

Quick check Β· 4 questions

of 4 answered You scored / 4 Β· perfect!

  1. 1. Which stage checks that signals travel between flip-flops within one clock period?

    Static timing analysis examines every register-to-register path against the clock period.
  2. 2. Where do bugs get fixed most cheaply?

    Simulation lets you change text and rerun in seconds; later stages cost much more.
  3. 3. Which file is never synthesized?

    A testbench uses simulation-only constructs such as delays and $display and is not part of the hardware.
  4. 4. What does place and route do on an FPGA?

    Implementation maps the netlist onto the chip's resources and connects them.

Summary

  • The flow is specify, write RTL, simulate, synthesize, place and route, check timing, program.
  • Most bugs should be caught in simulation, using a separate testbench.
  • Synthesis uses only the synthesizable subset; timing analysis checks every clock period.
  • Free tools (Icarus Verilog, GTKWave, Verilator, Yosys) cover the whole beginner path, though none run on this site.

Next: Your First Verilog Module