18
AND Gate : A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’.

AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’

Embed Size (px)

Citation preview

Page 1: AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’

AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’.

Page 2: AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’

VHDL Code for AND Gate

library IEEE;

use IEEE.std_logic_1164.all;

use IEEE.std_logic_arith.all;

use IEEE.std_logic_unsigned.all;

entity andgate is

Port( A : in std_logic;

B : in std_logic;

Y : out std_logic);

end andgate;

architecture Behavioral of andgate is

begin

Y<= A and B ;

end Behavioral;

Page 3: AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’

OR Gate: A logic gate whose output is logic ‘0’ if and only if all of its inputs arelogic ‘0’.

Page 4: AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’

VHDL Code for OR Gate

library IEEE;

use IEEE.std_logic_1164.all;

use IEEE.std_logic_arith.all;

use IEEE.std_logic_unsigned.all;

entity orgate is

Port( A : in std_logic;

B : in std_logic;

Y : out std_logic);

end orgate;

architecture Behavioral of orgate is

begin

Y<= A or B ;

end Behavioral;

Page 5: AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’

NOT Gate: A logic gate whose output is complement of its input.

Page 6: AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’

VHDL Code for NOT Gate

Page 7: AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’

NAND gate: A logic gate which gives logic ‘0’ output if and only if all of itsinputs are logic ‘1’

Truth table Logic diagram

Page 8: AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’

VHDL Code for NAND Gate

Page 9: AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’

NOR gate: A logic gate whose output logic ‘1’ if and only if all of its inputs arelogic ‘0’.

Truth table Logic diagram

Page 10: AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’

VHDL Code for NOR Gate

Page 11: AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’

EX-OR (Exclusive OR): A logic gate whose output is logic ‘0’ when all the inputs are equal and logic ‘1’ when they are un equal.

Page 12: AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’

VHDL Code for EX-OR Gate

Page 13: AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’

EX-NOR (Exclusive -NOR) gate: A logic gate that produces a logic ‘1’ only whenthe two inputs are equal.

Truth table Logic diagram

Page 14: AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’

VHDL Code for EX-NOR Gate

Page 15: AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’

Half Adder: A logic circuit for the addition of two one bit numbers is called half adder (sum and carry are output).

Truth table Logic diagram

Page 16: AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’

VHDL Code for HALF ADDERlibrary IEEE;

use IEEE.std_logic_1164.all;

use IEEE.std_logic_arith.all;

use IEEE.std_logic_unsigned.all;

entity HA is

port(

A,B : in STD_LOGIC;

S,CY : out STD_LOGIC);

end HA;

architecture HA_arch of HA is

begin

S<= A XOR B;

CY<= A AND B;

end HA_arch;

Page 17: AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’

Full Adder: a logic circuit that accepts two one-bit signal and Carry-in as inputs and produces their sum and carry as outputs.

Truth table Logic diagram

Page 18: AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’

VHDL Code for FULL ADDER

library IEEE;

use IEEE.std_logic_1164.all;

entity FA is

port(A,B,Cin : in STD_LOGIC;

SUM,CARRY : out STD_LOGIC);

end FA;

architecture LogicFunc of FA is

begin

SUM<= A XOR B XOR Cin;

CARRY<= (A AND B) OR (Cin AND A)OR (Cin AND B);

end LogicFunc;