How can I interpret "sfix32 en24" data in binary? (from WLAN transmitter HDL example)

8 views (last 30 days)
Dear all,
I am using the example:
The mcs is set to be 0 for BPSK, so I am expecting the output I/Q data should form two clusters.
The output I/Q data from this TX HDL simulation are both 32 bits, where it is written as "sfix32 en24" in the HDL code.
However, if I simply change the 32-bit raw binary I/Q data into uint32, then I can see four clusters at:
(0,0)
(0,2^32)
(2^32,0)
(2^32,2^32)
Or, if I change the 32-bit raw binary I/Q data into signed int32, no cluster can be seen.
I think that I misunderstood the format of the raw data.
How should I correctly interpret the 32-bit data with "sfix32 en24"? Does one of the specific bit correspond to sign?
Thank you in advance.

Accepted Answer

Dharma Bade
Dharma Bade on 9 Apr 2025
Hi Yun-Tsung,
sfix32: This typically stands for "signed fixed-point 32-bit".
  • Signed: Indicates that the number can be both positive and negative, with the most significant bit (MSB) representing the signed bit.
  • Fixed-point: A method of representing real numbers that has a fixed number of digits after the decimal point.
  • 32-bit: The total size of the data type is 32 bits. This includes both the integer and fractional parts.
en24: This refers to the "encoding" with 24 bits.
  • It means that 24 bits are used for the fractional part, leaving 8 bits for the integer part which includes signed bit also.
In summary, "sfix32 en24" describes a signed, fixed-point number with a total size of 32 bits, where 24 bits are used for the fractional part and 8 bits are used for integer part.
For more information, you can look at Fixed-Point Data in MATLAB and Simulink
If you are using a data type conversion block in Simulink to convert the sfix32 en24 data type to another data type, the data might get clipped based on the number of integer bits used in the conversion and you might see clusters. You can also adjust the "input and output to have equal" parameter in the data type conversion block, with options for "Real World Value (RWV)" and "Stored Integer (SI)", to ensure you have the correct bit configuration for your needs.
Hope that helps!
Best regards,
Dharma
  3 Comments
Walter Roberson
Walter Roberson on 10 Apr 2025
format long g
data = {
'006836bf'
'fed331c2'
'ffe11c73'
'01447a3c'
};
ddec = hex2dec(data);
int32min = double(typecast(0x80000000s32, 'uint32'));
mask = ddec >= int32min;
ddec(mask) = ddec(mask) - 2^32;
number = ddec / 2^24
number = 4×1
0.407085359096527 -1.17502200603485 -0.120659649372101 1.26749014854431
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Yun-Tsung
Yun-Tsung on 10 Apr 2025
Thank you. I did a try with your suggestions on the data.
I think the method is no problem but the data don't looks like expectation. It becomes 1 cluster centered at (0,0).
I think this is a problem of the WLAN HDL module, not about the format, so I will ask another question for WLAN reference.
Thank you again.

Sign in to comment.

More Answers (0)

Categories

Find more on Communications Toolbox in Help Center and File Exchange

Products


Release

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!