ESP32S3 ULP stage_cnt branches need high bit set
Posted: 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.
Translates into:
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.
Code: Select all
I_BSL(0, imm_value | 0x8000),
I_BSLE(0, imm_value | 0x8000),
I_BSGE(0, imm_value | 0x8000)
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
Without adding the high bit the I_BSx instructions don't work accordingly.