Various projects using Raspberry Pi
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.

73 lines
1.5 KiB

  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.numeric_std.all;
  4. entity FiRoE is
  5. generic (
  6. TOGGLE : boolean := true
  7. );
  8. port (
  9. FiRo_o : out std_logic;
  10. Run_i : in std_logic
  11. );
  12. end entity FiRoE;
  13. architecture rtl of FiRoE is
  14. --+ signal for inverter loop
  15. signal s_ring : std_logic_vector(15 downto 0);
  16. signal s_tff : std_logic;
  17. --+ attributes for synthesis tool to preserve inverter loop
  18. attribute syn_keep : boolean;
  19. attribute syn_hier : string;
  20. attribute syn_hier of rtl : architecture is "hard";
  21. attribute syn_keep of s_ring : signal is true;
  22. attribute syn_keep of s_tff : signal is true;
  23. --+ Attributes for lattice map tool to not merging inverter loop
  24. attribute nomerge : boolean;
  25. attribute nomerge of s_ring : signal is true;
  26. begin
  27. FiroRingG : for index in 1 to 15 generate
  28. s_ring(index) <= not(s_ring(index - 1));
  29. end generate FiroRingG;
  30. s_ring(0) <= (s_ring(15) xor s_ring(14) xor s_ring(7) xor s_ring(6) xor s_ring(5) xor s_ring(4) xor s_ring(2)) and Run_i;
  31. WithToggleG : if TOGGLE generate
  32. tffP : process(Run_i, s_ring(15)) is
  33. begin
  34. if(Run_i = '0') then
  35. s_tff <= '0';
  36. elsif(rising_edge(s_ring(15))) then
  37. s_tff <= not s_tff;
  38. end if;
  39. end process tffP;
  40. FiRo_o <= s_ring(15) xor s_tff;
  41. end generate WithToggleG;
  42. WithoutToggleG : if not(TOGGLE) generate
  43. FiRo_o <= s_ring(15);
  44. end generate WithoutToggleG;
  45. end architecture rtl;