Digital IC Applications Lab Manual
Digital IC Applications Lab Manual
APPLICATIONS
LABORATORY MANUAL (R16)
Prepared by
Mr. Sundara K ChakravarthyM, Assistant Professor
DIGITAL IC APPLICATIONS
III YEAR – I SEMESETER
The students are required to design and draw the internal structure of the following Digital
Integrated Circuits and to develop VHDL source code, perform simulation using relevant simulator and
analyze the obtained simulation results using necessary synthesizer. Further, it is required to verify the
logic with necessary hardware.
19 74189 SRAM
AIM: To simulate and verify the truth tables of OR, AND, NOT, NAND, NOR and X-OR gates.
APPARATUS:
1. Personal computer -1 no.
2. Xilinx ISE Simulator
THEORY:
A logic gate is an elementary building block of a digital circuit. Most logic gates have two inputs
and one output. At any given moment, every terminal is in one of the two
binary conditions low (0) or high (1), represented by different voltage levels. The logic state of a
terminal can, and generally does, change often, as the circuit processes data. In most logic gates,
the low state is approximately zero volts (0 V), while the high state is approximately five volts
positive (+5V).
AND:
The AND gate is so named because, if 0 is called "false" and 1 is called "true," the gate acts in the
same way as the logical "and"operator.
OR:
The OR gate gets its name from the fact that it behaves after the fashion of the logical inclusive
"or." The output is "true" if either or both of the inputs are "true." If both inputs are "false," then
the output is "false."
NOR:
The NOR gate is a combination OR gate followed by an inverter. Its output is "true" if both inputs
are "false." Otherwise, the output is "false."
PROCEDURE:
Click on the Xilinxicon.
Go to file and click on newproject.
Enter your project name and project setting select automotive Spartan 3E in family.
Go to project, click on new source. A new source wizard will open. Select VHDL module and enter your
file name. But do not give keywords as filename.
Now define module will be opened. Fill input, output details inport.
In design window your file will appear, make sure it isdetected.
Write architectural part and saveit.
Go to process window, click on synthesizer and checksyntax.
If any syntax errors occur they will appear on console window whilecompiling.
Go to simulation and select yourfile.
In process window click ISM simulator, now click on behavioral check syntax, simulate behavioralmodel.
Select your input & click on force constant. Enter value in ‘force clock’ tovalue.
By repeating above step for all input’s click on‘RUN’.
To view output for all combinations of inputs click on zoomview.
VIVA QUESTIONS:
1. Implement the following function using VHDL coding. (Try to minimize if youcan). F(A,B,C,D)=(A′
+B+C) . (A+B′+D′). (B+C′+D′) .(A+B+C+D)
2. What will be the no. of rows in the truth table of Nvariables?
3. What are the advantages ofVHDL?
4. Design Ex-OR gate using behavioralmodel?
5. Implement the following function using VHDL codef=AB+CD.
6. What are the differences between half adder and fulladder?
7. What are the advantages of minimizing the logicalexpressions?
8. What does a combinational circuitmean?
9. Implement the half adder using VHDLcode?
10. Implement the full adder using two half adders and write VHDL program instructural model?
AIM: To write VHDL code for a full adder in 3 modeling styles and simulate using Xilinx ISE simulator
and verify truth tables.
APPARATUS:
1. Personal computer -1 no.
2. Xilinx ISE Simulator
THEORY:
The VHDL Code for full-adder circuit adds three one-bit binary numbers (A B Cin) and outputs
two one-bit binary numbers, a sum (S) and a carry (Cout). Truth Table describes the functionality
of full adder. sum(S) output is High when odd number of inputs are High. Cout is High, when two
or more inputs are High. VHDL Code for full adder can also be constructed with 2 half adder Port
mapping in to full adder.
SIMULATION OUTPUTS:
APPARATUS:
1. Personal computer -1 no.
2. Xilinx ISE Simulator
PIN DIAGRAM:
LOGIC DIAGRAM:
OBSERVATIONS:
THEORY:
Decoder is the combinational circuit which contains ‘n’ input lines to 2 n output lines. The decoder is
used for converting the binary code into the octal code. The IC74138 is the 3*8 decoder which contains
three inputs and eight outputs and also three enables out of them two are active low and one is active high.
Decoders are used in the circuit where required to get more outputs than that of the inputs which also used
in the chip designing process for reducing the IC chip area.
SIMULATION OUTPUTS :
VIVA QUESTIONS:
1. What is decoder?
2. What is a encoder?
3. For a 2- I/P decoder how many O/P’s are produced
4. A decoder with ‘n’ input produces max. of __ [Link].
5. The general representation of an encoder is
6. Draw the 2 to 4 line decoder with only nor gates.
7. Difference b/w de multiplexer and decoder
AIM: To write VHDL code for 8 to 3 encoder with and without priority.
APPARATUS:
1. Personal computer -1 no.
2. Xilinx ISE Simulator
BLOCK DIAGRAM:
Truth Table:
Theory:
Unlike a multiplexer that selects one individual data input line and then sends that data to a single output
line or switch, Digital Encoder more commonly called a Binary Encoder takes ALL its data inputs one at
a time and then converts them into a single encoded output. So we can say that a binary encoder, is a multi-
input combinational logic circuit that converts the logic level “1” data at its inputs into an equivalent binary
code at its output.
Generally, digital encoders produce outputs of 2-bit, 3-bit or 4-bit codes depending upon the number of
data input lines. An “n-bit” binary encoder has 2 n input lines and n-bit output lines with common types that
include 4-to-2, 8-to-3 and 16-to-4 line configurations.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity exp5pra is
Port ( e : in STD_LOGIC;
y : in STD_LOGIC_VECTOR (7 downto 0);
a : out STD_LOGIC_VECTOR (2 downto 0);
Gs,Eo : out STD_LOGIC);
end exp5pra;
architecture exp5pra of exp5pra is
begin
process(e,y)
begin
if e='1' then a<="111";Gs<='1';EO<='1';
elsif y="xxxxxxx0" then a<="000";Gs<='0';EO<='1';
elsif y="xxxxxx01"then a<="001";Gs<='0';EO<='1';
elsif y="xxxxx011" then a<="010";Gs<='0';Eo<='1';
elsif y="xxxx0111" then a<="011";Gs<='0';EO<='1';
elsif y="xxx01111" then a<="100";Gs<='0';EO<='1';
elsif y="xx011111" then a<="101";Gs<='0';EO<='1';
elsif y="x0111111" then a<="110";Gs<='0';EO<='1';
elsif y="01111111" then a<="111";Gs<='0';EO<='1';
elsif y="11111111" then a<="111";Gs<='1';EO<='0';
TEST BENCH
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity exp5pra_tb is
end exp5pra_tb;
architecture exp5pra_tb of exp5pra_tb is
component exp5pra is
port(e:in std_logic;
y:in std_logic_vector(7 downto 0);
a:out std_logic_vector(2 downto 0);
Gs,EO:OUT STD_LOGIC);
end component;
signal e:std_logic;
signal y:std_logic_vector(7 downto 0);
signal a:std_logic_vector(2 downto 0);
signal Gs,EO:std_logic;
begin
uut:exp5pra port map(e=>e,y=>y,a=>a,Gs=>Gs,Eo=>EO);
process
begin
e<='1';y<="xxxxxxx0";wait for 10ns;
e<='0';y<="xxxxxxx0";wait for 10ns;
y<="xxxxxx01";wait for 10ns;
y<="xxxxx011";wait for 10ns;
y<="xxxx0111";wait for 10ns;
y<="xxx01111";wait for 10ns;
y<="xx011111";wait for 10ns;
y<="x0111111";wait for 10ns;
y<="01111111";wait for 10ns;
y<="11111111";wait for 10ns;
wait;
end process;
end exp5pra_tb;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity exp5prb is
Port ( e : in STD_LOGIC;
y : in STD_LOGIC_VECTOR (7 downto 0);
a : out STD_LOGIC_VECTOR (2 downto 0);
Gs,Eo : out STD_LOGIC);
end exp5prb;
architecture exp5prb of exp5prb is
begin
process(e,y)
begin
if e='1' then a<="111";Gs<='1';EO<='1';
elsif y="11111110" then a<="000";gs<='0';e0<='1';
elsif y="11111101" then a<="001";gs<='0';e0<='1';
elsif y="11111011" then a<="010";gs<='0';e0<='1';
elsif y="11110111" then a<="011";gs<='0';e0<='1';
TEST BENCH
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity exp5prb_tb is
end exp5prb_tb;
architecture exp5prb_tb of exp5prb_tb is
component exp5prb is
port(e:in std_logic;
y:in std_logic_vector(7 downto 0);
a:out std_logic_vector(2 downto 0);
Gs,EO:OUT STD_LOGIC);
end component;
signal e:std_logic;
signal y:std_logic_vector(7 downto 0);
signal a:std_logic_vector(2 downto 0);
signal Gs,EO:std_logic;
begin
uut:exp5prb port map(e=>e,y=>y,a=>a,Gs=>Gs,Eo=>EO);
process
begin
e<='1';y<="11111110";wait for 10ns;
e<='0';y<="11111110";wait for 10ns;
y<="11111101";wait for 10ns;
y<="11111011";wait for 10ns;
y<="11110111";wait for 10ns;
y<="11101111";wait for 10ns;
y<="11011111";wait for 10ns;
y<="10111111";wait for 10ns;
y<="01111111";wait for 10ns;
y<="11111111";wait for 10ns;
wait;
end process;
end exp5prb_tb;
Simulation Results:
5. 8 x 1MULTIPLEXER
APPARATUS:
1. Personal computer -1 no.
2. Xilinx ISE Simulator
TRUTH TABLE:
A multiplexer is a digital switch- it connects data from one of n sources to its output. An 8*1 is
multiplexer consists of 3 input lines as select lines and 8 input lines and 1 output line. A multiplexer is a
unidirectional device which follows the data from input lines to output lines. Multiplexers are obviously
useful device in any application in which data must be multiple source to destination. A common
application in computers is the mux between the processors registers and its ALU.
VIVA QUESTIONS:
1. Mux is an implementation of –
2. Multiplexer is represented by –
3. De multiplexer is represented by –
APPARATUS:
1. Personal computer -1 no.
2. Xilinx ISE Simulator
PIN DIAGRAM:
FUNCTION TABLE:
THEORY:
Comparing two binary words for equality is a commonly used operation in computer systems and
device interfaces. A circuit that compares two binary words and indicates whether they are equal is called a
comparator. Some comparators interpret their input words as signed or unsigned numbers and also
indicate an arithmetic relationship (greater or less than) between the words. These devices are often called
magnitude comparators. A 1-bit Comparator is designed using Ex-OR and Ex-NOR gates. The outputs of
4 XOR gates are ORed to create a 4-bit comparator. The IC 7485 is 4-bit magnitude comparator. With
respect to the 8 inputs 3 inputs are cascaded inputs. After the 8 input operations are performed further the
outputs are based on the cascaded inputs.
PROGRAM:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity exp6pr is
Port ( a,b : in STD_LOGIC_VECTOR (3 downto 0);
iagb,ialb,iaeb : in STD_LOGIC;
agb,alb,aeb : out STD_LOGIC);
end exp6pr;
architecture exp6pr of exp6pr is
begin
process(a,b,iagb,ialb,iaeb)
begin
if a>b then agb<='1';alb<='0';aeb<='0';
SIMULATION OUTPUTS :
VIVA QUESTIONS:
1. What is Magnitude Comparator?
2. To form a 12 – bit comparator how many 4-bit comparators are connected in cascaded form.
3. The IC 7485 is a package and is a ____ comparator.
4. How many cascaded input are there for a 4-bit comparator
7. D-FLIP-FLOP
AIM: Simulation and verification of D-FLIP FLOP(IC-74LS74A) using Xilinx ISE Simulator
APPARATUS:
1. Personal computer -1 no.
2. Xilinx ISE Simulator
PIN DIAGRAM:
LOGIC DIAGRAM:
THEORY:
TheD flip-flop is also known as the Data flip-flop or the Delay flip-flop. It is used to either store the
data or introduce a delay. If a ‘0’ is given at D in ,then S is ‘0’ and R will be ‘1’. This resets the flip-flop. If a
‘1’ is given at Din, then S is ‘1’ and R ‘0’. This sets the flip-flop. Thus we find that D out is always equal to Din.
Hence this flip-flop can be used to store a binary digit. So it is known as the Data flip-flop. The D flip-flop
can also be clocked similar to the RS flip-flop. In the clocked D flip-flop Dout will be made equal to Din
only when the clock arrives. Thus the data bit is sent to the output after a delay. Therefore, the D flip-flop
is also known as the Delay flip-flop.
PROGRAM:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity exp8pr is
Port ( pre,clk,clr,d : in STD_LOGIC;
q,qn : out STD_LOGIC);
end exp8pr;
architecture exp8pr of exp8pr is
signal q1:std_logic:='0';
begin
process(pre,clk,clr,d)
begin
if clr='1' and pre='0' then q1<='1';
elsif clr='0' and pre='1' then q1<='0';
elsif clr='0' and pre='0' then q1<='U';
elsif clr='0' and pre='0' then q1<='U';
else
if clk'event and clk='1' then q1<=d;
else q1<=q1;
end if;
end if;
end process;
q<=q1;qn<=not q1;
end exp8pr;
TEST BENCH:
library ieee;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity exp8pr_tb is
end exp8pr_tb;
architecture exp8pr_tb of exp8pr_tb is
component exp8pr is
port(pre,clk,clr,d:in std_logic;
q,qn:out std_logic);
VIVA QUESTIONS:
1. What is D-FF?
2. Define a latch?
3. Define a FF?
4. What is the difference b/w latch & FF?
5. In flip-flop how many stable states are there?
6. What is edge triggering
7. What is level triggering
8. I/P of D-F/F =’1’, then what is the O/P value Q=
[Link] COUNTER
AIM: Simulation and verification of DECADE COUNTER(IC-7490) using Xilinx ISE Simulator.
APPARATUS:
1. Personal computer -1 no.
2. Xilinx ISE Simulator
PIN DIAGRAM:
LOGIC SYMBOL:
Decimal
QD QC QB QA Equivalent
output
0 0 0 0 0
0 0 0 1 1
0 0 1 0 2
0 0 1 1 3
0 1 0 0 4
0 1 0 1 5
0 1 1 0 6
0 1 1 1 7
1 0 0 0 8
1 0 0 1 9
THEORY:
The decade counter (mod-10 counter) is used most often. In order to count from 0 through 9, a
counter with 3 flip-flops is not sufficient. With 4 flip-flops one can count from 0 to15 (16 states). Out of
these 16 states, we should skip any 6 states. In the decade counter, when the output is 1010 (for the
10thclock pulse), all the flip-flops should be reset. Thus the outputs Q 3 and Q1 are given directly to the
inputs of the AND gate and the outputs Q 2 and Q0 are given through inverters. Therefore, for the 10 th clock
pulse, the counter output would be 1010 for a moment. This sends the output of the AND gate to HIGH
clearing all the flip-flops. Thus a decade counter has been developed.
PROGRAM:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity dec is
port(clk,rst,st:instd_logic;cout:out std_logic_vector(3 downto 0));
end dec;
architecture dec of dec is
signal ci:std_logic_vector(3 downto 0):="0000";
begin
process (clk)
begin
if rst='1' then ci<="0000";
elsif st='1' then ci<="1001";
elsif(clk'event and clk='1') then
ci<=ci+'1';
if(ci="1001")then ci<="0000";
end if;
end if;
end process;
cout<=ci;
end dec;
SIMULATION OUTPUTS:
AIM: Simulation and verification of SHIFT REGISTER(IC-7495A) using Xilinx ISE Simulator.
APPARATUS:
1. Personal computer -1 no.
2. Xilinx ISE Simulator
PIN DIAGRAM:
CIRCUIT DIAGRAM:
A shift register is an n-bit register with a provision for shifting its stored data by one bit position at
each tick of the clock. The serial input, SERIN, specifies a new bit to be shifted into one end at each clock
tick. This bit appears at the serial output, SEROUT, after ‘n’ clock ticks, and is lost one tick later. Thus, an
n-bit serial-in, serial-out shift register can be used to delay a signal by n clock ticks.
A serial-in, parallel-out shift register has outputs for all of its stored bits, making them available to
other circuits. Such a shift register can be used to perform serial-to-parallel conversion.
Conversely, it is possible to build a parallel-in, serial-out shift register. At each clock tick the
register either loads new data from inputs 1D-ND or it shifts its current contents, depending on the value of
the LOAD/SHIFT control input. The device uses a 2-input multiplexer on each flip-flop’s D input to select
between the two cases. A parallel-in, serial-out shift register can be used to perform parallel-to-serial
conversion.
By providing outputs for all of the stored bits in a parallel-in shift register, we obtain the parallel-
in, parallel-out shift register. Such a device is general enough to be used in any of the applications of the
previous shift registers.
PROGRAM:
library ieee;
use ieee.std_logic_1164.all;
entity shiftregister is
port(clk,sein,mode:in std_logic;
pllin:in std_logic_vector(3 downto 0);
cout:out std_logic_vector(3 downto 0));
end shiftregister;
architecture sr of shiftregister is
signal cout1:std_logic_vector(3 downto 0);
begin
process (clk)
begin
if (mode='1' and sein='0')then cout1<=pllin;
elsif (mode='0' and sein='1')then
cout1(0)<='1';
cout1(1)<='0';
cout1(2)<='0';
cout1(3)<='0';
else
cout1<="0000" ;
end if;
end process;
cout<=cout1;
end sr;
VIVA QUESTIONS:
1. What is a register?
2. What is a shift register?
3. What are the operations performed by a shift register?
4. Applications of SISO shift register.
5. Applications of PISO shift register.
6. Applications of SIPO shift register.
7. Applications of PIPO shift register.
8. What is the IC package?
9. What is a universal shift register?
10. What are the operations performed by a universal shift register?
11. Applications of SISO universal shift register.
12. Applications of PISO universal shift register.
13. Applications of SIPO universal shift register.
14. Applications of PIPO universal shift register.
15. What is the IC package?
16. Difference b/w shift register and universal shift register.
APPARATUS:
1. Personal computer -1 no.
2. Xilinx ISE Simulator
library ieee;
use ieee.std_logic_1164.all;
begin
process (clk)
begin
if clear = '1' then
Q <= "0000";
elsif (CLK'event and CLK='1') then
Q(3 downto 1) <= Q(2 downto 0);
Q(0) <= Input_Data;
end if;
end process;
end arch;
library ieee;
use ieee.std_logic_1164.all;
entity piso is
port(mode,clk1,clk2,serial:in std_logic;
a;in std_logic_vector(7 downto 0);
q: buffer std_logic_vector(7 downto 0);
end piso;
architecture behavioral of piso is
begin
process(mode,clk1,clk2,serial,a)
begin
if mode=’1’ and (clk2=’1’ and clk2’event) then q<=a;
elsif mode=’0’ and (clk1=’1’ and clk1’event) then q<= serial&q(3)&q(2)&q(1);
end if;
end process;
MODEL
SIMULATION
OUTPUTS
(SIPO)
RESULT: 8 bit Serial in –parallelout and Parallel in serial-out waveforms are verified.
AIM :Simulation and verification of First in & First out (FIFO) register using Xilinx ISE Simulator.
APPARATUS:
1. Personal computer -1 no.
VHDL code:
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity FIFO is
port(
en : in STD_LOGIC;
clk : in STD_LOGIC;
din : in STD_LOGIC;
dout : out STD_LOGIC
);
end FIFO;
end FIFO_arc;
SIMULATED WAVEFORMS:
RESULT: First in & First out (FIFO) register waveforms are verified.
APPARATUS:
1. Personal computer -1 no.
2. Xilinx ISE Simulator
VHDL code:
entity macunit is
Port ( x,y : in STD_LOGIC_VECTOR (2 downto 0);
clk1,rst1 : in STD_LOGIC;
z : out STD_LOGIC_VECTOR (5 downto 0));
end macunit;
architecture Behavioral of macunit is
component pipo
entity hadder is
Port ( i,j : in STD_LOGIC;
su,ca : out STD_LOGIC);
end hadder;
architecture Behavioral of hadder is
begin
su<= ixor j;
ca<= i and j;
end Behavioral;
entity fulladd is
Port ( d,e,f : in STD_LOGIC;
sum,carry : out STD_LOGIC);
end fulladd;
architecture Behavioral of fulladd is
component and1
Port ( a,b : in STD_LOGIC;
c : out STD_LOGIC);
end component;
begin
sum <= d xor e xor f;
carry <= ((d and e) or ( e and f ) or ( f and d));
end Behavioral;
entity pipo is
Port ( u : in STD_LOGIC_VECTOR (5 downto 0);
clock : in STD_LOGIC;
entity dff is
Port ( data,clk,reset : in STD_LOGIC;
output : out STD_LOGIC);
end dff;
architecture Behavioral of dff is
begin
process(clk)
begin
if(reset='1') then output<= '0';
elsif( clk'event and clk='1') then output<= data;
end if;
end process;
end Behavioral;
SIMULATED OUTPUTS:
AIM:Simulation and verification of ALU ( Arithmetic Logical Unit) using Xilinx ISE Simulator.
APPARATUS:
1. Personal computer -1 no.
2. Xilinx ISE Simulator
BLOCK DIAGRAM:
FUNCTION TABLE:
libraryIEEE;
useIEEE.STD_LOGIC_1164.ALL;
useIEEE.NUMERIC_STD.ALL;
entityalu is
Port ( inp_a : insigned(3 downto0);
inp_b : insigned(3 downto0);
sel : inSTD_LOGIC_VECTOR(2 downto0);
out_alu : outsigned(3 downto0));
endalu;
architectureBehavioral ofalu is
begin
process(inp_a, inp_b, sel)
begin
casesel is
when"000"=>
out_alu<= inp_a + inp_b; --addition
when"001"=>
out_alu<= inp_a - inp_b; --subtraction
when"010"=>
out_alu<= inp_a - 1; --sub 1
when"011"=>
out_alu<= inp_a + 1; --add 1
when"100"=>
out_alu<= inp_a andinp_b; --AND gate
when"101"=>
out_alu<= inp_a orinp_b; --OR gate
when"110"=>
out_alu<= notinp_a ; --NOT gate
endprocess;
endBehavioral;
SIMULATED OUTPUTS: