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
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
Numbers
8'hFF | 8-bit hex |
4'b1010 | 4-bit binary |
'd10 | decimal |
x / z | unknown / high impedance |
signed [7:0] | two's complement |
Operators
& | ^ ~ | bitwise |
&a | ^a | reduction |
{a,b} | concatenation |
{4{a}} | replication |
<< >> >>> | shifts (>>> is arithmetic) |
? : | conditional |
Procedural
always @(*) | combinational |
always @(posedge clk) | flip-flop |
<= | non-blocking (clocked) |
= | blocking (combinational) |
initial | testbench start |
Testbench
$display | print once |
$monitor | print on change |
$finish | stop simulation |
#10 | delay 10 time units |
$dumpvars | waveform dump |
Structure
module m(input a, output b); | ANSI ports |
m u(.a(x), .b(y)); | named connection |
parameter N = 8; | configurable |
generate for | repeat hardware |
function / task | reusable code |