% ////////////////////////////////////////////////////////////////////
% 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
    bwNoise     = 1;            % band white noise
    WGNoise     = 2;            % white Noise
    sine        = 3;            % sine signal
    sineAry     = 4;            % sine array signal
    stepUp      = 5;            % step Up sequency for debug only  

    stimType    = sine;

    Vp          = 0.94;         % max signal abs value
    sineFreq    = 200E3;        % input sine signal frequency
    sineDc      = 0;            % input sine signal dc value
    baseAryFreq =  50E3;        % sine array base signal frequency in Hz
    sineAryNum  = 15;           % number of sine signal in sine array

    stimLen     = 512;
    inputFs     = 2048*1E3;     % input sampling frequency 
    inputBw     = 768*1E3;      % input band noise bandwidth 
    loadDbgStim =   0;          % load debug stim data
    DBGFILENAME = 'InputData.mat';

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

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

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

    sumWL       = 22;
    sumFL       = 15;
    castBFSum   = 0;    % data cast befort sum

    outputWL    = 16;   % output data Word Length
    outputFL    = 15;   % 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
    passBand1   = inputBw/(inputFs  );  % hbf1 pass band 
    passBand2   = inputBw/(inputFs*2);  % hbf2 pass band 
    
    cfg.inputFs     = inputFs  ;
    cfg.inputBw     = inputBw  ;

    cfg.bwNoise     = bwNoise  ;
    cfg.WGNoise     = WGNoise  ;
    cfg.sine        = sine     ;
    cfg.sineAry     = sineAry  ;
    cfg.stepUp      = stepUp   ;

    cfg.stimType    = stimType ;
    cfg.Vp          = Vp       ;         
    cfg.sineFreq    = sineFreq ;
    cfg.sineDc      = sineDc   ;
    cfg.baseAryFreq = baseAryFreq;
    cfg.sineAryNum  = sineAryNum;

    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();
