Question: Project Part 2 :: VHDL Sequential Logic Follow the instructions below. Use the attached VHDL files as a basis for the project. ( The instructions

Project Part 2:: VHDL Sequential Logic
Follow the instructions below. Use the attached VHDL files as a basis for the project.
(The instructions are shown in the image) as well as the testbench code and design
B Clocked D-flipflop with NAND Gates
Below is the circuit diagram for the D-flipflip with NAND Gates that is Clocked. On the website with this assignment, you will find working code for this circuit along with working testbench code. Hint: to see how this works without excess clutter, run the the code and on the EPWave page, click on the name of each trace and remove it with the red X button, EXCEPT for D, Q, clock, and Reset. This will show you how the circuit works with Q rising on the next clock edge after D and Reset go to 1.
C Exam Question: Clocked JK-Flipflop Use the circuit/VHDL code above (again, found on the page with this assignment) to implement a clocked JK-flipflip. See the diagram below:
NOTE: LEAVE THE RESET ALONE, DO NOT CHANGE THE WIRING FOR IT! YOU WILL HAVE TO TRIGGER THE RESET WHENEVER J OR K CHANGES, HOWEVER!! Basically you are treating the circuit beling supplied to you as the box in the circuit diagram above. For a JK flipflop
(THE TEST BENCH CODE)
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY DFF_tb IS
END DFF_tb;
ARCHITECTURE behavior OF DFF_tb IS
COMPONENT D_latch_nand
PORT(
D : IN std_logic;
Reset : IN std_logic;
Q : OUT std_logic;
clock : IN std_logic;
);
END COMPONENT;
signal din : std_logic :='0';
signal clk : std_logic :='0';
signal rst : std_logic :='0';
signal dout : std_logic;
constant clk_period : time :=10 ns;
BEGIN
uut: D_latch_nand PORT MAP (
D => din,
Reset => rst,
Q => dout,
clock => clk
);
clk_process :process
begin
for i in 1 to 24 loop
clk ='0';
wait for 3 ns;
clk ='1';
wait for 3 ns;
end loop;
wait;
end process;
stim_proc: process
begin
--set up, store zero
rst ='1';
din ='0';
wait for 15 ns;
-- read a zero, ignore input
rst ='0';
din ='0';
wait for 15 ns;
-- ignore input, still output zero
rst ='0';
din ='1';
wait for 15 ns;
-- ignore input, still output zero
rst ='0';
din ='0';
wait for 15 ns;
-- store a 1
rst ='1';
din ='1';
wait for 15 ns;
--ignore input, read a 1
rst ='0';
din ='0';
wait for 15 ns;
-- store zero again
rst ='1';
din ='0';
wait for 15 ns;
-- read a zero, ignore input
rst ='0';
din ='0';
wait for 15 ns;
-- store a 1
rst ='1';
din ='1';
wait for 15 ns;
--ignore input, read a 1
rst ='0';
din ='0';
wait for 15 ns;
wait;
end process;
END;
(DESIGN CODE)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity D_latch_nand is
Port ( D : in STD_LOGIC;
Reset : in STD_LOGIC;
Q : inout STD_LOGIC;
clock : in STD_LOGIC);
end D_latch_nand;
architecture Behavioral of D_latch_nand is
signal notQ : STD_LOGIC;
signal S, R : STD_LOGIC;
signal intermedTop, intermedBottom : STD_LOGIC ;
begin
intermedBottom = not (D and reset and R) ;
intermedTop = S nand intermedBottom ;
-- AND gates for enable
S = not (clock and Reset and intermedTop);
R = not (clock and S and intermedBottom);
-- SR latch
Q = S nand notQ;
notQ = not (R and Q and Reset);
end Behavioral;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Electrical Engineering Questions!