No BSD License  

Highlights from
Home Networking Basis

Home Networking Basis

by

 

11 Aug 2003 (Updated )

M-files for chapters 2-10 and Simulink models for Ethernet and Wireless Ethernet.

scrambsync.m
%generating idle sequence of all 1's
x=ones(2048,1);
%Initial lize the scrabling key
s=[1 0 0 0 0 0 0 0 0 0 0 0];
%geberating scrabled idle stream
for i=1:2048
s(2:12)=s(1:11);
s(1)=xor(s(12), s(10));
y(i)=xor(x(i), s(1));
end
%initialize scrambled sequence
c=y(1:11);
i=11;
sync=0;
%reset hypothesis
h=[0 0 0 0 0 0 0 0 0 0 0];
while sync==0
    i=i+1
    %update scrambled sequence
    c(2:12)=c(1:11);
    c(1)=y(i);
    %update hypothesis
    h(2:11)=h(1:10);
    h(1)=xor(c(1), xor(c(10), c(12)));
    %pattern match
    if h==[1 1 1 1 1 1 1 1 1 1 1]
        d=xor(c(1:11), h)
        sync=1;
    end
end
%descramble the idle stream
for j=i:2048
    d(2:12)=d(1:11);
    d(1)=xor(d(12), d(10));
    xx(j)=xor(y(j), d(1));
end

Contact us