Home / Learn Verilog / real Numbers and Fixed-Point Instead
real Numbers and Fixed-Point Instead
real exists for models, but hardware uses fixed-point integers.
Bottom linereal exists for models, but hardware uses fixed-point integers.
Breaking it down
What it is
The type real holds floating-point values in full simulators. Chips use integers where some low bits mean a fraction (fixed-point).
Why it matters
You must know both: real for models in big simulators, fixed-point for real hardware.
Mechanically speaking
Fixed-point: store value x 16 as an integer. 3.75 becomes 60. The built-in simulator here runs the fixed-point form.
Shows up in
- Everyday RTL design
- FPGA and ASIC projects
- Testbenches and debugging
Try it
Fixed-point Q4.4 mathsVerilog: edit and run
Fraction digits are printed as hundredths of 1/16 steps. 3.75 + 1.5 = 5.25, 3.75 x 1.5 = 5.625.
real r;
initial begin
r = 3.75 * 2;
$display("%f", r);
$display("%0d", $rtoi(r));
endCheck yourself
1. Is real synthesizable?
Use fixed-point integers in hardware.