Test

Diff code posted
created at 03 Jun 03:55, updated at 09 Aug 16:54

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
column_count = 0;
k_chars = [0 0 0 0 0 0 0 0];
k_chars = k_chars(lane_indx);
k_chars = sum(k_chars.*bin_to_dec);
count = -1;
vec = (2.^(7:-1:0));
for lp1 = 1:(N-Np-6)
    if (send_prbs == 1)
        data = [];
        for lp2 = 1:8
            indx = (lp1-1)*64+((lp2-1)*8+1:(lp2-1)*8+8);
            data = [data sum(vec.*prbs_17(indx))];
        end
    elseif (mark_lanes == 1)
        data = [];
        lane_index = lane_start;
        for lp2 = 1:8
            data = [16*column_count+lane_index data];
            lane_index = lane_index + 1;
            if (lane_index > 8)
                lane_index = 1;
            end
        end
        column_count = column_count + 1;
        if (column_count > 9)
            column_count = 0;
        end
    else
        data = count + (1:8);
        count = count + 8;
        if (count > 247)
            count = -1;
        end
    end
    data = data(lane_indx);
    data = [k_chars data];
    fwrite(fid,data,'uint8');
end
1015 Bytes in 2 ms with coderay