--/******************************************************************************
--    Company      		: MICROSEMI

--    File Name    		: ddc_cf_coeffpack.vhd 
                   		
--    Description  		: This package defines user defined parameters for FIR multi channel structure

--    Targeted device 	: Family           Die          Package
--                   	  PolarFire     MPF300T_ES      MPF300T_ES

--    Author          	: India Solutions Team

--
-- SVN Revision Information:
-- SVN $Revision: 
-- SVN $Date:  $  
-- COPYRIGHT 2018 BY MICROSEMI 
-- THE INFORMATION CONTAINED IN THIS DOCUMENT IS SUBJECT TO LICENSING RESTRICTIONS 
-- FROM MICROSEMI CORP.  IF YOU ARE NOT IN POSSESSION OF WRITTEN AUTHORIZATION FROM 
-- MICROSEMI FOR USE OF THIS FILE, THEN THE FILE SHOULD BE IMMEDIATELY DESTROYED AND 
-- NO BACK-UP OF THE FILE SHOULD BE MADE. 
-- 

--******************************************************************************/
library IEEE;
use IEEE.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.std_logic_unsigned.all;
use ieee.math_real.all;
use work.System_pack.all;

---- FIR filter parameter package 
package ddc_cf_coeffpack  is
------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- USER provided Configuration
------------------------------------------------------------------------------------------------------------------------------------------------------------------
    constant g_CLKFREQ              : integer := g_CLKFREQ; 	   					-- Clock frequency in Hz
	constant g_SAMPLEFREQ           : integer := g_NUM_CARRIER_BW_RATE; 		    -- Sample frequency in Hz
--  Coefficient parameters
    constant g_COEFF_WIDTH          : integer := 16;			   					-- coefficients -fixed point format (16S15)
    constant g_COEFF_FRACWIDTH      : integer := 15;
    constant g_COEFF_NUM            : integer := 113;              					-- Number of coefficients (Shall support even,odd Symmetry and No symmetry)  
    constant g_HAS_SYMM             : integer := 1;                					-- 0-No symmetry , 1-symmetry(Type of coefficient structure )
    constant g_SYMM				    : integer := 0;                					-- 0-Odd, 1-Even(Type of symmetry)
	
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Calculated constant declarations
-- Effectively these constant parameters are to be derived from tgi source code of the GUI configuration
--------------------------------------------------------------------------------------------------------------------------------------------------------------------   
    constant g_CHANCOUNT            : integer:= (g_CLKFREQ/g_SAMPLEFREQ);
    constant g_CHAN_WIDTH           : integer := integer(ceil(log2(real(g_CHANCOUNT))));  
	--  This equation changes with type of coefficient structure. If odd symmetry: (g_COEFF_NUM+1)/ 2; if even : (g_COEFF_NUM)/ 2; if No Symmetry : g_COEFF_NUM 
    constant g_EFF_COEFF_NUM        : integer := (g_COEFF_NUM+1)/ 2 ;
    constant g_DSPCOUNT             : integer := g_EFF_COEFF_NUM;  		
    constant g_DSPCOUNT_WIDTH       : integer := integer(ceil(log2(real(g_DSPCOUNT))));   
    constant g_COEFF_STORE          : integer := integer(g_EFF_COEFF_NUM);
    constant g_MACC_DEL_MOD         : integer := integer((g_DSPCOUNT+g_CHANCOUNT-1) mod g_CHANCOUNT);
	-- Delay introduced as by the macc structure (a fixed delay of 6 clock cycles is added)
    constant g_MACC_DELAYS          : integer := g_MACC_DEL_MOD+6; 		
    constant g_UNRND_FRACWIDTH      : integer :=  g_COEFF_FRACWIDTH + g_DATAIN_FRACWIDTH; 
    constant g_ADDERWIDTH           : integer :=  g_DATAIN_WIDTH+1;  
    constant g_MULTWIDTH            : integer :=  g_ADDERWIDTH+g_COEFF_WIDTH; 
    constant g_ACCWIDTH             : integer :=  48; 
    constant g_FINALADDWIDTH        : integer :=  g_MULTWIDTH+g_DSPCOUNT_WIDTH ; 

    type T_COEFF_REGS is array (0 to g_COEFF_STORE-1) of std_logic_vector(g_COEFF_WIDTH-1 downto 0);
    constant g_COEFF              : T_COEFF_REGS := (
                                                          -- Coefficient values                                                                       
                                                                        x"fff7",
																		x"fffb",
																		x"001b",
																		x"0020",
																		x"fff9",
																		x"fffa",
																		x"0019",
																		x"fffb",
																		x"ffe8",
																		x"0019",
																		x"000d",
																		x"ffd7",
																		x"000e",
																		x"0028",
																		x"ffd1",
																		x"fff1",
																		x"0044",
																		x"ffdf",
																		x"ffc5",
																		x"0053",
																		x"000a",
																		x"ff95",
																		x"0044",
																		x"004e",
																		x"ff76",
																		x"000a",
																		x"009c",
																		x"ff80",
																		x"ffa7",
																		x"00d9",
																		x"ffc7",
																		x"ff2b",
																		x"00e1",
																		x"0052",
																		x"feba",
																		x"0093",
																		x"0111",
																		x"fe87",
																		x"ffd9",
																		x"01db",
																		x"fec9",
																		x"feb6",
																		x"026f",
																		x"ffb4",
																		x"fd46",
																		x"0276",
																		x"017a",
																		x"fbbf",
																		x"0177",
																		x"046e",
																		x"fa62",
																		x"fe67",
																		x"09f2",
																		x"f972",
																		x"f2c7",
																		x"262f",                                                                   
                                                                        x"4e71"                                                                                                                                                                                                                                      
                                                                      );


end ddc_cf_coeffpack ;