function [mcs_rom_11ag, mcs_rom_11n] = tx_mcs_info_rom_init() %Helper function to convert each MCS info entry into a UFix32_0 ROM word % Requries all inputs be integers! % Ouptut word contents: % b[ 0]: Chan bandwidth % b[ 2: 1]: Num spatial streams % b[ 4: 3]: Mod order index % b[ 6: 5]: Code rate index % b[16: 7]: Coded bits per symbol per stream % b[26:17]: Data bits per symbol per stream mcs_info_to_rom = @(x) (... 2^0 * x(2) + ... 2^1 * x(3) + ... 2^3 * x(4) + ... 2^5 * x(5) + ... 2^7 * x(6) + ... 2^17 * x(7) + ... 0); %Columns: % 1: MCS index % 2: Channel bandwidth (0=20, 1=40) % 3: Num spatial streams % 4: Mod order index (BPSK, QPSK, 16-QAM, 64-QAM) = (0, 1, 2, 3) % 5: Code rate index (1/2, 2/3, 3/4, 5/6) = (0, 1, 2, 3) % 6: Coded bits per OFDM symbol per spatial stream % 7: Data bits per OFDM symbol per spatial stream %802.11 a/g rates - IEEE 802.11-2012 Table 18-4 % Chapter 18 doesn't use the term "MCS", but it's a convenient % way to refer to these rates. mcs_info_11ag = [... [0, 0, 1, 0, 0, 48, 24];... [1, 0, 1, 0, 2, 48, 36];... [2, 0, 1, 1, 0, 96, 48];... [3, 0, 1, 1, 2, 96, 72];... [4, 0, 1, 2, 0, 192, 96];... [5, 0, 1, 2, 2, 192, 144];... [6, 0, 1, 3, 1, 288, 192];... [7, 0, 1, 3, 2, 288, 216];... ]; %802.11n rates - IEEE 802.11-2012 Tables 20-30 to 30-37 % Only equal modulation MCS are included here % MCS 32 is omitted (it's unused, as best I can tell) mcs_info_11n = [... [ 0, 0, 1, 0, 0, 52, 26];... [ 1, 0, 1, 1, 0, 104, 52];... [ 2, 0, 1, 1, 2, 104, 78];... [ 3, 0, 1, 2, 0, 208, 104];... [ 4, 0, 1, 2, 2, 208, 156];... [ 5, 0, 1, 3, 1, 312, 208];... [ 6, 0, 1, 3, 2, 312, 234];... [ 7, 0, 1, 3, 3, 312, 260];... [ 8, 0, 2, 0, 0, 52, 26];... [ 9, 0, 2, 1, 0, 104, 52];... [10, 0, 2, 1, 2, 104, 78];... [11, 0, 2, 2, 0, 208, 104];... [12, 0, 2, 2, 2, 208, 156];... [13, 0, 2, 3, 1, 312, 208];... [14, 0, 2, 3, 2, 312, 234];... [15, 0, 2, 3, 3, 312, 260];... [16, 0, 3, 0, 0, 52, 26];... [17, 0, 3, 1, 0, 104, 52];... [18, 0, 3, 1, 2, 104, 78];... [19, 0, 3, 2, 0, 208, 104];... [20, 0, 3, 2, 2, 208, 156];... [21, 0, 3, 3, 1, 312, 208];... [22, 0, 3, 3, 2, 312, 234];... [23, 0, 3, 3, 3, 312, 260];... [24, 0, 4, 0, 0, 52, 26];... [25, 0, 4, 1, 0, 104, 52];... [26, 0, 4, 1, 2, 104, 78];... [27, 0, 4, 2, 0, 208, 104];... [28, 0, 4, 2, 2, 208, 156];... [29, 0, 4, 3, 1, 312, 208];... [30, 0, 4, 3, 2, 312, 234];... [31, 0, 4, 3, 3, 312, 260];... [ 0, 1, 1, 0, 0, 108, 54];... [ 1, 1, 1, 1, 0, 216, 108];... [ 2, 1, 1, 1, 2, 216, 162];... [ 3, 1, 1, 2, 0, 432, 216];... [ 4, 1, 1, 2, 2, 432, 324];... [ 5, 1, 1, 3, 1, 648, 432];... [ 6, 1, 1, 3, 2, 648, 486];... [ 7, 1, 1, 3, 3, 648, 540];... [ 8, 1, 2, 0, 0, 108, 54];... [ 9, 1, 2, 1, 0, 216, 108];... [10, 1, 2, 1, 2, 216, 162];... [11, 1, 2, 2, 0, 432, 216];... [12, 1, 2, 2, 2, 432, 324];... [13, 1, 2, 3, 1, 648, 432];... [14, 1, 2, 3, 2, 648, 486];... [15, 1, 2, 3, 3, 648, 540];... [16, 1, 3, 0, 0, 108, 54];... [17, 1, 3, 1, 0, 216, 108];... [18, 1, 3, 1, 2, 216, 162];... [19, 1, 3, 2, 0, 432, 216];... [20, 1, 3, 2, 2, 432, 324];... [21, 1, 3, 3, 1, 648, 432];... [22, 1, 3, 3, 2, 648, 486];... [23, 1, 3, 3, 3, 648, 540];... [24, 1, 4, 0, 0, 108, 54];... [25, 1, 4, 1, 0, 216, 108];... [26, 1, 4, 1, 2, 216, 162];... [27, 1, 4, 2, 0, 432, 216];... [28, 1, 4, 2, 2, 432, 324];... [29, 1, 4, 3, 1, 648, 432];... [30, 1, 4, 3, 2, 648, 486];... [31, 1, 4, 3, 3, 648, 540];... ]; %Convert each MCS info array to a vector of ROM words mcs_rom_11ag = zeros(1, size(mcs_info_11ag, 1)); for nn = 1:numel(mcs_rom_11ag) mcs_rom_11ag(nn) = mcs_info_to_rom(mcs_info_11ag(nn, :)); end mcs_rom_11n = zeros(1, size(mcs_info_11n, 1)); for nn = 1:numel(mcs_rom_11n) mcs_rom_11n(nn) = mcs_info_to_rom(mcs_info_11n(nn, :)); end