Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. type order_array is array(0 to 7) of std_logic_vector(11 downto 0);
  2.  
  3. port(enable : in std_logic;
  4.  
  5. clk : in std_logic;
  6.  
  7. inarray : in order_array;
  8.  
  9. outarray : out order_array);
  10.  
  11. loop1 : for j in 0 to 6 generate
  12.  
  13. loop2 : for i in 0 to 6-j generate
  14.  
  15. process(clk, inarray)
  16.  
  17. variable temp : std_logic_vector(11 downto 0);
  18.  
  19. variable sorted_array : order_array;
  20.  
  21. begin
  22.  
  23. sorted_array := inarray;
  24.  
  25. if(rising_edge(clk)) then
  26.  
  27. if(enable='1') then
  28.  
  29. if(unsigned(sorted_array(i)) < unsigned(sorted_array(i+1))) then
  30.  
  31. temp := sorted_array(i);
  32.  
  33. sorted_array(i) := sorted_array(i + 1);
  34.  
  35. sorted_array(i + 1) := temp;
  36.  
  37. end if;
  38.  
  39. end if;
  40.  
  41. outarray<=sorted_array;
  42.  
  43. end if;
  44.  
  45. end process;
  46.  
  47. end generate;
  48.  
  49. end generate;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement