Products & Services Solutions Academia Support User Community Company

Learn more about Filter Design Toolbox   

specifyall - Fixed-point scaling modes in direct-form FIR filter

Syntax

specifyall(hd)
specifyall(hd,false)
specifyall(hd,true)

Description

specifyall sets all of the autoscale property values of direct-form FIR filters to false and all *modes of the filters to SpecifyPrecision. In this table, you see the results of using specifyall with direct-form FIR filters.

Property Name

Default

Setting After Applying specifyall

CoeffAutoScale

true

false

OutputMode

AvoidOverflow

SpecifyPrecision

ProductMode

FullPrecision

SpecifyPrecision

AccumMode

KeepMSB

SpecifyPrecision

RoundMode

convergent

convergent

OverflowMode

wrap

wrap

specifyall(hd) gives you maximum control over all settings in a filter hd by setting all of the autoscale options that are true to false, turning off all autoscaling and resetting all modes — OutputMode, ProductMode, and AccumMode — to SpecifyPrecision. After you use specifyall, you must supply the property values for the mode- and scaling related properties.

specifyall provides an alternative to changing all these properties individually. Do note that specifyall changes all of the settings; to set some but not all of the modes, set each property as you require.

specifyall(hd,false) performs the opposite operation of specifyall(hd) by setting all of the autoscale options to true; all of the modes to their default values; and hiding the fraction length properties in the display, meaning you cannot access them to set them or view them.

specifyall(hd,true) is equivalent to specifyall(hd).

Examples

This examples demonstrates using specifyall to provide access to all of the fixed-point settings of an FIR filter implemented with the direct-form structure. Notice the displayed property values shown after you change the filter to fixed-point arithmetic, then after you use specifyall to disable all of the automatic filter scaling and reset the mode values.

b = fircband(12,[0 0.4 0.5 1],[1 1 0 0],[1 0.2],{'w''c'});
hd = dfilt.dffir(b);
hd.arithmetic = 'fixed'
hd =
 
         FilterStructure: 'Direct-Form FIR'
              Arithmetic: 'fixed'
               Numerator: [1x13 double]
        PersistentMemory: false
                  States: [1x1 embedded.fi]

         CoeffWordLength: 16             
          CoeffAutoScale: 'true'           
                  Signed: 'on'           
                                         
         InputWordLength: 16             
         InputFracLength: 15             
                                         
        OutputWordLength: 16             
              OutputMode: 'AvoidOverflow'
                                         
             ProductMode: 'FullPrecision'
                                         
               AccumMode: 'KeepMSB'      
         AccumWordLength: 40             
           CastBeforeSum: 'on'           
                                         
               RoundMode: 'convergent'   
            OverflowMode: 'wrap'         
                                         
         InheritSettings: 'off'          

specifyall(hd)
hd
 
hd =
 
         FilterStructure: 'Direct-Form FIR'
              Arithmetic: 'fixed'
               Numerator: [1x13 double]
        PersistentMemory: false
                  States: [1x1 embedded.fi]

         CoeffWordLength: 16                
          CoeffAutoScale: false             
           NumFracLength: 16                
                  Signed: true              
                                            
         InputWordLength: 16                
         InputFracLength: 15                
                                            
        OutputWordLength: 16                
              OutputMode: 'SpecifyPrecision'
        OutputFracLength: 11                
                                            
             ProductMode: 'SpecifyPrecision'
       ProductWordLength: 32                
       ProductFracLength: 31                
                                            
               AccumMode: 'SpecifyPrecision'
         AccumWordLength: 40                
         AccumFracLength: 31                
           CastBeforeSum: true              
                                            
               RoundMode: 'convergent'      
            OverflowMode: 'wrap'            
                                            
         InheritSettings: false 

The mode properties InputMode, ProductMode, and AccumMode now have the value SpecifyPrecision and the fraction length properties appear in the display. Now you use the properties (InputFracLength, ProdFracLength, AccumFracLength) to set the precision the filter applies to the input, product, and accumulator operations. CoeffAutoScale switches to false, meaning autoscaling of the filter coefficients will not be done to prevent overflows. None of the other filter properties change when you apply specifyall.

See Also

double, reffilter

fi, fimath in Fixed-Point Toolbox documentation

  


Free Early Verification Kit

Learn how to apply early verification to your development process through these technical resources.

How much time do you spend on testing to ensure implementation meets system-level requirements?

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS