Ddco Assignment
Ddco Assignment
Flipflop
Truth Table
state Next state
Q1 Q2 Q3
0 0 0 0 0 1
0 0 1 0 1 0
0 1 0 0 1 1
0 1 1 1 0 0
1 0 0 1 0 1
1 0 1 0 0 0
Logic Diagram
Code
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity mod_6_up_counter is
port (
clk : in std_logic;
rst : in std_logic;
);
begin
process(clk, rst)
begin
t1 <= '0';
t2 <= '0';
t3 <= '0';
if t1 = '1' then
if t2 = '1' then
end if;
end if;
end if;
end process;
Waveform
Q1 Q2 Q3
1 0 1 1 0 0
1 0 0 0 1 1
0 1 1 0 1 0
0 1 0 0 0 1
0 0 1 0 0 0
0 0 0 1 0 1
Logic Diagram
Code
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity mod6_down_counter is
rst : in STD_LOGIC;
end mod6_down_counter;
architecture Behavioral of mod6_down_counter is
begin
process(clk, rst)
begin
q <= "111";
if q = "000" then
else
q <= q - 1; -- Decrement
end if;
end if;
end process;
count <= q;
end Behavioral;
Waveform