Main Content

OVSF Code Generator

Generate OVSF code

  • OVSF Code Generator block

Libraries:
Communications Toolbox / Comm Sources / Sequence Generators

Description

The OVSF Code Generator block generates a code from an orthogonal variable spreading factor (OVSF) matrix. Use OVSF codes to preserve orthogonality between different channels in a spread spectrum communications system. For more information, see Algorithms.

Examples

expand all

Generate 10 samples of an OVSF code with a spreading factor of 32.

The cm_generate_ovsf_code model sets Code length to 32, Code index to 12, and Samples per frame to 10. Other parameters use the default settings.

Run the model and display the generated OVSF code.

ans =

     1
     1
    -1
    -1
    -1
    -1
     1
     1
     1
     1

Ports

Output

expand all

Output data, returned as a binary-valued column vector containing the OVSF code generated from a set of orthogonal codes.

Data Types: double | int8

Parameters

expand all

To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.

Length of the generated code, specified as a positive integer power of 2. The code length value is the spreading factor of the code. For more information, see Spread Spectrum.

The spreading factor is the length of the code selected from the OVSF code matrix. OVSF codes are defined as the rows of an N-by-N matrix, CN. The Code index parameter specifies the row of the CN matrix as the code of interest. For more information, see Orthogonal Variable Spreading Factor Codes.

Row index of the OVSF code matrix, specified as an integer in the range [0, (N – 1)], where N is the spreading factor as specified by the value of the Code length parameter. OVSF codes are defined as the rows of an N-by-N matrix, CN. The value of this property specifies the row of the CN matrix as the code of interest. For more information, see Recovering and Reconstructing OVSF Codes.

Positive scalars specify the time in seconds between each sample of the output signal. If you set the sample time to -1, the output signal inherits the sample time from downstream. For information on the relationship between the Sample time and Samples per frame parameters, see Sample Timing.

Number of OVSF code chips output, specified as a positive integer. Each time the block runs, it outputs the first Samples per frame chips of the OVSF code specified by the Code length and Code index property values. For more information, see Spread Spectrum.

For information on the relationship between Sample time and Samples per frame, see Sample Timing.

Output data type, specified as double or int8.

Type of simulation to run, specified as Code generation or Interpreted execution.

  • Code generation — Simulate the model by using generated C code. The first time you run a simulation, Simulink generates C code for the block. The model reuses the C code for subsequent simulations unless the model changes. This option requires additional startup time, but the speed of the subsequent simulations is faster than with the Interpreted execution option.

  • Interpreted execution — Simulate the model by using the MATLAB® interpreter. This option shortens startup time, but the speed of subsequent simulations is slower than with the Code generation option. In this mode, you can debug the source code of the block.

For more information, see Interpreted Execution vs. Code Generation (Simulink).

Block Characteristics

Data Types

double | integer

Multidimensional Signals

no

Variable-Size Signals

no

More About

expand all

Algorithms

expand all

As discussed in [1], OVSF codes were first introduced for 3G communication systems and are primarily used to preserve orthogonality between different channels in a spread spectrum communications system.

References

[1] Kasapović, S. and N. Sarajlić. "OVSF code assignment in UMTS networks." 2010 20th International Crimean Conference "Microwave & Telecommunication Technology", 429–32. Sevastopol: IEEE®, 2010. https://doi.org/10.1109/CRMICO.2010.5632706.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced before R2006a

expand all