anoop12
Member level 5
Hi All,
I have written code for divide by 2 counter. I have to modify it for divide by
4 counter.
Does anyone knows how to modify it?
Any other way?
Thanks
Here is the code
---------------------------------------
library ieee;
use ieee.std_logic_1164.all;
entity divide_by_2 is
port (
clk_i : in std_logic;
reset : in std_logic;
clk_div2 : out std_logic
);
end divide_by_2 ;
architecture rtl of divide_by_2 is
signal q : std_logic;
begin
process(clk_i,reset)
begin
if (reset = '0') then
q <= '0';
elsif (clk_i'event and clk_i = '1') then
q <= not (q);
end if;
end process ;
clk_div2 <= q;
end rtl;
-----------------------------------------
I have written code for divide by 2 counter. I have to modify it for divide by
4 counter.
Does anyone knows how to modify it?
Any other way?
Thanks
Here is the code
---------------------------------------
library ieee;
use ieee.std_logic_1164.all;
entity divide_by_2 is
port (
clk_i : in std_logic;
reset : in std_logic;
clk_div2 : out std_logic
);
end divide_by_2 ;
architecture rtl of divide_by_2 is
signal q : std_logic;
begin
process(clk_i,reset)
begin
if (reset = '0') then
q <= '0';
elsif (clk_i'event and clk_i = '1') then
q <= not (q);
end if;
end process ;
clk_div2 <= q;
end rtl;
-----------------------------------------