library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.numeric_std.all;

package kakona_package is
        
        -- information block constants:
        -- Size:
        constant C_KAK_INFO_BITWIDTH : natural := 32; -- not to be changed
        constant C_GUID : std_logic_vector( 4*C_KAK_INFO_BITWIDTH - 1 downto 0 ) := X"D52900BA62BC431DBB38C1D38551887A"; -- 1-lane
        
        constant C_NUM_INPUT_ADC_MODULES :    natural := 2;  -- for SPI block
        constant C_NUM_INPUT_ADC_DATA_PORTS : natural := 4;  -- for processing block generate
        
        -- configuration for the SPI transmitter for ADCs:
        
        -- SPI DATA version 1:
        constant C_SPI_ADC1_DATA1 : std_logic_vector( 79 downto 0 ) := X"00" & "10000000" & -- software reset
                                                                                                                                                                                                                                           X"01" & "00100000" & -- two's complement enabled
                                                                                                                                                                                                                                                     X"02" & "00000010" & -- 3.5mA LVDS driver, test pattern off, 1-lane 
                                                                                                                                                                                                                                                                 X"03" & "10010110" & -- test pattern msb  '96'
                                                                                                                                                                                                                                                                 X"04" & "11110010";  -- test pattern lsb  'F2'
  constant C_SPI_ADC2_DATA1 : std_logic_vector( 79 downto 0 ) := X"00" & "10000000" & -- software reset
                                                                                                                                                                                                                                                 X"01" & "00100000" & -- two's complement enabled
                                                                                                                                                                                                                                                     X"02" & "00000010" & -- 3.5mA LVDS driver, test pattern off, 1-lane 
                                                                                                                                                                                                                                                                 X"03" & "11111111" & -- test pattern msb  'FF'
                                                                                                                                                                                                                                                                 X"04" & "00000000";  -- test pattern lsb  '00'
        constant C_SPI_ADC_DATA1 : std_logic_vector( C_SPI_ADC1_DATA1'length + C_SPI_ADC2_DATA1'length - 1 downto 0 ) := C_SPI_ADC1_DATA1 & C_SPI_ADC2_DATA1;
        
        -- SPI DATA version 2:
        -- difference: test pattern on.
        constant C_SPI_ADC1_DATA2 : std_logic_vector( 79 downto 0 ) := X"00" & "10000000" & -- software reset
                                                                                                                                                                                                                                           X"01" & "00100000" & -- two's complement enabled
                                                                                                                                                                                                                                                     X"02" & "00000110" & -- 3.5mA LVDS driver, test pattern on, 1-lane 
                                                                                                                                                                                                                                                                 X"03" & "10010110" & -- test pattern msb  '96'
                                                                                                                                                                                                                                                                 X"04" & "11110010";  -- test pattern lsb  'F2'
  constant C_SPI_ADC2_DATA2 : std_logic_vector( 79 downto 0 ) := X"00" & "10000000" & -- software reset
                                                                                                                                                                                                                                                 X"01" & "00100000" & -- two's complement enabled
                                                                                                                                                                                                                                                     X"02" & "00000110" & -- 3.5mA LVDS driver, test pattern on, 1-lane 
                                                                                                                                                                                                                                                                 X"03" & "11111110" & -- test pattern msb  'FE'
                                                                                                                                                                                                                                                                 X"04" & "11111111";  -- test pattern lsb  'FF'
        constant C_SPI_ADC_DATA2 : std_logic_vector( C_SPI_ADC1_DATA2'length + C_SPI_ADC2_DATA2'length - 1 downto 0 ) := C_SPI_ADC1_DATA2 & C_SPI_ADC2_DATA2;
        

        constant C_SPI_ADC_LENGTH : integer := 16;
        constant C_SPI_ADC_PACKETS : integer := 5;
        constant C_SPI_ADC_PAUSE : integer := 300;
        
        -- definition of swapped P&N wires:
        constant C_FRAME_WIRES_SWAPPED_PN : std_logic := '1';
        
        -- definition of swapped P&N wires in data lines. Direction conforms to .ucf file array.
        constant C_DATA_WIRES_SWAPPED_PN : std_logic_vector( 0 to 3 ) := "0101";
        
end package;

package body kakona_package is
end package body;