Académique Documents
Professionnel Documents
Culture Documents
AVANTHIS
St. THERESSA INSTITUTE
OF ENGINEERING & TECHNOLOGY
(Approved by A.I.C.T.E Recognized by the Govt. of A.P & Affiliated to JNTU, Kakinada)
: _________________________________________
ROLL NO
: _________________________________________
BRANCH
: _________________________________________
ASTIET
Dept. of ECE
Page 1
ECAD LAB
INDEX
S.No
Date
Remarks
(Lab In-charge)
ASTIET
Dept. of ECE
Page 2
ECAD LAB
HARDWARE
EXPERIMENTS
ASTIET
Dept. of ECE
Page 3
ECAD LAB
1. LOGIC GATES
AIM: To study and verify the truth tables of Logic Gates.
APPARATUS:
PIN DIAGRAM:
TRUTH TABLE:
ASTIET
Dept. of ECE
Page 4
ECAD LAB
PIN DIAGRAM:
TRUTH TABLE:
ASTIET
Dept. of ECE
Page 5
ECAD LAB
LOGIC SYMBOL:
PIN DIAGRAM:
TRUTH TABLE:
ASTIET
Dept. of ECE
Page 6
ECAD LAB
PIN DIAGRAM:
7400
TRUTH TABLE:
PIN DIAGRAM:
ASTIET
Dept. of ECE
Page 7
ECAD LAB
TRUTH TABLE:
PIN DIAGRAM:
TRUTH TABLE:
ASTIET
Dept. of ECE
Page 8
ECAD LAB
PIN DIAGRAM:
IC 74266
TRUTH TABLE:
PROCEDURE:
1. Connect the IC as shown in figures for(AND,OR,NAND,NOR and Ex-OR gates).
2. Apply the logic signal 0 or 1 from the logic input switches at input A & B.
3. Monitor the output using logic output LED indicator.
RESULT:
ASTIET
Dept. of ECE
Page 9
ECAD LAB
2. 3 TO 8 DECODER 74138
AIM: To verify the operation of the 3 to 8 decoder (74138).
APPARATUS:
THEORY:
A decoder is a multiple-input, multiple output logic circuit that converts coded inputs into
coded outputs, where the ipnput and output codes are different. The input code generally has fewer
bits than the output code.
PIN DIAGRAM:
FUNCTION TABLE:
ASTIET
Dept. of ECE
Page 10
ECAD LAB
LOGIC DIAGRAM:
PROCEDURE
1. Make the connections as per circuit diagram.
2. Change the values of G1, G2A, G3B, A, B, C using switches
3. Observe status of Y0 to Y7 on LEDs as for truth table.
RESULT:
ASTIET
Dept. of ECE
Page 11
ECAD LAB
THEORY:
The 151 selects one-of-eight data sources. The 151A have a strobe input which must be at a
low logic level to enable these devices. A high level at the strobe forces the W output high and the Y
output (as applicable) low.
PROCEDURE:
1. Switch on the trainer
2. Connect data input (I0-I7) to logic switches with the help of wire connect output to logic indicator.
3. Put S0=o, S1=0 and observe the output by changing input leaves. With this we can notice that the
output is following only I0and the other input cannot affect the output.
4. Observe mux output for S0, S1, and S2 combination and verify result with the truth table.
De mux
5. Verify the output by using select lines A has active high input and using select lines B has an active
low output.
6. Put always strobe i.e.Ga/Gb in low.
PIN DIAGRAM:
ASTIET
Dept. of ECE
Page 12
ECAD LAB
TRUTH TABLE:
LOGIC DIAGRAM:
RESULT:
ASTIET
Dept. of ECE
Page 13
ECAD LAB
THEORY:
These 4-bit magnitude comparators perform comparison of straight binary or BCD codes.
Three fully-decoded decisions about two, 4-bit words (A, B) are made and are externally available at
three outputs. These devices are fully expandable to any number of bits without external gates. Words
of greater length may be compared by connecting comparators in cascade. The A < B, A > B, and A =
B outputs of a stage handling less-significant bits are connected to the corresponding inputs of the
next stage handling more-significant bits. The stage handling the least-significant bits must have a
high-level voltage applied to the A = B input.
PROCEDURE
1. Connect the circuit as shown in figure. Feed the 4-bit binary word A0,A1,A2, A3 and B0,B1,B2,B3
from logic input Switches .
2. Pin 3 of IC 7485 should be logic input 1 to enable comparator operation.
3. Observe the output A>B,A=B, A<B on logic indicator. The output most be 1 or 0respectively
4. Repeat the step 1,2 and 3 for various input A0,A1,A2,A3 and B0,B1,B2,B3.
PIN DIAGRAM:
ASTIET
Dept. of ECE
Page 14
ECAD LAB
FUNCTION TABLE:
LOGIC DIAGRAM:
PROCEDURE
1. Connect the circuit as
shown in figure. Feed the 4bit binary word A0,A1,A2,
A3 and B0,B1,B2,B3 from
logic input Switches .
2. Pin 3 of IC 7485 should
be logic input 1 to enable
comparator operation.
3. Observe the output
A>B,A=B, A<B on logic
indicator. The output most
be 1 or 0 respectively
4. Repeat the step 1,2 and 3
for various input
A0,A1,A2,A3 and
B0,B1,B2,B3.
RESULT:
ASTIET
Dept. of ECE
Page 15
ECAD LAB
5. D FLIP-FLOP 7474
AIM: To study the operation of D Flip-Flop (7474).
APPARATUS:
1. D Flip-Flop trainer kit
2. IC 7474
3. patch cards
THEORY:
These device containstwo independent D-type positive edge triggered flip-flops. A low level
at he preset or clear inputs set or resets the output regardless of the levels of the other inputs. When
preset and clear are inactive, data at the D flip-flop inputare transferred to the output on the positive
going edge of the clock pulse.
PROCEDURE:
1. Connect the logic gate of D-flip flop as shown in figure.
2. Apply the logic signal 0 or 1 from the logic input switches at the input A and B.
3. Observe the output at LED indicator.
PIN DIAGRAM:
ASTIET
Dept. of ECE
Page 16
ECAD LAB
FUNCTION TABLE:
LOGIC DIAGRAM:
RESULT:
ASTIET
Dept. of ECE
Page 17
ECAD LAB
RESET/COUNT
TRUTH TABLE:
ASTIET
Dept. of ECE
Page 18
ECAD LAB
LOGIC DIAGRAM:
PROCEDURE
1. Switch on the trainer.
2. Make the connections as per circuit diagram.
3. Connect the input B to the Qa output.
4. Put reset at inputs Ro1, Ro2, So1,So2as given in the count truth table.
5. Apply the pulse from 0-9 and observe the outputs at Qa,Qb,Qc,Qd for each pulse.
RESULT:
ASTIET
Dept. of ECE
Page 19
ECAD LAB
ASTIET
Dept. of ECE
Page 20
ECAD LAB
LOGIC DIAGRAM:
PROCEDURE:
1. Switch on the trainer.
2. Make the connections as per circuit diagram
3. Put reset at inputs Ro1, Ro2has given in the count truth table.
4.Apply the pulse from 0-15 and observe the outputs at Qa,Qb,Qc,Qd for each pulse.
RESULT:
ASTIET
Dept. of ECE
Page 21
ECAD LAB
TRUTH TABLE:
LOGIC DIAGRAM:
ASTIET
Dept. of ECE
Page 22
ECAD LAB
PROCEDURE
1.
2.
3.
4.
5.
6.
7.
8.
9.
RESULT:
ASTIET
Dept. of ECE
Page 23
ECAD LAB
SOFTWARE
EXPERIMENTS
ASTIET
Dept. of ECE
Page 24
ECAD LAB
1. LOGIC GATES
AIM: To simulate the Logic Gates.
APPARATUS:
1. Computer System
2. Xilinx ISE 10.1
3. Modelsim 6.5b Simulator
AND GATE (IC 7408) DEFINITION:
A Logic AND Gate is a type of digital logic gate that has an output which is normally at logic
level "0" and only goes "HIGH" to a logic level "1" when ALL of its inputs are at logic level "1". The
output of a Logic AND Gate only returns "LOW" again when ANY of its inputs are at a logic level
"0". The logic or Boolean expression given for a logic AND gate is that for Logical Multiplication
which is denoted by a single dot or full stop symbol, ( . ) giving us the Boolean expression
of: A.B = Q.
LOGIC DIAGRAM:
TRUTH TABLE:
VHDL CODE:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity ANDGATE
Port ( A :
B :
C :
end ANDGATE;
is
in STD_LOGIC;
in STD_LOGIC;
out STD_LOGIC);
ASTIET
Dept. of ECE
Page 25
ECAD LAB
TRUTH TABLE:
VHDL CODE:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity ORGATE is
Port ( A : in STD_LOGIC;
B : in STD_LOGIC;
C : out STD_LOGIC);
end ORGATE;
architecture Dataflow of ORGATE is
begin
C<=A OR B;
end Dataflow;
ASTIET
Dept. of ECE
Page 26
ECAD LAB
TRUTH TABLE:
VHDL CODE:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity NOTGATE is
Port ( A : in STD_LOGIC;
C : out STD_LOGIC);
end NOTGATE;
architecture Dataflow of NOTGATE is
begin
C<= NOT A;
end Dataflow;
NAND GATE (IC 7400) DEFINITION:
The Logic NAND Gate is a combination of the digital logic AND gate with that of an
inverter or NOT gate connected together in series. The NAND (Not - AND) gate has an output that is
normally at logic level "1" and only goes "LOW" to logic level "0" when ALL of its inputs are at
logic level "1". The Logic NAND Gate is the reverse or "Complementary" form of the AND gate we
have seen previously.
LOGIC DIAGRAM:
ASTIET
Dept. of ECE
Page 27
ECAD LAB
TRUTH TABLE:
VHDL CODE:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity NANDGATE is
Port ( A : in STD_LOGIC;
B : in STD_LOGIC;
C : out STD_LOGIC);
end NANDGATE;
architecture Dataflow of NANDGATE is
begin
C<=A NAND B;
end Dataflow;
NOR GATE (IC 7402) DEFINITION:
The Logic NOR Gate or Inclusive-NOR gate is a combination of the digital logic OR gate
with that of an inverter or NOT gate connected together in series. The NOR (Not - OR) gate has an
output that is normally at logic level "1" and only goes "LOW" to logic level "0" when ANY of its
inputs are at logic level "1". The Logic NOR Gate is the reverse or "Complementary" form of the OR
gate we have seen previously.
LOGIC DIAGRAM:
TRUTH TABLE:
ASTIET
Dept. of ECE
Page 28
ECAD LAB
VHDL CODE:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity NORGATE
Port ( A :
B :
C :
end NORGATE;
is
in STD_LOGIC;
in STD_LOGIC;
out STD_LOGIC);
TRUTH TABLE:
VHDL CODE:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity XORGATE
Port ( A :
B :
C :
end XORGATE;
is
in STD_LOGIC;
in STD_LOGIC;
out STD_LOGIC);
Page 29
ECAD LAB
The Exclusive-NOR Gate function or Ex-NOR for short, is a digital logic gate that is the
reverse or complementary form of the Exclusive-OR. The Exclusive-NOR gate is a combination of
the Exclusive-OR gate and the NOT gate. It has an output that is normally at logic level "0" when
ANY of its inputs are at logic level "1".
LOGIC DIAGRAM:
TRUTH TABLE:
VHDL CODE:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity XNORGATE is
Port ( A : in STD_LOGIC;
B : in STD_LOGIC;
C : out STD_LOGIC);
end XNORGATE;
architecture Dataflow of XORGATE is
begin
C<=A XNOR B;
end Dataflow;
RESULT:
ASTIET
Dept. of ECE
Page 30
ECAD LAB
2. 3 to 8 DECODER 74138
AIM: To simulate and synthesize 3 to 8 decoder (74138).
APPARATUS: 1. Computer System
2. Xilinx ISE 10.1
3. Modelsim 6.5b Simulator
THEORY:
A decoder is a multiple-input, multiple output logic circuit that converts coded inputs into
coded outputs, where the ipnput and output codes are different. The input code generally has fewer
bits than the output code.
PIN DIAGRAM:
FUNCTION TABLE:
ASTIET
Dept. of ECE
Page 31
ECAD LAB
Page 32
ECAD LAB
elsey_l<= "11111111";
end if;
end process;
end Behavioral;
RESULT:
ASTIET
Dept. of ECE
Page 33
ECAD LAB
LOGIC DIAGRAM:
ASTIET
Dept. of ECE
Page 34
ECAD LAB
Page 35
ECAD LAB
-1 no.
-ver. 12.3
BLOCK DIAGRAM:
TRUTH TABLE:
ASTIET
Dept. of ECE
Page 36
ECAD LAB
VHDL CODE:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entitydemux is
port( c1, c2: in std_logic; -- data inputs
g1_l, g2_l: in std_logic; --enable inputs
sel: in std_logic_vector(1 downto 0); --select input
y1, y2: out std_logic_vector(3 downto 0)); --output
enddemux;
architecturedemux of demux is
begin
process( c1, c2, g1_l, g2_l, sel)
begin
y1 <= "1111"; y2<= "1111"; --initilize output
if( g1_l = '0') then
casesel is
when "00" => y1(0) <= c1;
when "01" => y1(1) <= c1;
when "10" => y1(2) <= c1;
when "11" => y1(3) <= c1;
when others=> null;
end case;
end if;
if( g2_l = '0') then
casesel is
when "00" => y2(0) <=
when "01" => y2(1) <=
when "10" => y2(2) <=
when "11" => y2(3) <=
when others=> null;
end case;
end if;
end process;
enddemux;
c2;
c2;
c2;
c2;
RESULT:
ASTIET
Dept. of ECE
Page 37
ECAD LAB
ASTIET
Dept. of ECE
Page 38
ECAD LAB
LOGIC DIAGRAM:
ASTIET
Dept. of ECE
Page 39
ECAD LAB
ASTIET
Dept. of ECE
Page 40
ECAD LAB
5. D FLIP-FLOP 7474
AIM: To simulate and synthesize D Flip-Flop (7474).
APPARATUS:
1. Computer System
2. Xilinx ISE 10.1
3. Modelsim 6.5b Simulator
THEORY:
These device containstwo independent D-type positive edge triggered flip-flops. A low level
at he preset or clear inputs set or resets the output regardless of the levels of the other inputs. When
preset and clear are inactive, data at the D flip-flop inputare transferred to the output on the positive
going edge of the clock pulse.
FUNCTION TABLE:
LOGIC DIAGRAM:
ASTIET
Dept. of ECE
Page 41
ECAD LAB
STD_LOGIC;
ASTIET
Dept. of ECE
Page 42
ECAD LAB
TRUTH TABLE:
LOGIC DIAGRAM:
ASTIET
Dept. of ECE
Page 43
ECAD LAB
ASTIET
Dept. of ECE
Page 44
ECAD LAB
TRUTH TABLE:
ASTIET
Dept. of ECE
Page 45
ECAD LAB
LOGIC DIAGRAM:
ASTIET
Dept. of ECE
Page 46
ECAD LAB
ASTIET
Dept. of ECE
Page 47
ECAD LAB
ASTIET
Dept. of ECE
Page 48
ECAD LAB
9. RAM (74189)
AIM: To simulate and synthesize RAM (74189).
APPARATUS:
1. Computer System
2. Xilinx ISE 10.1
3. Modelsim 6.5b Simulator
THEORY:
The behaviour of the 74189 circuit is controlled by just two active-low control lines, namely
the chip select and read/write inputs:
nCS=1: the data outputs are tri-stated and the clock signal for the latches in the memory
matrix is disabled.
nCS=0, Read/nWrite=1: the data outputs are enabled and driven with the contents of the
currently addressed memory word. When the address input is changed, the contents of the
newly selected memory word will appear on the data outputs, delayed by the memory access
time.
nCS=0, Read/nWrite=0: the clock signal of the currently addressed memory latches is
enabled, so that the values on the data input bus is copied into the selected memory word
(transparent latches). Also, the data outputs are enabled. Switch the Read/nWrite signal back
to the high (1) state to store the data.
To get accustomed to the behaviour of the SRAM, it is a good exercise to try to write a few data
words into the memory (e.g. the values shown in the screenshot above).
Due to the asynchronous interface of the RAM, great care must be taken to avoid hazard
conditions on either of the Read/nWrite and address inputs. A good example is provided by the
following procedure to clear all RAM contents: 1. clear the data inputs (value 0000), 2. enable the
Read/nWrite signal (value 0), 3. step through all addresses. Needless to say that such tricks are not
recommended for real system designs...
ASTIET
Dept. of ECE
Page 49
ECAD LAB
ASTIET
Dept. of ECE
Page 50
ECAD LAB
1. Computer System
2. Xilinx ISE 10.1
3. Modelsim 6.5b Simulator
DESCRIPTION:
STACK:A stack is simply a Last in First out (LIFO) memory structure. Every stack has a stack
pointer (SP) which acts as an address for accessing the elements. But normally the user of the stack is
not concerned with the absolute address of the stack; he is only concerned with the PUSH and POP
instructions.
QUEUE:A queue is a container of objects (a linear collection) that are inserted and removed
according to the first-in first-out (FIFO) principle. An excellent example of a queue is a line of
students in the food court of the UC. New additions to a line made to the back of the queue, while
removal (or serving) happens in the front. In the queue only two operations are allowed enqueue and
dequeue. Enqueue means to insert an item into the back of the queue, dequeue means removing the
front item. The picture demonstrates the FIFO access. The difference between stacks and queues is in
removing. In a stack we remove the item the most recently added; in a queue, we remove the item the
least recently added.
VHDL CODE:
1) IMPLEMENTING A FIFO QUEUE IN VHDL
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entityfifo is
port ( clk : in std_logic; enr : in std_logic;
enw : in std_logic;
dataout : out std_logic_vector(3 downto 0); --output data
datain : in std_logic_vector (3 downto 0); --input data
empty : out std_logic; --set as '1' when the queue is empty
full : out std_logic --set as '1' when the queue is full );
endfifo;
architecture Behavioral of fifo is
typememory_type is array (0 to 15) of std_logic_vector(3 downto 0);
signal memory : memory_type :=(others => (others => '0'));
signalreadptr,writeptr : std_logic_vector(3 downto 0) :="0000";
begin
process(clk)
begin
if(clk'event and clk='1' and enr ='1') then
dataout<=memory(conv_integer(readptr)); readptr<=readptr+'1';
end if;
if(clk'event and clk='1' and enw ='1') then
ASTIET
Dept. of ECE
Page 51
ECAD LAB
ASTIET
Dept. of ECE
Page 52
ECAD LAB
PUSH : process(Clk,PUSH_barPOP,Enable)
begin
if(rising_edge(Clk)) then --PUSH section.
if (Enable = '1' and PUSH_barPOP = '1' and full = '0') then
--Data pushed to the current address.
stack_mem(stack_ptr) <= Data_In;
if(stack_ptr /= 0) then
stack_ptr<= stack_ptr - 1;
end if; --setting full and empty flags
if(stack_ptr = 0) then
full<= '1';empty <= '0';
elsif(stack_ptr = 15) then
full<= '0';empty <= '1';
else full <= '0';empty <= '0';
end if;
end if;
--POP section.
if (Enable = '1' and PUSH_barPOP = '0' and empty = '0') then
--Data has to be taken from the next highest address(empty
descending type stack).
if(stack_ptr /= 15) then
Data_Out<= stack_mem(stack_ptr+1);
stack_ptr<= stack_ptr + 1;
end if;
--setting full and empty flags
if(stack_ptr = 0) then
full<= '1';empty <= '0';
elsif(stack_ptr = 15) then
full<= '0';empty <= '1';
else full <= '0';empty <= '0';
end if;
end
end
end
end
if;
if;
process;
Behavioral;
ASTIET
Dept. of ECE
Page 53
ECAD LAB
FUNCTION TABLE:
ASTIET
Dept. of ECE
Page 54
ECAD LAB
is
in STD_LOGIC_VECTOR (3 downto 0);
in STD_LOGIC_VECTOR (3 downto 0);
in STD_LOGIC_VECTOR (2 downto 0);
: in STD_LOGIC;
out STD_LOGIC_VECTOR (3 downto 0));
ASTIET
Dept. of ECE
Page 55