% ////////////////////////////////////////////////////////////////////
% FILE,     HBF2LCfg.m
% PROJECT,  HBF2L
% AUTHOR,   weitao.du
% DATE,     2007.Jun.11th
% VERSION,  0.1
% ////////////////////////////////////////////////////////////////////
% DECRIPTION
% 2 Level Half Band Fir Filter Design and Simulation, generate Config 
% ////////////////////////////////////////////////////////////////////

function cfg = HBF2LCfg();
  fprintf(1, 'HBF2LCfg, run\n');

  % set your simulation config here
    % stim config
    wNoise      = 1;    % white noise
    sine        = 2;    % sine signal
    stepUp      = 3;    % step Up sequency for debug only  
    stimType    = wNoise;
    stimLen     = 512;
    loadDbgStim =   1;  % load debug stim data
    DBGFILENAME = 'InputData.mat';

  % model config
    % word Length config
    % the input data and coeff is pure fractional number 
    inputWL     = 18;   % input data Word Length, include sign bit
    coeffWL     = 18;   % coefficents Word Length, include sign bit

    adderWL     = 19;   % symetrical adder output word length
    adderFL     = 17;   % symetrical adder output Fractional length, include sign bit
    castBFadd   = 0;    % data cast before add

    multWL      = 19;   % multply word length
    multFL      = 17;   % multply integer part Fractional, include sign bit

    sumWL       = 18;
    sumFL       = 17;
    castBFSum   = 0;    % data cast befort sum

    outputWL    = 18;   % output data Word Length
    outputFL    = 17;   % level 1 HBF output data Fractional Length, include sign bit

    % filter order config
    K1          = 16;    % 1st level HBF is 4*K1-1 taps, with 0 and symmetry coeff
    K2          = 8;     % 2nd level HBF is 4*K2-1 taps, with 0 and symmetry coeff
   
    % half band pass-band setting
    inputFs     = 2048*1E3;    % input sampling frequency 
    inputBw     = 768*1E3;     % input signal bandwidth 
    passBand1   = inputBw/(inputFs  );  % hbf1 pass band 
    passBand2   = inputBw/(inputFs*2);  % hbf2 pass band 
    
    cfg.inputFs     = inputFs  ;
    cfg.inputBw     = inputBw  ;

    cfg.wNoise      = wNoise   ;
    cfg.sine        = sine     ;
    cfg.stepUp      = stepUp   ;
    cfg.stimType    = stimType ;
    cfg.stimLen     = stimLen  ;
    cfg.loadDbgStim = loadDbgStim;
    cfg.DBGFILENAME = DBGFILENAME;

    cfg.WLCfg.inputWL     = inputWL  ;
    cfg.WLCfg.coeffWL     = coeffWL  ;
    cfg.WLCfg.adderWL     = adderWL  ;
    cfg.WLCfg.adderFL     = adderFL  ;
    cfg.WLCfg.castBFadd   = castBFadd;
    cfg.WLCfg.multWL      = multWL   ;
    cfg.WLCfg.multFL      = multFL   ;
    cfg.WLCfg.sumWL       = sumWL    ;
    cfg.WLCfg.sumFL       = sumFL    ;
    cfg.WLCfg.castBFSum   = castBFSum;
    cfg.WLCfg.outputWL    = outputWL ;
    cfg.WLCfg.outputFL    = outputFL ;

                               ;
    cfg.K1          = K1       ;
    cfg.K2          = K2       ;

    cfg.passBand1   = passBand1;
    cfg.passBand2   = passBand2;
             
% half band pend  % function HBF2LCfg();
