Main Content

Oversampling factor

R2026b

Oversampling value

Model Configuration Pane: Global Settings

Description

Use this parameter to manually specify an oversampling value. The oversampling value is the ratio of the global clock frequency to the model base rate.

By default, HDL Coder™ does not generate a global oversampling clock. To generate a global oversampling clock, specify an integer greater than 1. If you use a multirate DUT, make sure that other rates in the DUT divide evenly into the global oversampling rate.

The global oversampling clock affects only the generated HDL code. It does not affect the simulation behavior of your model.

When you use the Treat Simulink rates as actual hardware rates parameter instead of manually specifying an oversampling factor, HDL Coder automatically computes the oversampling value from the Target Frequency parameter and the DUT base rate. This automatic computation requires that the target frequency is an integer multiple of the DUT base rate. If the ratio is not an integer, HDL Coder cannot determine the oversampling value and does not apply the target frequency to the generated clock.

Dependencies

  • To enable this parameter, clear Treat Simulink rates as actual hardware rates.

  • If you use multiple clocks, you must set Oversampling factor to 1. If you want to use an oversampling value greater than one, set Clock inputs to Single.

  • If you set Oversampling factor to a value greater than 1, make sure that the clock-rate pipelining optimization is enabled. You can specify this setting in the HDL Code Generation > Target and Optimizations > Pipelining tab.

    Clock-rate pipelining uses the Oversampling factor parameter to convert the slow regions in your model that operate at the base sample rate to the faster clock rate.

Settings

1 (default) | integer greater than or equal to 1

Default: 1

Tips

To set this property, use the functions hdlset_param or makehdl. To view the property value, use the function hdlget_param.

For example, you can specify this property when you generate HDL code for the symmetric_fir subsystem inside the sfir_fixed model by using either of these methods:

  • Pass the property as an argument to the makehdl function.

    makehdl('sfir_fixed/symmetric_fir', ... 
            'Oversampling',5)
  • Set the parameter on the model by using hdlset_param, and then generate HDL code by using makehdl.

    hdlset_param('sfir_fixed','Oversampling',5)
    makehdl('sfir_fixed/symmetric_fir')

Recommended Settings

No recommended settings.

Programmatic Use

Parameter: Oversampling
Type: int
Value: integer greater than or equal to 1
Default: 1

Version History

Introduced in R2012a