Formal Definition
Conversion functions convert data formats between integer, real and bit representations.
Simplified Syntax
$bitstoreal(bit_number) ;
$itor(integer_number) ;
$realtobits(real_number) ;
$rtoi(real_number) ;
Description
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.
Examples
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) ;
Important Notes
-
Conversion functions are not synthesizable.
No comments:
Post a Comment
Please provide valuable comments and suggestions for our motivation. Feel free to write down any query if you have regarding this post.