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.

53 lines
1.2 KiB

  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.numeric_std.all;
  4. entity firo is
  5. generic (
  6. TOGGLE : boolean := true
  7. );
  8. port (
  9. frun_i : in std_logic;
  10. fdata_o : out std_logic
  11. );
  12. end entity firo;
  13. architecture rtl of firo 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 synplify 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. begin
  24. firoring : for index in 1 to 15 generate
  25. s_ring(index) <= not(s_ring(index - 1));
  26. end generate;
  27. 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 frun_i;
  28. with_toggle : if TOGGLE generate
  29. tffP : process(frun_i, s_ring(15)) is
  30. begin
  31. if (not frun_i) then
  32. s_tff <= '0';
  33. elsif (rising_edge(s_ring(15))) then
  34. s_tff <= not s_tff;
  35. end if;
  36. end process tffP;
  37. fdata_o <= s_ring(15) xor s_tff;
  38. else generate
  39. fdata_o <= s_ring(15);
  40. end generate;
  41. end architecture rtl;