Click The Icon On The Desktop 2. The Model Sim Software Opens and in The File Menu Select New Project
Click The Icon On The Desktop 2. The Model Sim Software Opens and in The File Menu Select New Project
Click The Icon On The Desktop 2. The Model Sim Software Opens and in The File Menu Select New Project
PROGRAM
2. The Model Sim software opens and In the File Menu Select New Project
4. Enter the Project name in the project Name dialog box. And select the project
location to be stored.
5. On Clicking Ok. Add items to project dialog box opens. Click New File
6. Create Project File dialog box appears. Enter the project file as the entity
name that is used in the VHD program
7. Create Project File dialog box appears. Enter the project file as the entity
name that is used in the VHD program
8. Double click the file in the workspace tab (or) right click and click Edit.
Date: 18 – JULY-2010
AIM:
VHDL PROGRAM:
AND GATE
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY AND_GATE IS
PORT(A,B:IN STD_LOGIC;X :OUT STD_LOGIC);
END AND_GATE;
ARCHITECTURE LOGIC_GATES OF AND_GATE IS
BEGIN
X <= A AND B;
END LOGIC_GATES;
OR GATE
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY OR_GATE IS
PORT(C,D:IN STD_LOGIC;Y :OUT STD_LOGIC);
END OR_GATE;
ARCHITECTURE LOGIC_GATES OF OR_GATE IS
BEGIN
Y <= C OR D;
END LOGIC_GATES;
NOT GATE
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY NOT_GATE IS
PORT(E:IN STD_LOGIC;Z :OUT STD_LOGIC);
END NOT_GATE;
ARCHITECTURE LOGIC_GATES OF NOT_GATE IS
BEGIN
Z <= NOT E;
END LOGIC_GATES;
XOR GATE
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY XOR_GATE IS
PORT(F,G:IN STD_LOGIC;W :OUT STD_LOGIC);
END XOR_GATE;
ARCHITECTURE LOGIC_GATES OF XOR_GATE IS
BEGIN
W <= F XOR G;
END LOGIC_GATES;
NOR GATE
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY NOR_GATE IS
PORT(H,I:IN STD_LOGIC;S:OUT STD_LOGIC);
END NOR_GATE;
ARCHITECTURE LOGIC_GATES OF NOR_GATE IS
BEGIN
S <= H NOR I;
END LOGIC_GATES;
OUTPUT:
AND GATE
INPUT OUTPUT
A B X
0 0 0
0 1 0
1 0 0
1 1 1
OR GATE
INPUT OUTPUT
C D y
0 0 0
0 1 1
1 0 1
1 1 1
NOT GATE
INPUT OUTPUT
E Z
0 1
1 0
XOR GATE
INPUT OUTPUT
F G W
0 0 0
0 1 1
1 0 1
1 1 0
NOR GATE
INPUT OUTPUT
F G W
0 0 1
0 1 0
1 0 0
1 1 0
RESULT:
AIM:
VHDL PROGRAM:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY BTOG_D_F IS
PORT(B:IN STD_LOGIC_VECTOR(0 TO 3);G:OUT STD_LOGIC_VECTOR(0 TO 3));
END BTOG_D_F;
ARCHITECTURE BTOG_D_F_ARCH OF BTOG_D_F IS
BEGIN
G(0)<=B(0);
G(1)<=B(0) XOR B(1);
G(2)<=B(1) XOR B(2);
G(3)<=B(2) XOR B(3);
END BTOG_D_F_ARCH;
CIRCUIT DIAGRAM:-
OUTPUT
INPUT OUTPUT
B0 B1 B2 B3 G0 G1 G2 G3
0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1
0 0 1 0 0 0 1 1
0 0 1 1 0 0 1 0
0 1 0 0 0 1 1 0
0 1 0 1 0 1 1 1
0 1 1 0 0 1 0 1
0 1 1 1 0 1 0 0
1 0 0 0 1 1 0 0
1 0 0 1 1 1 0 1
1 0 1 0 1 1 1 1
1 0 1 1 1 1 1 0
1 1 0 0 1 0 1 0
1 1 0 1 1 0 1 1
1 1 1 0 1 0 0 1
1 1 1 1 1 0 0 0
RESULT:
AIM:
VHDL PROGRAM:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY GTOB_D_F IS
PORT(G:IN STD_LOGIC_VECTOR(0 TO 3);B:INOUT STD_LOGIC_VECTOR(0 TO 3));
END GTOB_D_F;
ARCHITECTURE GTOB_D_F_ARCH OF GTOB_D_F IS
BEGIN
B(0)<=G(0);
B(1)<=G(0) XOR G(1);
B(2)<=G(2) XOR B(1);
B(3)<=G(3) XOR B(2);
END GTOB_D_F_ARCH;
CIRCUIT DIAGRAM:-
OUTPUT
INPUT OUTPUT
G0 G1 G2 G3 B0 B1 B2 B3
0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1
0 0 1 0 0 0 1 1
0 0 1 1 0 0 1 0
0 1 0 0 0 1 1 1
0 1 0 1 0 1 1 0
0 1 1 0 0 1 0 0
0 1 1 1 0 1 0 1
1 0 0 0 1 1 1 1
1 0 0 1 1 1 1 0
1 0 1 0 1 1 0 0
1 0 1 1 1 1 0 1
1 1 0 0 1 0 0 0
1 1 0 1 1 0 0 1
1 1 1 0 1 0 1 1
1 1 1 1 1 0 1 0
RESULT:
AIM:
VHDL PROGRAM:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY HALF_SUBTRACTOR IS
PORT(A,B :IN STD_LOGIC;X,Y:OUT STD_LOGIC);
END HALF_SUBTRACTOR;
ARCHITECTURE ARCH_HALF_SUBTRACTOR OF HALF_SUBTRACTOR IS
BEGIN
X<=(A XOR B);
Y<=(A AND (NOT B));
END ARCH_HALF_SUBTRACTOR;
CIRCUIT DIAGRAM:-
OUTPUT:
INPUT OUTPUT
A B X Y
0 0 0 0
0 1 1 0
1 0 1 1
1 1 0 0
RESULT:
AIM:
VHDL Program:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY FULL_SUB IS
PORT(A,B,C:IN STD_LOGIC;DIFF,BOR:OUT STD_LOGIC);
END FULL_SUB;
ARCHITECTURE FS_A OF FULL_SUB IS
BEGIN
DIFF<=((A XOR B)XOR C);
BOR<=((NOT A)AND B)OR(NOT(A XOR B)AND C);
END FS_A;
Circuit Diagram:-
OUTPUT:
INPUT OUTPUT
A B C DIFF BOR
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 0 1
1 0 0 1 0
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1
RESULT:
AIM:
VHDL PROGRAM:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY HALFADDER IS
PORT (A,B:IN STD_LOGIC;X,Y:OUT STD_LOGIC);
END HALFADDER;
ARCHITECTURE HALF_ADD OF HALFADDER IS
BEGIN
X<= (A XOR B);
Y<= (A AND B);
END HALF_ADD;
CIRCUIT DIAGRAM:
OUTPUT:
INPUT OUTPUT
A B S C
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
RESULT:
AIM:
VHDL PROGRAM:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY FULL_ADDER IS
PORT(A,B,C:IN STD_LOGIC;X,Y :OUT STD_LOGIC);
END FULL_ADDER;
ARCHITECTURE FULL_ADDER_ARCH OF FULL_ADDER IS
BEGIN
X<=(C XOR (A XOR B));
Y<=(((A XOR B) AND C) OR (A AND B));
END FULL_ADDER_ARCH;
OUTPUT:
INPUT OUTPUT
A B C X Y
0 0 0 0 0
0 1 0 1 0
1 0 0 1 0
1 1 0 0 1
0 0 1 1 0
0 1 1 0 1
1 0 1 0 1
1 1 1 1 1
RESULT:
AIM:
VHDL PROGRAM:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY PARITY_GEN_D_F IS
PORT(D:IN STD_LOGIC_VECTOR(0 TO 8); E:INOUT STD_LOGIC_VECTOR(0 TO 3); F:
INOUT STD_LOGIC_VECTOR(0 TO 1);H: INOUT STD_LOGIC;ODD: OUT STD_LOGIC;
EVEN:OUT STD_LOGIC);
END PARITY_GEN_D_F;
ARCHITECTURE PARITY_GEN_D_F_ARCH OF PARITY_GEN_D_F IS
BEGIN
E(0) <= (D(0) XOR D(1));
E(1) <= D(2) XOR D(3);
E(2) <= D(4) XOR D(5);
E(3) <= D(6) XOR D(7);
F(0) <= E(0) XOR E(1);
F(1) <= E(2) XOR E(3);
H <= (F(0) XOR F(1));
EVEN <= NOT(H XOR D(8));
ODD <= H XOR D(8);
END PARITY_GEN_D_F_ARCH;
OUTPUT:
INPUT OUTPUT
D ODD EVEN
000000000 0 1
000000001 0 1
000000010 0 1
000000011 1 0
001000011 0 1
101000011 1 0
RESULT:
AIM:
VHDL PROGRAM:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY BIT2_CMP IS
PORT(A,B:IN STD_LOGIC_VECTOR(1 DOWNTO 0);
GREAT,LESS,EQU:OUT STD_LOGIC);
END BIT2_CMP;
ARCHITECTURE BIT4_CMP_A OF BIT2_CMP IS
SIGNAL X1,X2,X3,X4:STD_LOGIC;
BEGIN
X1<=((NOT A(0) AND NOT B(0)) OR (A(0) AND B(0)));
X2<=((NOT A(1) AND NOT B(1)) OR (A(1) AND B(1)));
GREAT<=((A(1) AND NOT B(1)) OR (X2 AND (A(0) AND NOT B(0))));
LESS <=((B(1) AND NOT A(1)) OR (X2 AND (B(0) AND NOT A(0))));
EQU <=(X1 AND X2 AND X3 AND X4);
END BIT4_CMP_A;
OUTPUT:
INPUT OUTPUT
B GREA EQU
A LESS
T
00 00 0 0 1
10 00 1 0 0
10 11 0 1 0
RESULT: