我们所说的指令大小是什么意思? [英] What do we mean by instruction size?

查看:34
本文介绍了我们所说的指令大小是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很困惑,这个问题可能听起来很愚蠢,但当我们说指令大小是 32 位或 16 位时,我真的不确定这意味着什么.

I am really confused and the question may sound dumb but I'm really not sure what it means when we say an instruction size is 32-bit or 16-bit.

如果操作数大小是 32 位,那么我们说它是 32 位指令,如果操作数大小是 16 位指令.

Is it if operand size is 32-bit then we say it's an 32-bit instruction and if operand size is 16-bit instruction.

或者每条指令都有操作码,如果操作码地址是 32 位,那么我们说指令是 32 位.

Or every instruction has opcode and if opcode address is 32-bit then we say instruction is 32-bit.

我也在研究 ARM 架构,在那里我读到的所有拇指指令都是 16 位的,但 ARM 模式指令是 32 位的.

I am also going through ARM architecture where I read all thumb instruction are of 16 bit but ARM mode instruction are 32-bit.

指令大小完全取决于所使用的架构还是取决于 CPU 的运行模式?

Does instruction size totally depend upon the architecture in use or it depends on the modes in which the CPU operates?

http://www.xgc-tek.com/manuals/m1750-ada/m1750/x524.html

给定的链接表明 16 位指令由 8 位操作码和 4+4 位两个通用寄存器组成.

The given link suggests that 16-bit instruction is composed of 8 bits of opcode and 4+4 bits of two General Purpose register.

ARM 拇指指令集是怎么回事??

How is it true for ARM thumb instruction set??

推荐答案

ARM(不包括新发布的 64 位)有两个指令集,它们由固定大小的指令组成.经典的称为 ARM,每条指令都是 32 位的.后一种称为 Thumb(实际上是 Thumb2),它可以有 32 位或 16 位指令.有仅支持 ARM、ARM+Thumb 和仅 Thumb 指令集的 ARM 内核.如果一个内核同时支持这两种模式,它就有改变活动指令集选择的指令,并且指令流可以在不同的指令集之间跳转(互通).

ARM (excluding newly released 64-bit) has two instruction sets which are consisting of fixed sized instructions. Classical one is called ARM and each instruction is 32-bit. Later one is called Thumb (in fact Thumb2) which can have 32-bit or 16-bit instructions. There are ARM cores which supporting only ARM, ARM+Thumb and only Thumb instruction sets. In case a core support both modes, it has instructions to change active instruction set selection and instruction streams can jump between different sets (interworking).

ARM 指令可以包含固定的操作数,但它们永远不会像指令大小一样大.一些指令还支持对操作数的操作,例如移位、旋转,这让您感觉可以用一条指令加载 32 位值.

ARM instructions can contain fixed operands however they can never be as big as instruction size. Some instructions also support operations on operands like shifting, rotating which gives you impression that it is possible to load 32-bit values with a single instruction.

示例 #1

a = 0x1;

拇指

2001        movs    r0, #1

手臂

e3a00001    mov r0, #1

示例#2

a = 0xC0000000;

拇指

f04f 4040   mov.w   r0, #0xC0000000

手臂

e3a00103    mov r0, #0xC0000000

示例 #3

a = 0x12345678

拇指

f245 6078   movw    r0, #0x5678
f2c1 2034   movt    r0, #0x1234

手臂

e3050678    movw    r0, #0x5678
e3410234    movt    r0, #0x1234

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

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