What could be the equivalent RISC-V asm code for the following asm code snippet?
And also i am very curious to know the exact meaning of this code, what it actually does?
i do not know asm coding that is why!
void tunedDelay(uint16_t delay) {
uint8_t tmp=0;
asm volatile(“sbiw %0, 0x01 \n\t”
“ldi %1, 0xFF \n\t”
“cpi %A0, 0xFF \n\t”
“cpc %B0, %1 \n\t”
“brne .-10 \n\t”
: “+r” (delay), “+a” (tmp)
: “0” (delay)
);
}
//SBIW:- [operands] Rd,K “Subtract Immediate from Word” Rd+1:Rd ← Rd+1:Rd - K
//LDI:- [operands] Rd,K “Load Immediate” Rd ← K
//CPI:- [operands] Rd,K “Compare with Immediate” Rd - K
//CPC:- [operands] Rd,Rr “Compare with Carry” Rd - Rr - C
//BRNE:- [operands] k “Branch if Not Equal” if (Z = 0) then PC ← PC + k + 1