- In 16‑QAM you have 4 levels per axis: typically at ±1 and ±3 (in un‑normalized units).
- In 64‑QAM you have 8 levels: ±1, ±3, ±5, ±7.
How to decode IQ data from eCPRI interface(option 7-2)
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I captured eCPRI interface log and it contains IQ data for each RE. the bit widwidth for I&Q is 9 bits, I want to decode the IQ data to origin bit it carried, what's the formula or mapping method to translate IQ data to original bit? I am a new comer about this part, I understand QAM theory, but I can not understand the actual engineering implementation. thanks for your help!
0 comentarios
Respuestas (1)
Ayush
el 18 de Jun. de 2025
Hi Wenhua,
In an eCPRI log, you would have seen I- and Q- samples packed as fixedwidth signed integers (here: 9 bits each).
To recover the original bits (e.g. the QAM symbol indices), you can do the following:
1. Unpack and sign-extend the 9-bit words: Each sample is 9 bits wide, usually in two’s‑complement form. If you read it as an unsigned integer in the range [0…511], then convert to signed value. Here is a MATLAB code for the same:
raw = uint16(word9); % 0…511
if raw >= 2^8 % sign‑bit at bit‑8 (zero‑based)
signedVal = int16(raw) - 2^9; % negative values
else
signedVal = int16(raw); % positive values
end
Now signedVal is between [-256 ....+255].
2. Normalize to "constellation units": If your transceiver uses full‑scale peaks at ±1.0, divide by the max magnitude (2⁸–1 = 255):
I_norm = double(signedValI) / 255;
Q_norm = double(signedValQ) / 255;
you will now have I_norm, Q_norm ranging from [-1, +1].
3. Now, decide which QAM gridpoint you are nearest to.
For an M‑QAM constellation (e.g. 16‑QAM, 64‑QAM), each axis is divided into √M levels.
To demap, you “slice” each normalized sample to the nearest odd integer level. For example, in MATLAB:
% if M = 64
levels = (-7:2:7); % the 8 decision levels on one axis
I_level = levels( argmin(abs(I_norm*7 - levels)) + 1 );
Q_level = levels( argmin(abs(Q_norm*7 - levels)) + 1 );
4. Now, map the quantized levels back to bit-patterns. Constellations almost always use a gray-coding on each axis.
Now, here is a pseudo MATLAB code for a full IQ-to-bits decoder.
% --- parameters
M = 64; % e.g. 64-QAM
L = sqrt(M); % levels per axis
levels = (-(L-1):2:(L-1)); % e.g. -7,-5,...,+7
% precompute Gray map for one axis (a vector of length L)
grayMap = ... % e.g. [000, 001, 011, 010, 110, 111, 101, 100] for +7..-7
% --- raw unpack & normalize
rawI = bitand(packetWord, 511); % extract 9 bits
I_signed = int16(rawI) - (rawI>=256)*512;
I_norm = double(I_signed) / (2^(9-1)-1);
% --- level slicing
idxI = find(abs(I_norm*(L-1) - levels) == min(abs(I_norm*(L-1) - levels)),1);
I_level = levels(idxI);
% --- bit look‑up
I_bits = grayMap(idxI);
% Repeat for Q…
Q_bits = grayMap(idxQ);
% --- symbol bits
symBits = [I_bits, Q_bits]; % length = log2(M)
Hope it helps!
0 comentarios
Ver también
Categorías
Más información sobre Data Import and Analysis en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!