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

Fixed point3.75x 16integer 60/ 163.75
Fixed point

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 in a full simulator (Icarus, Verilator, vendor tools)
real r;
initial begin
  r = 3.75 * 2;
  $display("%f", r);
  $display("%0d", $rtoi(r));
end

Check yourself

1. Is real synthesizable?