FPGA Center



VARIABLE ASSINGMENT

It means to replace value of a varible with a new one

variable_name := value ;

NOTE:

EXAMPLE 1:

variable Z : BIT;
variable I : INTEGER;
variable X, Y : REAL;
variable A, B : BIT_VECTOR (0 to 7);

type
RECORD_1 is record
  bit_field : BIT;
  int_field : Integer;
end record;

variable
C, D : RECORD_1;

X := 1000.0;          --Assign to a selected name
A := B;                    --Assign to a selected name
A := "11111111"; --Assign to a selected name

A (3 to 6) := ('1','1','1','1'); --Assign to a sliced part
A (0 to 5) := B (2 to 7);    -- Assign to a sliced part

A (7) := '0';      -- Assign to an indexed name
B (0) := A (6); -- Assign to an indexed name

C.bit_filed := '1';                --Assign to a field.
D.int_filed := C.int_field; --Assign to a field.
(Z, I) := C;                            --C.bit_filed is assigned to C and C.int_field is asssigned to I..

EXAMPLE 2:

type RECORD_2 is record
  a: BIT_VECTOR(0 to 7);
  b: Integer;
end record;

variable
V, W : RECORD_2;

(D.bit_alan, D.int_alan) := C;    -- Assign to a seleted name with aggregate method
(V.a(0 to 7), K) := W;                    -- Assign to a seleted part with aggregate method

 

                                                                                                           

    

                                                                                                                                    

 

                                                                                                                                                                                                                                                                   

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