Professional Documents
Culture Documents
3
FLIP FLOP
Course Code: CPE 402 Program: BSCPE
Course Title: Advanced Logic Circuit Date Performed: November 22, 2016
Section: CPE42FB1 Date Submitted: November 29, 2016
Members: Nonat, Paul Vincent Instructor: Engr. Menchie Miranda
De Vera, Jim Paul
Banoog, Davies
Tampoco, Jonaliza
1. Objective(s):
The activity aims to differentiate the other types of Flip Flop
2. Intended Learning Outcomes (ILOs):
The students shall be able to:
2.1 Compare the clock signal of JK ,D Flip Flop, and T Flip Flop
2.2 Identify the Look Up Table (LUT), Input Output Block (IOB), number of
Slices and Propagation delay of each circuit.
3. Discussion:
D flip flop is actually a slight modification of the above explained clocked SR flip-flop.
From the figure you can see that the D input is connected to the S input and the
complement of the D input is connected to the R input. The D input is passed on to the
flip flop when the value of CP is 1. When CP is HIGH, the flip flop moves to the SET
state. If it is 0, the flip flop switches to the CLEAR state.
J-K flip flop can also be defined as a modification of the S-R flip flop. The only difference
is that the intermediate state is more refined and precise than that of a S-R flip flop.
The behavior of inputs J and K is same as the S and R inputs of the S-R flip flop. The
letter J stands for SET and the letter K stands for CLEAR.
Figure 3.2 Logic Diagram and Block Diagram of JK Flip Flop
When both the inputs J and K have a HIGH state, the flip-flop switch to the complement
state. So, for a value of Q = 1, it switches to Q=0 and for a value of Q = 0, it switches to
Q=1.
4. Resources:
5. Procedure:
Create a new ISE project which will target the FPGA device on Spartan 6 SP601
Evaluation Board.
5.1.1 In the File> New Project > to open the New Project Wizard.
5.1.2 In the Project Name field type D_Flip Flop.
5.1.3 In the Project menu choose New Source.
5.1.4 Select Source type dialog box select VHDL Module Source
5.1.5 File Name field type Latch.
5.1.6 Verify that the Add to Project checkbox is selected. Click Next
5.1.7 In the Entity Name field type dff and in Architecture Name field type behv .
5.1.8 Double click the Port name field and declare the necessary variables or identifier.
begin
process(D, clock)
variable temporary: std_logic;
begin
ENTITY DFF_test IS
END DFF_test;
COMPONENT BDNT_D_FLIPFLOP
PORT(
D : IN std_logic;
clock : IN std_logic;
Q : OUT std_logic;
Qbar : OUT std_logic
);
END COMPONENT;
signal D : std_logic := '0';
signal clock : std_logic := '0';
signal Q : std_logic;
signal Qbar : std_logic;
constant clock_period : time := 10 ns;
BEGIN
process
begin
clock <= '1';
wait for clock_period/2;
clock <= '0';
wait for clock_period/2;
end process;
process
begin
D <='0';
wait for clock_period*0.5;
D <='1';
wait for clock_period*0.5;
D <='1';
wait for clock_period*0.5;
D <='0';
wait for clock_period*0.5;
end process;
END;
VHDL Test Bench Screenshot
Sketch the resulting RTL Schematic of D Flip Flop
Number of Slices: 0
Number of 4 input LUTs : 0
Number of bonded IOBs: 3
Sketch of simulation timing diagram D Flip Flop
JK Flip Flop VHDL Code
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity BDNT_JKFLIPFLOP is
port (
J, K: in std_logic;
clock: in std_logic;
Q, Qbar: out std_logic
);
end BDNT_JKFLIPFLOP;
architecture Behavioral of BDNT_JKFLIPFLOP is
begin
process(clock)
variable temporary : std_logic;
begin
if(rising_edge(clock)) then
if(J='0' and K='0') then
temporary := temporary;
elsif(J='1' and K='1') then
temporary := not temporary;
elsif(J='0' and K='1') then
temporary :='0';
elsif(J='1' and K='0') then
temporary :='1';
end if;
end if;
Q <= temporary;
Qbar <= not temporary;
end process;
end Behavioral;
VHDL Module Screenshot
Number of Slices: 1
Number of 4 input LUTs : 2
Number of bonded IOBs: 5
Sketch of simulation timing diagram D Flip Flop
T Flip Flop VHDL Code
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity BDNT_T_FLIPFLOP is
port(
T, clk, rst : in std_logic;
Q : out std_logic;
Qbar : out std_logic
);
end BDNT_T_FLIPFLOP;
architecture Behavioral of BDNT_T_FLIPFLOP is
signal x : std_logic;
begin
process(T,clk)
begin
if rst = '1' then
x <= '0';
elsif rising_edge(clk) then
if T = '1' then
x <= not x;
else
x <= x;
end if;
end if;
Q <= x;
Qbar <= not x;
end process;
end Behavioral;
VHDL Module Screenshot
T Flip Flop Test Bench
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY test2 IS
END test2;
UUT : BDNT_T_FLIPFLOP
port map (T,clk,rst,Q,Qbar);
clk_pro: process
begin
clk <= '1';
wait for 5 ns;
clk <= '0';
wait for 5 ns;
end process;
sti_pro: process
begin
T <= '0';
rst <= '0';
wait for 10 ns;
T <= '0';
rst <= '0';
wait for 10 ns;
T <= '1';
rst <= '0';
wait for 10 ns;
T <= '0';
rst <= '1';
wait for 10 ns;
end process;
END behavior;
Number of Slices: 0
Number of 4 input LUTs : 0
Number of bonded IOBs: 3
Sketch of simulation timing diagram of T Flip Flop
Course: CPE 402 Experiment No.: 3
Group No.: 1 Section: CPE42FB1
Group Members: Nonat, Paul Vincent Date Performed: November 22, 2016
De Vera, Jim Paul Date Submitted: November 29, 2016
Banoog, Davies Instructor: Engr. Menchie Miranda
Tampoco, Jonaliza
7. Data and Results:
Flip-flops or latches are used as data storage elements for multi-valued logic. Flip
flop can be simple or clocked. Simple flip-flops or transparent are commonly
used for storage elements.
Basic types of flip-flops include (a) S-R Flip Flop, (b) Delay or D Flip Flop, (c) J-K
Flip Flop, and T Flip Flop. S-R or set-reset is the basic type of Flip-flops is
designed with the help of two NOR gates and also two NAND gates. D Flip-flops
is a modification of S-R it has two AND gates and TWO NOR gates and an
inverted D input. The behavior of input J and K is the same as the S and R inputs
of the S-R flip-flops. T flip-flops contain two AND gates with three inputs and two
NOR gates.
8. Conclusion:
Flip-flops are the applications of logic gates. It can be used as data storage
elements. There are four basic types of flip-flops. S-R flip-flops is the basic type it
has two inputs the set and reset and has an output of Q and Q'. D flip-flops is a
modification of S-R flip-flops. It has two inputs D and the clock pulse, the D
inverted is directly connected to R input. J-K flip-flops, J Stands for SET and K
stands for clear. This type of flip-flops has the same behavior as the S-R flip-
flops. Lastly, T flip-flops are the same as the J-K type except for both inputs of J-
K is a single input.
9. Assessment (Rubric for Laboratory Performance):