process( Clk_in)
variable ScaleCount: Std_logic_vector( 4 downto 0) := "00000";
begin
if Rising_edge( Clk_in) then
Clk_Out <= '0';
ScaleCount := ScaleCount+1;
if ScaleCount=Scale then
Clk_out <= '1';
ScaleCount := "00000";
end if;
end if;
end process;
entity clk_div is
Port ( clk : in STD_LOGIC;
div: in STD_LOGIC_VECTOR(3 downto 0);
div_clk : out STD_LOGIC);
end clk_div;
architecture Behavioral of clk_div is
signal var: STD_LOGIC_VECTOR(15 downto 0):= (others => '0');
begin
process(clk)
begin
if(clk'event and clk = '1') then
var <= var + '1';
end if;
if(clk'event and clk = '0') then
var <= var + '1';
end if;
div_clk <= var(conv_integer(div));
end process;
end Behavioral;
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.