Mobile
Verilog Online Help Prev Page Prev Page
Table of Contents
Bit-select
Block Statements
Built-in Primitives
Case Statement
Continuous Assignments
Conversion Functions
Comments
Compiler Directives
Concatenations
Conditional Operator
Delays
Disable Statement
Display Tasks
Edge Sensitive Path
Expression Bit Length
File I/O Functions
Functions
Identifiers
If Statement
Integer Constants
Intra-assignment Timing Controls
Keywords
Loop Statements
Memories
min:typ:max Delays
Module Declaration
Module Instantiation
Module Path Declaration
Module Path Polarity
Net Data Types
Operators
Parameters
Part-select
PLA Modeling Tasks
Probabilistic Distribution Functions
Procedural Assignments
Procedural Continuous Assignments
Procedural Timing Control
Range Specification
Real Constants
Register Data Types
Simulation Control Tasks
Simulation Time Functions
Specify Block
State Dependent Path
Stochastic Analysis Tasks
Strengths
Strings
Structured Procedures
Tasks
Timescale System Tasks
Timing Check Tasks
UDP Declaration
UDP Instantiation
UDP State Table
Value Change Dump (VCD) File
Vectors

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.

 

Powered by IXwebhosting