Monday 16 December 2013

RING COUNTER (4-Bit) -(Behavioral)

library ieee;
use ieee.std_logic_1164.all;
Entity R_COUNTER is
port(clr,clk,pr:in std_logic;Q0,Q1,Q2,Q3:out std_logic);
end R_COUNTER;
Architecture behavioral of R_COUNTER is
signal temp : std_logic_vector(3 downto 0):="0001";
begin
process( clr,clk,pr)
begin
if (pr ='0') then Q0<='1';Q1<='1';Q2<='1';Q3<='1';
elsif (clr ='0') then Q0<='0';Q1<='0';Q2<='0';Q3<='0';
elsif clk='1' and clk'event then
temp<=temp(0) & temp(3 downto 1);
Q0<=temp(3); Q1<=temp(2); Q2<=temp(1); Q3<=temp(0);
end if;
end process;
end behavioral;

No comments:

Post a Comment