Skip to Main Content Skip to Search
Product Documentation

shift2mask - Convert shift to mask vector for shift register configuration

Syntax

mask = shift2mask(prpoly,shift)

Description

mask = shift2mask(prpoly,shift) returns the mask that is equivalent to the shift (or offset) specified by shift, for a linear feedback shift register whose connections are specified by the primitive polynomial prpoly. The prpoly input can have one of these formats:

The shift input is an integer scalar.

Definition of Equivalent Mask

The equivalent mask for the shift s is the remainder after dividing the polynomial xs by the primitive polynomial. The vector mask represents the remainder polynomial by listing the coefficients in order of descending powers.

Shifts, Masks, and Pseudonoise Sequence Generators

Linear feedback shift registers are part of an implementation of a pseudonoise sequence generator. Below is a schematic diagram of a pseudonoise sequence generator. All adders perform addition modulo 2.

The primitive polynomial determines the state of each switch labeled gk, and the mask determines the state of each switch labeled mk. The lower half of the diagram shows the implementation of the shift, which delays the starting point of the output sequence. If the shift is zero, the m0 switch is closed while all other mk switches are open. The table below indicates how the shift affects the shift register's output.

T = 0T = 1T = 2...T = sT = s+1
Shift = 0x0x1x2...xsxs+1
Shift = s > 0xsxs+1xs+2... x2sx2s+1

If you have Communications System Toolbox software and want to generate a pseudonoise sequence in a Simulink® model, see the PN Sequence Generator block reference page.

Examples

The command below converts a shift of 5 into the equivalent mask x3 +x + 1, for the linear feedback shift register whose connections are specified by the primitive polynomial x4 + x3 + 1.

mk = shift2mask([1 1 0 0 1],5)

mk =

     1     0     1     1

References

[1] Lee, J. S., and L. E. Miller, CDMA Systems Engineering Handbook, Boston, Artech House, 1998.

[2] Simon, Marvin K., Jim K. Omura, et al., Spread Spectrum Communications Handbook, New York, McGraw-Hill, 1994.

See Also

deconv | isprimitive | mask2shift | primpoly

  


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-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS