Because of the Thanksgiving holiday in the U.S., TI E2E™ design support forum responses may be delayed the week of November 23.

AM13E23019: TMU vs. LUT in RAM

Part Number: AM13E23019

Hi TI engineer, 

I saw that the TMU in AM13E230 has SIN / COS acceleration. For MCUs without acceleration, these functions are commonly implemented as LUTs in RAM. How much of a latency improvement would I expect to see using the TMU over something like a 512-value float LUT for a sin / cos function? 

All the best,

Ethan Cope 

  • Hey Ethan,

    We don't have proper benchmarking data to do this comparison. This would need to be tested manually. Both candidates are small and self-contained — wrap each in a DWT cycle-counter loop (CYCCNT), run your actual input distribution, and compare. The two configurations to measure are (a) sinf/cosf with fastrts_tmu.h included, and (b) your 512-entry LUT with both table and accessor function linked into SRAM. That gives you a number specific to your interpolation scheme and accuracy target, which is the variable that most affects the LUT side anyway.

    Also note that the LUT comparison is not purely about latency — a 512-entry table with linear interpolation has a bounded accuracy error that the TMU's full-precision float result does not, so the two options are not equivalent at equal cycle count.

    Best Regards,

    Zackary Fleenor

  • Ethan for same level of accuracy as that of LUT, the latency improvement you get with TMU would be 2.5x faster

    • TMU vs the simple LUT: about the same speed back-to-back, and about 20% faster when each result feeds the next calculation. It is also about 14,000× more accurate (4e-7 vs 5.6e-3), and it needs no 2 KB table.
    • TMU vs an accurate LUT: to bring the LUT's error down to 1.9e-5, you need interpolation. That costs 2.5× more cycles than the TMU (32.9 vs 13.0), and the TMU is still about 40× more accurate.
    • TMU vs software sinf/cosf: about 38× faster at similar accuracy (503 → 13 cycles).
    • Running from flash or RAM: I ran every test both ways, and it made no measurable difference to the TMU or the LUTs (within 0.1 cycle). Flash wait states weren't a factor here.