FPGA Center



TYPE CONVERSION

It is necessery to use type converssion in order to operate different data types.

target_type ( operand expression )

NOTE:

EXAMPLE :

variable A, B : integer;
. . .
A := Integer(18.91 * real(B));

Integer B is convertd to real number first. Then the result is converted back to integer.

DETAILED EXPLANATION:

After type conversion, a new object is created called "target type". (See Example)

The type of the "operand expression" cannot be an aggregate, an allocator, the literal null or a string literal.

Closely related types can be used together in a VHDL design. But a type conversion should be done for this purpose.

Types which have the same size, or the elements of them have the same types or index types are the same in a range called closely related types.

If a floating point is converted to integer, the result will be rounded to the nearest integer.

 

                                                                                                           

    

                                                                                                                                    

 

                                                                                                                                                                                                                                                                   

Home | Fpga | VHDL | VHDL Dictionary | Digital Design | Simulation | PCB | Examples | Contact Us
Copyright © 2010 - 2013 FPGAcenter. All Rights Reserved.