Trying to verify Verilog/VHDL designs with formal methods and tools
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
708 B

  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.numeric_std.all;
  4. entity counter is
  5. generic (
  6. InitVal : natural := 0;
  7. EndVal : natural := 64
  8. );
  9. port (
  10. Reset_n_i : in std_logic;
  11. Clk_i : in std_logic;
  12. Data_o : out std_logic_vector(31 downto 0)
  13. );
  14. end entity counter;
  15. architecture rtl of counter is
  16. begin
  17. process (Reset_n_i, Clk_i) is
  18. begin
  19. if (Reset_n_i = '0') then
  20. Data_o <= std_logic_vector(to_unsigned(InitVal, Data_o'length));
  21. elsif (rising_edge(Clk_i)) then
  22. if (to_integer(unsigned(Data_o)) < EndVal) then
  23. Data_o <= std_logic_vector(unsigned(Data_o) + 1);
  24. end if;
  25. end if;
  26. end process;
  27. end architecture rtl;