Docsity

Digital System Design Lab, Lecture notes of Digital Systems Design

Partial preview of the text

Download Digital System Design Lab and more Lecture notes Digital Systems Design in PDF only on Docsity!

DIGITAL SYSTEM DESIGN LAB

(EE-330-F)

LAB MANUAL

VI SEMESTER

RAO PAHALD SINGH GROUP OF INSTITUTIONS

BALANA(MOHINDER GARH)

Department Of Electronics & Communication Engg.

RPS CET ,Balana(M/Garh)

EXPERIMENT- 1

Aim:-

Write the vhdl code and simulate it for the following gates. i) Two i/p AND Gates. ii) Two i/p OR Gates. iii) Two i/p NAND Gates iv) Two i/p NOR Gates. v) Two i/p EX-OR Gates. vi) NOT Gates.

SPECIFICATION OF APPARATIUS USED:-

Mentor graphics FPGA advantage software modelsim simulation tool.

Program:-

i) Behavior Model if two i/p AND Gate.

Library IEEE; Use IEEE.std_logic_1164.all; Use IEEE.std_logic_arith.all;

Entity and2 is Port (a, b: in bit; z: out bit); End and2;

Architecture beh of and2 is Begin process (a, b) Begin If (a=‟0‟ and b=‟ 0 ‟) then Z<=‟0‟; ElsIf (a=‟0‟ and b=‟ 1 ‟) then Z<=‟0‟; ElsIf (a=‟1‟ and b=‟ 0 ‟) then Z<=‟0‟; ElsIf (a=‟1‟ and b=‟ 1 ‟) then Z<=‟1‟; End if; End process; End beh;

EXPERIMENTAL SET UP:-

1

2

3

Z

A

B

OR_
TRUTH TABLE

a b Z 0 0 0 0 1 1 1 0 1 1 1 1

Logic Equation: Z=a OR b

iii) Behavior Model if two i/p NAND Gate

Library IEEE; Use IEEE.std_logic_1164.all; Use IEEE.std_logic_arith.all;

Entity NAND_2 is Port (a, b: in bit; z: out bit); End NAND_2;

Architecture NAND_2_beh of NAND_2 is Begin process (a, b) Begin If (a=‟0‟ and b=‟ 0 ‟) then Z<=‟1‟; Elsif (a=‟0‟ and b=‟ 1 ‟) then Z<=‟1‟; Elsif (a=‟1‟ and b=‟ 0 ‟) then Z<=‟1‟; Elsif (a=‟1‟ and b=‟ 1 ‟) then Z<=‟0‟; End if; End process; End NAND_2_beh;

EXPERIMENTAL SET UP:-

Z

A

B

1 2

3

NAND_ TRUTH TABLE

a b Z 0 0 1 0 1 1 1 0 1 1 1 0

Logic Equation: Z=a AND b

iv) Behavior Model if two i/p NOR Gates

Library IEEE; Use IEEE.std_logic_1164.all; Use IEEE.std_logic_arith.all;

Entity NOR_2 is Port (a, b: in bit; z: out bit); End NOR_2;

Architecture NOR_2_beh of NOR_2 is Begin process (a, b) Begin If (a=‟0‟ and b=‟ 0 ‟) then Z<=‟1‟; Elsif (a=‟0‟ and b=‟ 1 ‟) then Z<=‟0‟; Elsif (a=‟1‟ and b=‟ 0 ‟) then Z<=‟0‟; Elsif (a=‟1‟ and b=‟ 1 ‟) then Z<=‟0‟; End if; End process; End NOR_2_beh;

EXPERIMENTAL SET UP:-

A

B

Z

1 2

3

EX-OR_

TRUTH TABLE

a b Z 0 0 0 0 1 1 1 0 1 1 1 0

Logic Equation: Z= a EX-OR b

v) Behavior Model of NOT Gate

Library IEEE; Use IEEE.std_logic_1164_all; Use IEEE.std_logic_arith_all;

Entity NOT_2 is Port (a: in bit; z: out bit); End NOT_2;

Architecture EXOR_2_beh of EXOR_2 is Begin Process (a) Begin If (a=‟0‟) then Z<=‟1‟; Elsif (a=‟1‟) then Z<=‟0‟; End if; End process; End NOT_2_beh;

EXPERIMENTAL SET UP:-

1 2

A Z

