library ieee;use ieee.std_logic_1164.all;use ieee.numeric_std.all;entity up_counter isgeneric (G_MIN_NUMBER : natural := 0;G_MAX_NUMBER : natural := 10);port (i_clk : in std_logic;i_rst : in std_logic;-- Count when this input is '1'i_valid : in std_logic;-- Output the actual numbero_data : out natural := G_MIN_NUMBER;o_carry : out std_logic := '0');end up_counter;architecture rtl of up_counter issignal number : natural range G_MIN_NUMBER to G_MAX_NUMBER := G_MIN_NUMBER;begino_data <= number;counter : process( i_clk )beginif( rising_edge( i_clk ) ) theno_carry <= '0';if( i_rst = '1' ) thennumber <= G_MIN_NUMBER;elsif( i_valid = '1' ) then-- count up:if( number = G_MAX_NUMBER ) thennumber <= G_MIN_NUMBER;o_carry <= '1';elsenumber <= number + 1;end if;end if;end if;end process;end architecture;