Featured post

Top 5 books to refer for a VHDL beginner

VHDL (VHSIC-HDL, Very High-Speed Integrated Circuit Hardware Description Language) is a hardware description language used in electronic des...

Sunday 9 September 2012

Conversion Functions

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.