这些指示是做什么的 [英] what do these instructions do

查看:281
本文介绍了这些指示是做什么的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为msp430指令集开发模拟器. gnu汇编程序将使您可以对以下指令进行编码:

I am working on a simulator for the msp430 instruction set. gnu assembler will let you encode instructions like these:

fc0a: 12 10 00 02 rrc &0x0200       
fc0e: 22 11       rra #4        
fc10: 23 52       add #4,#2

我的猜测是rrc& 0x0200将从地址0x0200取回执行旋转,然后将答案写回到地址0x0200,对吗?但是第4号RRA会做什么?我认为来源将是立即数4,但手术后是否有目的地?加法#4,#2组装成您所期望的形式(如2b10,source = r2,ad = 1b0,dest = r3),但binutils反汇编程序不知道如何处理该指令.

My guess is that rrc &0x0200 will fetch from address 0x0200 perform the rotate then write the answer back to address 0x0200, correct? But what would an rra #4 do? The source would be an immediate 4 I assume but is there a destination after the operation? The add #4,#2 assembled into what you would expect (as 2b10, source = r2, ad = 1b0, dest = r3), the binutils disassembler though did not know what to do with that instruction.

这些有效说明吗?

推荐答案

尽管似乎没有关于此效果的权威性在线参考,但我倾向于同意OP所显示的两个说明(以及其他几个说明)即使它们符合数据表中定义的格式,也可能无效.

Although there doesn't appears to be any definitive online reference to this effect, I tend to agree with the OP that the two instructions shown (and several others) are likely not valid, even though they conform to the format defined in the data sheets.

换句话说,组成一个指令字的各个部分的所有可能组合并不是全部有效.特别是,许多使用立即寻址模式的单操作数指令,以及许多对目标具有立即寻址模式的双操作数指令,在语义上可能都不可行.

In other words, not all possible combinations of the various parts that make up a instruction word are valid. In particular many single operand instructions that use the immediate addressing mode, and many double operand instructions that have an immediate addressing mode for the destination are probably not semantically viable.

在文档中只有很少的提示,例如,在《用户指南》第3.3.7节(关于立即寻址模式)中,注释表示"仅对源操作数有效". "(而且,顺便说一句,这是针对所有立即寻址模式的情况,而不仅仅是R2或R3常量生成技巧所允许的速记情况.)

There are only a few hints to this effect in the documentation, for example, in the User's Guide, section 3.3.7 (on the immediate addressing mode), a comment indicates "Valid only for a source operand." (And, BTW, this is for all cases of immediate addressing mode, not just the short-hand cases allowed by the R2 or R3 constant generation trick.)

反汇编程序不知道如何处理此类代码的事实也是另一个提示(尽管...有些反汇编程序很容易被绊倒...).

The fact that the disassembler doesn't know what to do with such codes is also another hint (although... some disassemblers get tripped easily...).

为了便于说明,我在下面收集了一些有关MSP430的有用参考文献:

For sake of documentation, I gathered below a few useful references for the MSP430:

  • TI's MSP430 User's Guide (pdf) Chapter 3 is particularly relevant
  • The TI MSP430 microcontroller (pdf) A shorter overview (11 pages)
  • MSPGCC manual A GNU Port of TI's tools for the MSP430 microcontrollers.

这篇关于这些指示是做什么的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