原文链接:https://www.hdlworks.com/hdl_corner/verilog_ref/items/SystemRealConversionFuncs.htm
System real conversion functions
LRM §14.9.
System real conversion functions are conversion functions for real numbers.
Syntax:
$realtobits(real_value);
$bitstoreal(bit_value);
$rtoi(real_value);
$itor(integer_value);
Description
:
$realtobits
converts a real number to a 64-bit representation, so that a real number can be passed through the port of a module.
$bitstoreal
converts the bit value to a real number.
$rtoi
converts a real number to an integer. It truncates the real number to form the integer.
$itor
converts an integer to a real value.
Example:
reg [63:0] A;
real B;
B = $bitstoreal(A);
integer C = 14;
B = $itor(C); // B = 14.0
See also:
Module, Number