FPGA Center



 * Constant

 * Signal

 * Operators

 * Component

 * Concurrent Assignments

 * Process

 * Sequential Statements

 * Variable

  * User Defined Types

 

VHDL Operators

Aritmetical Operators

1

Logical Operators

3

Relational Operators

2

Arithmetic and boolean functions are only defined for data types that are defined in Standard Package. For example:

Arihmetic operators (+,-,<,>,<=,>=) can be applied to integer types.

For the other data types, special functions which are defined in IEEE library can be used in arithmetic and boolean operations.

Packages that include special functions in IEEE library:

std_logic_arith (aritmetical functions)
std_logic_signed (signed aritmetical functions)
std_logic_unsigned (unsigned aritmetical functions)
numeric_std (signed ve unsigned aritmetical functions)

Since the operator and the operator's name are the same, function name is written in double quotes (" ").

Some special functions defined in numeric_std package are written below:

function "-" (ARG: signed) return signed;

function "+" (L, R: unsigned) return unsigned;

function "+" (L: natural; R:unsigned) return unsigned;

function "+" (L: integer; R: signed) return signed;

Example:

You can see below how an adding operation can be one by using std_logic_vector type.

library IEEE;
use
IEEE.STD_LOGIC_1164.ALL;
use
IEEE.STD_LOGIC_UNSIGNED.ALL; --declaration of packet name

entity adder is
    Port ( a : in std_logic_vector (5 downto 0);
               b : in std_logic_vector (5 downto 0);
               c : out std_logic_vector (5 downto 0));
end adder;

architecture Behavioral of adder is
    begin
        c<=a + b;
   end Behavioral;

 

 

 

 

 project                                                                                                                                    Vhdl_Code                                                                                                                                    

 

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