Home / Learn Verilog / Verilog Cheat Sheet

Verilog Cheat Sheet

One page you can print.

In shortOne page you can print.

What's actually going on

Cheat sheetsyntaxoperatorsproceduraltestbench
Cheat sheet

In plain terms

Syntax you use most, on one printable page.

Why we use it

Quick lookup saves time.

Under the hood

Keep it open while coding; print as PDF.

Real-world use

  • Practice
  • Interviews

One page of what you use most. Press the button, then choose "Save as PDF" in the print window.

Numbers

8'hFF8-bit hex
4'b10104-bit binary
'd10decimal
x / zunknown / high impedance
signed [7:0]two's complement

Operators

& | ^ ~bitwise
&a | ^areduction
{a,b}concatenation
{4{a}}replication
<< >> >>>shifts (>>> is arithmetic)
? :conditional

Procedural

always @(*)combinational
always @(posedge clk)flip-flop
<=non-blocking (clocked)
=blocking (combinational)
initialtestbench start

Testbench

$displayprint once
$monitorprint on change
$finishstop simulation
#10delay 10 time units
$dumpvarswaveform dump

Structure

module m(input a, output b);ANSI ports
m u(.a(x), .b(y));named connection
parameter N = 8;configurable
generate forrepeat hardware
function / taskreusable code