Home / Learn Verilog / Integer Square Root
Integer Square Root
Bit-by-bit method.
The short versionBit-by-bit method.
Theory in plain words
The basic idea
Test each result bit from the top; keep it if its square does not exceed the input.
Why this comes up
Distance and magnitude calculations.
The mechanics
N/2 iterations.
Where it is used
- Everyday RTL design
- FPGA and ASIC projects
- Testbenches and debugging
Try it
isqrtVerilog: edit and run
Floor of the square root.
Quick check
1. isqrt(1000) =
31^2 = 961.