You are on page 1of 4

NOT using NAND gate

Code:-
library ieee;
use ieee.std_logic_1164.all;
entity notnand is
port(
A: in bit;
Y: out bit);
end notnand;
architecture dataflow of notnand is
begin
Y <= A nand A;
end dataflow;

Output:-
AND using NAND gate
Code:-
library ieee;
use ieee.std_logic_1164.all;
entity andnand is
port(
A,B: in bit;
Y: out bit);
end andnand;
architecture dataflow of andnand is
begin
Y <= (A nand B)nand(A nand B);
end dataflow;

Output:-
OR using NAND gate
Code:-
library ieee;
use ieee.std_logic_1164.all;
entity ornand is
port(
A,B: in bit;
Y: out bit);
end ornand;
architecture dataflow of ornand is
begin
Y <= (A nand A)nand(B nand B);
end dataflow;

Output:-
NOR using NAND gate
Code:-
library ieee;
use ieee.std_logic_1164.all;
entity nornand is
port(
A,B: in bit;
Y: out bit);
end nornand;
architecture dataflow of nornand is
begin
Y <= ((A nand A)nand(B nand B))nand((A nand A)nand(B nand B));
end dataflow;

Output:-

You might also like