Skip to main content

O150Sequence

Enum O150Sequence 

Source
pub enum O150Sequence {
    Prbs9,
    Prbs11,
    Prbs15,
    Prbs20,
    Prbs20Zs,
    Prbs23,
    Prbs29,
    Prbs31,
}
Expand description

The pseudo-random test sequences of ITU-T O.150 (05/96), Sec. 5 and Table 1.

Each is produced by an $n$-stage shift register whose $k$-th and $n$-th stage outputs are added modulo two and fed back to the first stage,

$$ Q_{i+1}(t+1) = Q_{i}(t), \quad i = 1, \dots, n - 1, \qquad Q_{1}(t+1) = Q_{k}(t) \oplus Q_{n}(t), $$

the polynomial $x^{n} + x^{k} + 1$, period $2^{n} - 1$. The output is the last stage $Q_{n}(t)$, negated for the inverted sequences, whose longest run of zeros is then $n$ instead of $n - 1$ (Sec. 4). The second sequence of period $2^{20} - 1$ (Sec. 5.5) forces its output to one before 14 zeros, $RD(t) = Q_{20}(t) + \overline{Q_{6}(t) + \dots + Q_{19}(t)}$ ($+$ the logical OR).

SequenceClause$n$$k$OutputLongest run of zeros
Prbs95.195non-inverted8
Prbs115.2119non-inverted10
Prbs155.31514inverted15
Prbs205.4203non-inverted19
Prbs20Zs5.52017zero suppression14
Prbs235.62318inverted23
Prbs295.72927inverted29
Prbs315.83128inverted31

The Recommendation fixes the starting phase of the 511-bit sequence only, “the first ONE of 9 consecutive ONEs” (Sec. 5.1); O150Sequence::bits starts every register with its stages at one, which gives that phase and makes an inverted sequence begin with its $n$ zeros. A test set synchronises to the received sequence (Sec. 4.2), so the phase does not matter for a measurement.

The printed formula of Sec. 5.5 ends its OR with $Q_{6}(k)$ instead of $Q_{19}(k)$, and Sec. 5.8 calls the 31-stage register “twenty-nine-stage”: two misprints that the text of the same clauses corrects (Sec. 5.1 of the Recommendation).

§Examples

use comnum_mapping::source::O150Sequence;
let s = O150Sequence::Prbs9;
let b = s.bits(511 + 9);
assert_eq!(&b[..9], &[1; 9]);              // Sec. 5.1: the first ONE of 9 ONEs
assert_eq!(&b[511..], &b[..9]);            // period 2⁹ − 1
assert_eq!(O150Sequence::from_name("prbs20z")?, O150Sequence::Prbs20Zs);

Variants§

§

Prbs9

$2^{9} - 1$ bits, Sec. 5.1 (O.153, data circuits up to 14 400 bit/s).

§

Prbs11

$2^{11} - 1$ bits, Sec. 5.2 (O.152, 64 kbit/s and N × 64 kbit/s).

§

Prbs15

$2^{15} - 1$ bits, inverted, Sec. 5.3 (O.151, 1544 to 44 736 kbit/s).

§

Prbs20

$2^{20} - 1$ bits, Sec. 5.4 (O.153, data circuits up to 72 kbit/s).

§

Prbs20Zs

$2^{20} - 1$ bits with zero suppression, Sec. 5.5 (O.151, 1544 to 44 736 kbit/s).

§

Prbs23

$2^{23} - 1$ bits, inverted, Sec. 5.6 (O.151, 34 368 and 139 264 kbit/s).

§

Prbs29

$2^{29} - 1$ bits, inverted, Sec. 5.7 (specific measurement tasks).

§

Prbs31

$2^{31} - 1$ bits, inverted, Sec. 5.8 (specific measurement tasks).

Implementations§

Source§

impl O150Sequence

Source

pub const ALL: [O150Sequence; 8]

The eight sequences, in the order of Sec. 5.

Source

pub fn from_name(name: &str) -> Result<O150Sequence>

The sequence of a name: prbs9, prbs11, prbs15, prbs20, prbs20z (the zero suppression of Sec. 5.5), prbs23, prbs29, prbs31.

§Errors

comnum_core::Error::Config for another name.

Source

pub fn name(self) -> &'static str

Source

pub fn stages(self) -> u32

The number of stages $n$.

Source

pub fn feedback(self) -> u32

The other feedback stage $k$: the polynomial is $x^{n} + x^{k} + 1$.

Source

pub fn inverted(self) -> bool

Whether the output is the negated register output (Sec. 4).

Source

pub fn period(self) -> u64

The period $2^{n} - 1$.

Source

pub fn longest_zeros(self) -> u32

The longest run of zeros of the sequence, Table 1.

Source

pub fn bits(self, length: usize) -> Vec<u8> ⓘ

The first length bits of the sequence, from the register with every stage at one (see the type).

Source

pub fn iter(self) -> O150Bits ⓘ

The endless sequence, bit after bit, from the register with every stage at one: a whole period of the long sequences without storing it.

Trait Implementations§

Source§

impl Clone for O150Sequence

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for O150Sequence

Source§

impl Debug for O150Sequence

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for O150Sequence

Source§

impl Hash for O150Sequence

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for O150Sequence

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for O150Sequence

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.