PoC.sort.sortnet.BitonicSort

This sorting network uses the bitonic sort algorithm.

../../../_images/sortnet_BitonicSort.svg

Entity Declaration:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
entity sortnet_BitonicSort is
  generic (
    INPUTS                : positive  := 32;      -- input count
    KEY_BITS              : positive  := 32;      -- the first KEY_BITS of In_Data are used as a sorting critera (key)
    DATA_BITS             : positive  := 64;      -- inclusive KEY_BITS
    META_BITS             : natural   := 2;       -- additional bits, not sorted but delayed as long as In_Data
    PIPELINE_STAGE_AFTER  : natural   := 2;       -- add a pipline stage after n sorting stages
    ADD_INPUT_REGISTERS   : boolean   := FALSE;   --
    ADD_OUTPUT_REGISTERS  : boolean   := TRUE     --
  );
  port (
    Clock       : in  std_logic;
    Reset       : in  std_logic;
    
    Inverse     : in  std_logic   := '0';
    
    In_Valid    : in  std_logic;
    In_IsKey    : in  std_logic;
    In_Data     : in  T_SLM(INPUTS - 1 downto 0, DATA_BITS - 1 downto 0);
    In_Meta     : in  std_logic_vector(META_BITS - 1 downto 0);
    
    Out_Valid   : out std_logic;
    Out_IsKey   : out std_logic;
    Out_Data    : out T_SLM(INPUTS - 1 downto 0, DATA_BITS - 1 downto 0);
    Out_Meta    : out std_logic_vector(META_BITS - 1 downto 0)
  );
end entity;