Main Content

Gold Sequence Generator Reset Behavior

This example shows the Gold Sequence Generator output behavior for reset related parameter settings.

Three Gold code sequence blocks are configured to output the gold sequence resulting from various reset conditions.

  • For no reset, the Samples per frame parameter is set to 1 and the output is saved to out.y1.

  • For reset by using a scalar input Rst signal, the Samples per frame parameter is set to 1 for the Signal From Workspace and Gold Sequence Generator blocks. The output is saved to out.y2.

  • For reset by using a vector input Rst signal, the Samples per frame parameter is set to 8 for the Signal From Workspace and Gold Sequence Generator blocks. The output is saved to out.y3.

The scalar and vector reset signal value is [0 0 0 1 0 0 0 0]. When the Rst input port in enabled, the Gold Sequence Generator block resets the output sequence at the fourth sample. Run the model and compare the outputs.

The sequence output when no reset occurs is:
0  0  1  1  1  0  1  0
The sequence output when using a scalar reset signal is:
0  0  1  0  0  1  1  1
The sequence output when using a vector reset signal is:
0  0  1  0  0  1  1  1

The values output to out.y2 and out.y3 are equal because they are reset on the same sample and the length of the output is also equal because of the simulation stop time setting.

isequal(out.y2,out.y3) returns: 1

The Gold Sequence generator block always rounds up to output a multiple of the Samples per frame setting. Change the simulation stop time to 10 and the output sequence lengths are no longer equal.

The sequence output when no reset occurs is:
0  0  1  1  1  0  1  0  0  0  1
The sequence output when using a scalar reset signal is:
0  0  1  0  0  1  1  1  0  1  0
The sequence output when using a vector reset signal is:
0  0  1  0  0  1  1  1  0  1  0  0  0  1  1  1

See Also