FPGA Center



IF STATEMENT

If statement is a structure which depends on one or more conditions.

if condition then
     --sequential expressions
end if
-------------------------------
if condition then
    --sequential expressions
else
     --sequential expressions
end if;
---------------------------------
ifcondition then
   --sequential expressions
elsif condition then
  --sequential expressions
else
  --sequential expressions
end if;

NOTE:

Example 1

U1: if State = red  then
            Outputs <= '1';
        end if U1;

Example 2

function AND_GATE (x, y: in Bit) return Bit is
    begin
          if x = '1' and y = '1' then
                return '1';
           else
                  return '0';
            end if
   end AND_GATE;

Example 3

if Status = RUN  then
     if Code_of_Operation = CONC  then
            F := X1 & X2 ;
      else
             F := "00000000";
      end if;
  Output <= F;
end if;

DETAILED EXPRESSION

                                                                                                           

    

                                                                                                                                    

 

                                                                                                                                                                                                                                                                   

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