Skip to content

Commit 78e9812

Browse files
committed
Add comment about dividing by 4
The comment clarifies that because we track label addresses in 32bit words, but that immediate values are in bytes, the code needs to divide immediate values by 4, while leaving symbols (label) addresses as-is.
1 parent b3ae442 commit 78e9812

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Diff for: esp32_ulp/opcodes.py

+1
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ def i_jump(target, condition='--'):
619619
raise ValueError("invalid flags condition")
620620
if target.type == IMM or target.type == SYM:
621621
_bx.dreg = 0
622+
# we track label addresses in 32bit words, but immediate values are in bytes and need to get divided by 4.
622623
_bx.addr = get_abs(target) if target.type == SYM else get_abs(target) >> 2 # bitwise version of "// 4"
623624
_bx.unused = 0
624625
_bx.reg = 0

0 commit comments

Comments
 (0)