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.

81 lines
1.5 KiB

  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.numeric_std.all;
  4. entity vai_fifo is
  5. generic (
  6. Formal : boolean := true;
  7. Depth : positive := 16;
  8. Width : positive := 16
  9. );
  10. port (
  11. Reset_n_i : in std_logic;
  12. Clk_i : in std_logic;
  13. -- write
  14. Valid_i : in std_logic;
  15. Accept_o : out std_logic;
  16. Din_i : in std_logic_vector(Width-1 downto 0);
  17. -- read
  18. Valid_o : out std_logic;
  19. Accept_i : in std_logic;
  20. Dout_o : out std_logic_vector(Width-1 downto 0)
  21. );
  22. end entity vai_fifo;
  23. architecture rtl of vai_fifo is
  24. signal s_wen : std_logic;
  25. signal s_ren : std_logic;
  26. signal s_full : std_logic;
  27. signal s_empty : std_logic;
  28. begin
  29. i_fifo : entity work.fifo
  30. generic map (
  31. Formal => Formal,
  32. Depth => Depth,
  33. Width => Width
  34. )
  35. port map (
  36. Reset_n_i => Reset_n_i,
  37. Clk_i => Clk_i,
  38. -- write
  39. Wen_i => s_wen,
  40. Din_i => Din_i,
  41. Full_o => s_full,
  42. Werror_o => open,
  43. -- read
  44. Ren_i => s_ren,
  45. Dout_o => Dout_o,
  46. Empty_o => s_empty,
  47. Rerror_o => open
  48. );
  49. s_wen <= Valid_i and not s_full;
  50. s_ren <= Accept_i and not s_empty;
  51. Accept_o <= not s_full;
  52. Valid_o <= not s_empty;
  53. FormalG : if Formal generate
  54. default clock is rising_edge(Clk_i);
  55. -- Inputs are low during reset for simplicity
  56. vai_fifo_reset_a : assume always not Reset_n_i -> not Valid_i and not Accept_i;
  57. end generate FormalG;
  58. end architecture rtl;