FPGA Center



PROCEDURE

Procedure is similar to function as functionally. But the procedure does not return a value like function. Any input and output can be defined in the procedure. This feature is the difference from functions.

Procedure Declaration

procedure procedure_name (inputs seperated with commas: in type;
                                                outputs seperated with comması : out  type );


Procedure Body

procedure procedure_name (inputs seperated with commas: in type;
                                                outputs seperated with commas : out  type );
    -- constant and variable declarations    
  begin
       -- procedure_body
  end procedure_name;

Procedure Instantiation

Procedure_name (inputs seperated with commas,outputs seperated with commas);

If you will not obey the order written in paranthesis, you should use the foolowing statement;

Procedure adı (input1 = > insig1, ... , output1 => outsig1> ...);

EXAMPLE (Two Input AND/OR Gate):

library IEEE;
use
IEEE.STD_LOGIC_1164.ALL;

entity AND_OR_P is
     Port ( in1          : in    STD_LOGIC;
                in2          : in    STD_LOGIC;
                out_and : out  STD_LOGIC;
                out_or   : out  STD_LOGIC);
end AND_OR_P;

architecture Behavioral of AND_OR_P is
procedure AND_P(signal in1,in2: in STD_LOGIC;signal output: out STD_LOGIC ) is
    begin
        output<=in1 AND in2;
end AND_P;

procedure OR_P(signal in1,in2: in STD_LOGIC;signal output: out STD_LOGIC ) is
    begin
         output<=in1 OR in2;
    end OR_P;
begin --architecture
     AND_P(in1,in2,out_and);
     OR_P(in1,in2,out_or);
end Behavioral;

After running simulation on ModelSim, we get the following waveform.

1

 

 

                                                                                                           

    

                                                                                                                                    

 

                                                                                                                                                                                                                                                                   

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