Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 237342

Forum Post: RE: MSP430FR5969: Addressing Mode of CG(R3) for ADDA and SUBA instructions

$
0
0
I understand your confusion about the interpretation of the instruction code 0x03EF. It's indeed a bit tricky when the disassembled output doesn't match the expected assembly code. First of all, you're right about R2/R3 being constant generator registers on the MSP430. The special behavior you're observing is likely due to the interaction between the instruction encoding and the constant generation mechanism. In the case of the `ADDA` instruction, the machine code `0x03EF` is an encoding that the disassembler interprets as `ADDA R3, R15`. However, because R3 can be used as a constant generator to represent the immediate value #2 in certain addressing modes, the actual effect is equivalent to `ADDA #2, R15`. Regarding the documentation in SLAU367, the difference between the "Indirect register mode" in Table 4 - 2 and the "Register mode" in chapters 4.5.2.6 and 4.6.1 might seem conflicting at first glance. But in reality, these modes are defined based on different aspects of instruction encoding and execution. The "Indirect register mode" might refer to how the value is retrieved from the register in a more complex memory - accessing scenario, while the "Register mode" is more about the basic operation of using registers directly in an instruction. As for the exceptional case you mentioned about `ADDA` and `SUBA`, it makes perfect sense. Since getting zero from R3 in these instructions would be pointless, the hardware designers might have chosen to use R3 in a special way to represent immediate values like #2.

Viewing all articles
Browse latest Browse all 237342

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>