/// <summary>Constructs a new instance of the <see cref="MaximumLengthSequence"/> class from a tap value given by the argument.</summary> /// <param name="tapValue">The tap value. A basic test of the validity of the tap value will be made, although it can not be guaranteed that the given tap value is able to generate a maximum length sequence. The highest set bit /// of the tap value determines the length of the maximum length sequence.</param> /// <returns>The constructed instance of the <see cref="MaximumLengthSequence"/> class with the given tap value.</returns> public static MaximumLengthSequence FromTapValue(ulong tapValue) { var result = new MaximumLengthSequence { TapValue = tapValue }; return(result); }
/// <summary>Constructs a new instance of the <see cref="MaximumLengthSequence"/> class froms the number of stages (bits, flip-flops).</summary> /// <param name="numberOfStages">The number of stages (2..64). The length of the resulting sequence is 2^numberOfStages-1.</param> /// <returns>The constructed instance of the <see cref="MaximumLengthSequence"/> class with the given number of stages.</returns> public static MaximumLengthSequence FromNumberOfStages(int numberOfStages) { if (!(numberOfStages >= 2)) { throw new ArgumentOutOfRangeException("numberOfStages must be >= 2"); } if (!(numberOfStages <= 64)) { throw new ArgumentOutOfRangeException("numberOfStages must be <= 64"); } var result = new MaximumLengthSequence { _numberOfStages = numberOfStages, _sequenceLength = GetSequenceLengthFromNumberOfStages(numberOfStages), _tap = TapValues[numberOfStages] }; return(result); }