1 | function [mcs_rom_11ag, mcs_rom_11n] = tx_mcs_info_rom_init() |
---|
2 | |
---|
3 | %Helper function to convert each MCS info entry into a UFix32_0 ROM word |
---|
4 | % Requries all inputs be integers! |
---|
5 | % Ouptut word contents: |
---|
6 | % b[ 0]: Chan bandwidth |
---|
7 | % b[ 2: 1]: Num spatial streams |
---|
8 | % b[ 4: 3]: Mod order index |
---|
9 | % b[ 6: 5]: Code rate index |
---|
10 | % b[16: 7]: Coded bits per symbol per stream |
---|
11 | % b[26:17]: Data bits per symbol per stream |
---|
12 | mcs_info_to_rom = @(x) (... |
---|
13 | 2^0 * x(2) + ... |
---|
14 | 2^1 * x(3) + ... |
---|
15 | 2^3 * x(4) + ... |
---|
16 | 2^5 * x(5) + ... |
---|
17 | 2^7 * x(6) + ... |
---|
18 | 2^17 * x(7) + ... |
---|
19 | 0); |
---|
20 | |
---|
21 | %Columns: |
---|
22 | % 1: MCS index |
---|
23 | % 2: Channel bandwidth (0=20, 1=40) |
---|
24 | % 3: Num spatial streams |
---|
25 | % 4: Mod order index (BPSK, QPSK, 16-QAM, 64-QAM) = (0, 1, 2, 3) |
---|
26 | % 5: Code rate index (1/2, 2/3, 3/4, 5/6) = (0, 1, 2, 3) |
---|
27 | % 6: Coded bits per OFDM symbol per spatial stream |
---|
28 | % 7: Data bits per OFDM symbol per spatial stream |
---|
29 | |
---|
30 | %802.11 a/g rates - IEEE 802.11-2012 Table 18-4 |
---|
31 | % Chapter 18 doesn't use the term "MCS", but it's a convenient |
---|
32 | % way to refer to these rates. |
---|
33 | mcs_info_11ag = [... |
---|
34 | [0, 0, 1, 0, 0, 48, 24];... |
---|
35 | [1, 0, 1, 0, 2, 48, 36];... |
---|
36 | [2, 0, 1, 1, 0, 96, 48];... |
---|
37 | [3, 0, 1, 1, 2, 96, 72];... |
---|
38 | [4, 0, 1, 2, 0, 192, 96];... |
---|
39 | [5, 0, 1, 2, 2, 192, 144];... |
---|
40 | [6, 0, 1, 3, 1, 288, 192];... |
---|
41 | [7, 0, 1, 3, 2, 288, 216];... |
---|
42 | ]; |
---|
43 | |
---|
44 | %802.11n rates - IEEE 802.11-2012 Tables 20-30 to 30-37 |
---|
45 | % Only equal modulation MCS are included here |
---|
46 | % MCS 32 is omitted (it's unused, as best I can tell) |
---|
47 | mcs_info_11n = [... |
---|
48 | [ 0, 0, 1, 0, 0, 52, 26];... |
---|
49 | [ 1, 0, 1, 1, 0, 104, 52];... |
---|
50 | [ 2, 0, 1, 1, 2, 104, 78];... |
---|
51 | [ 3, 0, 1, 2, 0, 208, 104];... |
---|
52 | [ 4, 0, 1, 2, 2, 208, 156];... |
---|
53 | [ 5, 0, 1, 3, 1, 312, 208];... |
---|
54 | [ 6, 0, 1, 3, 2, 312, 234];... |
---|
55 | [ 7, 0, 1, 3, 3, 312, 260];... |
---|
56 | [ 8, 0, 2, 0, 0, 52, 26];... |
---|
57 | [ 9, 0, 2, 1, 0, 104, 52];... |
---|
58 | [10, 0, 2, 1, 2, 104, 78];... |
---|
59 | [11, 0, 2, 2, 0, 208, 104];... |
---|
60 | [12, 0, 2, 2, 2, 208, 156];... |
---|
61 | [13, 0, 2, 3, 1, 312, 208];... |
---|
62 | [14, 0, 2, 3, 2, 312, 234];... |
---|
63 | [15, 0, 2, 3, 3, 312, 260];... |
---|
64 | [16, 0, 3, 0, 0, 52, 26];... |
---|
65 | [17, 0, 3, 1, 0, 104, 52];... |
---|
66 | [18, 0, 3, 1, 2, 104, 78];... |
---|
67 | [19, 0, 3, 2, 0, 208, 104];... |
---|
68 | [20, 0, 3, 2, 2, 208, 156];... |
---|
69 | [21, 0, 3, 3, 1, 312, 208];... |
---|
70 | [22, 0, 3, 3, 2, 312, 234];... |
---|
71 | [23, 0, 3, 3, 3, 312, 260];... |
---|
72 | [24, 0, 4, 0, 0, 52, 26];... |
---|
73 | [25, 0, 4, 1, 0, 104, 52];... |
---|
74 | [26, 0, 4, 1, 2, 104, 78];... |
---|
75 | [27, 0, 4, 2, 0, 208, 104];... |
---|
76 | [28, 0, 4, 2, 2, 208, 156];... |
---|
77 | [29, 0, 4, 3, 1, 312, 208];... |
---|
78 | [30, 0, 4, 3, 2, 312, 234];... |
---|
79 | [31, 0, 4, 3, 3, 312, 260];... |
---|
80 | [ 0, 1, 1, 0, 0, 108, 54];... |
---|
81 | [ 1, 1, 1, 1, 0, 216, 108];... |
---|
82 | [ 2, 1, 1, 1, 2, 216, 162];... |
---|
83 | [ 3, 1, 1, 2, 0, 432, 216];... |
---|
84 | [ 4, 1, 1, 2, 2, 432, 324];... |
---|
85 | [ 5, 1, 1, 3, 1, 648, 432];... |
---|
86 | [ 6, 1, 1, 3, 2, 648, 486];... |
---|
87 | [ 7, 1, 1, 3, 3, 648, 540];... |
---|
88 | [ 8, 1, 2, 0, 0, 108, 54];... |
---|
89 | [ 9, 1, 2, 1, 0, 216, 108];... |
---|
90 | [10, 1, 2, 1, 2, 216, 162];... |
---|
91 | [11, 1, 2, 2, 0, 432, 216];... |
---|
92 | [12, 1, 2, 2, 2, 432, 324];... |
---|
93 | [13, 1, 2, 3, 1, 648, 432];... |
---|
94 | [14, 1, 2, 3, 2, 648, 486];... |
---|
95 | [15, 1, 2, 3, 3, 648, 540];... |
---|
96 | [16, 1, 3, 0, 0, 108, 54];... |
---|
97 | [17, 1, 3, 1, 0, 216, 108];... |
---|
98 | [18, 1, 3, 1, 2, 216, 162];... |
---|
99 | [19, 1, 3, 2, 0, 432, 216];... |
---|
100 | [20, 1, 3, 2, 2, 432, 324];... |
---|
101 | [21, 1, 3, 3, 1, 648, 432];... |
---|
102 | [22, 1, 3, 3, 2, 648, 486];... |
---|
103 | [23, 1, 3, 3, 3, 648, 540];... |
---|
104 | [24, 1, 4, 0, 0, 108, 54];... |
---|
105 | [25, 1, 4, 1, 0, 216, 108];... |
---|
106 | [26, 1, 4, 1, 2, 216, 162];... |
---|
107 | [27, 1, 4, 2, 0, 432, 216];... |
---|
108 | [28, 1, 4, 2, 2, 432, 324];... |
---|
109 | [29, 1, 4, 3, 1, 648, 432];... |
---|
110 | [30, 1, 4, 3, 2, 648, 486];... |
---|
111 | [31, 1, 4, 3, 3, 648, 540];... |
---|
112 | ]; |
---|
113 | |
---|
114 | %Convert each MCS info array to a vector of ROM words |
---|
115 | mcs_rom_11ag = zeros(1, size(mcs_info_11ag, 1)); |
---|
116 | for nn = 1:numel(mcs_rom_11ag) |
---|
117 | mcs_rom_11ag(nn) = mcs_info_to_rom(mcs_info_11ag(nn, :)); |
---|
118 | end |
---|
119 | |
---|
120 | mcs_rom_11n = zeros(1, size(mcs_info_11n, 1)); |
---|
121 | for nn = 1:numel(mcs_rom_11n) |
---|
122 | mcs_rom_11n(nn) = mcs_info_to_rom(mcs_info_11n(nn, :)); |
---|
123 | end |
---|
124 | |
---|