FPGA Center



BLOCK

Block is used to separate the written program into small pieces.  Thus, the program becomes more understandable.

 Block_name: block 
    --Declarations of constants and variables
         begin
    --  program expressions
  end block block_name

EXAPMPLE (Nested- Blocks):

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity NESTED_BLK is
        Port ( in1   : in  STD_LOGIC;
                   in2   : in  STD_LOGIC;
                   in3   : in  STD_LOGIC;
                   in4   : in  STD_LOGIC;
                   out1 : out  STD_LOGIC;
                   out2 : out  STD_LOGIC);
end NESTED_BLK;
architecture Behavioral of NESTED_BLK is
    begin
       BLK1: block
          signal temp:STD_LOGIC;
          begin
               temp<= in1 and in2; -- defined temp in BLK1
               BLK2: block
                    signal temp:STD_LOGIC;
                      begin
                             temp<=in2 and in2; -- defined temp in BLK2
                              BLK3:block
                                   begin
                                        out1<=temp;-- defined temp in BLK3
                              end block BLK3;
                     end block BLK2;
             out2<=temp;-- defined temp in BLK1
        end block BLK1;
end Behavioral;

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

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

                                                                                                           

    

                                                                                                                                    

 

                                                                                                                                                                                                                                                                   

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