VHDL Sequential
VHDL Sequential
VHDL Sequential
Circuits:
Positive edge triggered JK Flip Flop with reset input
Here is the code for JK Flip flop which is positive edge triggered.The flip flop also has a reset input which
when set to '1' makes the output Q as '0' and Qbar as '1'.
port
port
port
port
map
map
map
map
(clk,'1','1',Q1,Qbar1,reset);
(clk,Q1,Q1,Q2,Qbar2,reset);
(clk,J3,J3,Q3,Qbar3,reset);
(clk,J4,J4,Q4,Qbar4,reset);
I have written a VHDL code for a 4-bit ring counter which has the following states:
0001 - 0010 - 0100 - 1000 ....
The code is posted below:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity ring_counter is
port (
DAT_O : out unsigned(3 downto 0);
RST_I : in std_logic;
CLK_I : in std_logic
);
end ring_counter;
architecture Behavioral of ring_counter is
signal temp : unsigned(3 downto 0):=(others => '0');
begin
DAT_O <= temp;
process(CLK_I)
begin
if( rising_edge(CLK_I) ) then
if (RST_I = '1') then
temp <= (0=> '1', others => '0');
else
temp(1) <= temp(0);
temp(2) <= temp(1);
temp(3) <= temp(2);
temp(0) <= temp(3);
end if;
end if;
end process;
end Behavioral;
--architecture of the
end Behavioral;