Home / Learn Verilog / System Functions: $clog2, $bits, $random, $time
System Functions: $clog2, $bits, $random, $time
Built-in helpers.
The gistBuilt-in helpers.
The idea, explained simply
In plain terms
$clog2 gives the ceiling log2, $bits the width, $random a random number, $time simulation time.
Why we use it
Used constantly in parameter calculations.
Under the hood
Combine with localparam.
Real-world use
- Everyday RTL design
- FPGA and ASIC projects
- Testbenches and debugging
Try it
System functionsVerilog: edit and run
$clog2(17) = 5 because 2^5 = 32 >= 17.
Quick quiz
1. $clog2(8) =
2^3.