FPGA Center



CONCATENATION

Concatenation means connecting two one-dimensional arrays to each other by using an adding operator.  (&) sign is used to join the arrays of same type. The result of this joint is emerged according to process order. It means that a value which is on the left side of the operator sign, becomes first in the result.

NOTE: It is important to define the size of the array such as it should not exceed the dimensions of the elements to be combined.

EXAMPLE 1

A= 0;
B= 01;
C= 011;
D=1100;
A  & B = 0 01;
A  & C= 0 011;
B  & D=01 1100;
C  & B= 011 01;
A  &  B & C= 0 01 011;

EXAMPLE 2 (Shifting Numbers To The Right)

http://www.fpganedir.com/vhdl_sozlugu/RES%C4%B0M/CONCATENATION_clip_image002_0002.jpg
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity Shifting is
     Generic( capacity : integer := 10);
      Port  ( CLK         :  in  STD_LOGIC;
                  DATA       :  in  STD_LOGIC;
                  OUTPUT :  out  STD_LOGIC);
end Shifting;

architecture Behavioral of Shifting is
signal shifting_number: Std_Logic_Vector(capacity -1 downto 0):=(others=>'0');
--(others=>'0') means to assign '0' to all elements.
     begin
         process(CLK)
             begin
                  if rising_edge(CLK) then
                     shifting_number <= DATA & shifting_number ( (capacity -1) downto 1);
                  end if;                     
             end process;
        OUTPUT<= shifting_number (0 );
   end Behavioral;

After simulating the program with  ModelSim, we get the plot below:

http://www.fpganedir.com/vhdl_sozlugu/RES%C4%B0M/CONCATENATION_clip_image002_0001.jpg
                 

                                                                                                           

    

                                                                                                                                    

 

                                                                                                                                                                                                                                                                   

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