5

I'm reverse engineering a hardware device which stores time a strange format:

32-bit word H:MM:SS (rounded)
0x03200000 0:00:00
0x09700000 0:00:00
0x0A1B0000 0:00:01
0x0A160000 0:00:01
0x0B098000 0:00:02
0x0F376600 0:00:46
0x0F347800 0:00:46
0x10038B00 0:01:07
0x10040800 0:01:07
0x1056A600 0:01:49
0x10573C00 0:01:50
0x10589A00 0:01:50
0x1058B300 0:01:50
0x13173240 0:10:19
0x13173880 0:10:19

I believe the time is recorded in some internal high-frequency timer ticks, but I don't see any linear correspondence between the words and time values. Any tips?

UPD. I found out that it's Texas Instruments's custom floating-point format for TMS320 DSPs. Described here.

1 Answer 1

4

The values appear to be a floating point format similar to single-precision floating-point format.

If I interpret the first byte as an unbiased exponent and interpret the other bytes (excluding the highest bit) as a fraction, then the value (1 + fraction) × 2exponent appears to be the number of milliseconds:

table showing how the bits are assigned to exponent and fraction values

Equivalently, in the following textual table, the first byte e is the exponent, the other bytes n form the numerator of the fraction, and the denominator of the fraction is 223. The value (1 + n/223) × 2e is the number of milliseconds:

e n e n (1 + n/223) × 2e
03 200000 3 2097152 10
09 700000 9 7340032 960
0A 1B0000 10 1769472 1240
0A 160000 10 1441792 1200
0B 098000 11 622592 2200
0F 376600 15 3630592 46950
0F 347800 15 3438592 46200
10 038B00 16 232192 67350
10 040800 16 264192 67600
10 56A600 16 5678592 109900
10 573C00 16 5716992 110200
10 589A00 16 5806592 110900
10 58B300 16 5812992 110950
13 173240 19 1520192 619300
13 173880 19 1521792 619400

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.