NOT_

Precautions:-

Make sure that there is no syntax and semantie error.

Result:- All the VHDL codes of AND, OR, NAND, NOR, EX-OR and NOT gates are simulated and find correct.

EXPERIMENTAL SET UP:-
A A>B
A=B
B A<B

Precautions:-

Make sure that there is no syntax and semantie error.

Result:- All the VHDL codes of 1- bit Comparator is simulated and synthesized.

1- Bit Comparator

EXPERIMENT NO.-

Aim:-

Write a program for behavior model of 4- bit Comparator

SPECIFICATION OF APPARATIUS USED:-

Mentor Graphics FPGA Advantage Software Modelsim Simulation Tool.

Program:-

Library IEEE; Use IEEE.std_logic_1164.all; Use IEEE.std_logic_arith.all;

Entity COM_2 is Port (a, b: in bit_Vector (3 down to 0); z: out bit_vector (2 down to 0)); End COM_2;

Architecture COM_2_beh of COM_2 is Begin Process (a, b) Begin If (a=b) then Z<=‟ 10 0‟; Elsif (a<b) then Z<=‟010‟; Elsif (a>b) then Z<=‟001‟; End if; End process; End COM_2_beh;

Precautions:-

Make sure that there is no syntax and semantie error.

Result:- All the VHDL codes of 4- bit Comparator is simulated and synthesized.

EXPERIMENTAL SET UP:-

Select Input’s S1 S

Output Y

0 0 I

0 1 I

1 0 I

1 1 I

Truth table of 4-to-1 Multiplexer

Program: - Behavior Model of Demultiplexer (1 to 4)

Library IEEE; Use IEEE.std_logic_1164_all; Use IEEE.std_logic_arith_all;

Entity DEMUX_2 is Port (a, s0, s1: in bit; z: out bit_vector (3 down to 0)); End DEMUX_2;

Architecture DEMUX_2_beh of DEMUX_2 is Begin Process (so, s1) Begin If (s1=‟0‟ and s0=‟0‟) then

A

A

A

A

I0 I

O

X

U
V
W
X
S0 S

S0 BAR S1 BAR

Z (0) <=a; Z (1) <=‟0‟; Z (2) <=‟0‟; Z (3) <=‟0‟; Elsif (s1=‟0‟ and s0=‟1‟) then Z (0) <=‟0‟; Z (1) <=a; Z (2) <=‟0‟; Z (3) <=‟0‟; Elsif (s1=‟1‟ and s0=‟0‟) then Z (0) <=‟0‟; Z (1) <=‟0‟; Z (2) <=a; Z (3) <=‟0‟; Elsif (s1=‟1‟ and s0=‟1‟) then Z (0) <=‟0‟; Z (1) <=‟0‟; Z (2) <=‟0‟; Z (3) <=a; End if; End process; End DEMUX_2_beh;

Precautions:-

Make sure that there is no syntax and semantic error.

Result:- A) All the VHDL codes of 4 to 1 Multiplexer is simulated and synthesized. B) All the VHDL codes of 4 to 1 Demultiplexer is simulated and synthesized.

EXPERIMENTAL SET UP:-

BCD Input’s A B C D

Ou tput’s a b c d e f g 0 0 0 0 1 1 1 1 1 1 0 0 0 0 1 0 1 1 0 0 0 0 0 0 1 0 1 1 0 1 1 0 1 0 0 1 1 1 1 1 1 0 0 1 0 1 0 0 0 1 1 0 0 1 1 0 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 0 1 0 0 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 0 1 1

Truth table of BCD-to-Seven Segment Decoder

BCD-to-Seven Segment Decoder

A
B
C
D

a b c d e f g

g

a

d

f

e

b

c

Wave Form of BCD-to-Seven Segment Decoder:-

Precautions:-

Make sure that there is no syntax and semantie error.

Result:- All the VHDL codes of BCD to Seven Segment is simulated and synthesized.

Block diagram of 4-bit Parallel in Parallel out Register

Waveform of 4-bit Parallel in Parallel Out Register:-

D Q FF

D Q FF

D Q FF

D Q FF

D(0) D(1) D(2) D(3)

PR

CLK

CR

Parallel Input's

Parallel Output's

Precautions:-

Make sure that there is no syntax and semantie error.

Result:- All the VHDL codes of PIPO is simulated and synthesized.