ESP32S3 ULP stage_cnt branches need high bit set

s0urceror
Posts: 3
Joined: Wed Apr 03, 2024 5:05 pm

ESP32S3 ULP stage_cnt branches need high bit set

Postby s0urceror » Sun Sep 22, 2024 10:24 am

After a long period of debugging I found out that in order to do correct branching in the macro language you need to set the high bit of the comparison value to 1 for LT, LE, GE.

Code: Select all

I_BSL(0, imm_value | 0x8000),
I_BSLE(0, imm_value | 0x8000),
I_BSGE(0, imm_value | 0x8000)
Translates into:

Code: Select all

    
    JUMPS -4,10,LT // I=800a, CMP=0
    JUMPS -4,10,LE // I=800a, CMP=2
    JUMPS -4,10,GE // I=800a, CMP=3
I compared this with the output of the ULP FS assembler and this is the same.

Without adding the high bit the I_BSx instructions don't work accordingly.

Who is online

Users browsing this forum: Tnze__ and 148 guests