Conversion functions convert data formats between integer, real and bit representations.
$bitstoreal(bit_number) ;
$itor(integer_number) ;
$realtobits(real_number) ;
$rtoi(real_number) ;
The $bitstoreal function converts a bit pattern to a real number. The $itor function converts an integer to a real number. The $realtobits function converts a real number to its binary a equivalent. The $rtoi function converts a real number to an integer.
Example 1
reg [31:0] a, result_b ;
integer b, result_I ;
real c, result_r ;
result_r = $bitstoreal(a) ;
result_r = $itor(b) ;
result_b = $realtobits(c) ;
result_I = $rtoi(c) ;
Conversion functions are not synthesizable.
Powered by IXwebhosting |