指令集架构的定义是什么? [英] What is the definition of instruction set architecture?

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

问题描述

我正努力围绕着指令集体系结构(ISA)到底是什么.根据我的阅读,我有两种解释.

我的第一个解释是,ISA是所有寄存器,汇编指令和伪指令,汇编器指令以及指令格式的集合,这些指令格式包括可用于对实现指令集的处理器进行编程的汇编语言.

我的第二种解释是,ISA是计算机单词和汇编指令之间的双射映射.例如,计算值$t0 + $t1并将其存储在$s0中的指令add $s0, $t0, $t1对应于字词000000 bin($t0) bin($t1) bin($rd) 00000 10000,其中bin($reg)是寄存器$reg的二进制表示(使用MISP在此示例中.)

我不认为这些解释是互斥的,因为它们可以在假定以汇编语言为给定ISA编写的程序将被汇编为实现ISA的所有处理器的相同机器代码的假设下共存.但是,我也不认为这很明显,因为如果ISA仅指汇编语言的结构(正如我的第一种解释所暗示的),则根据处理器的不同,同一程序可以被汇编为两种不同的机器代码表示形式.

有人可以澄清指令集体系结构的确切含义吗?

解决方案

指令集体系结构名义上定义了机器可以执行的每条指令,以及可能产生的影响,条件和异常等.

指令是根据它们所操作的数据定义的,这些数据称为操作数.通常,指令会分成几组,允许使用可能的操作矩阵,也称为操作码和操作数(包含寻址模式). MIPS I-Type,J-Type是这些块的示例,称为格式.

说明是ISA的关键.例如,如果没有指令可以引用该寄存器(例如,作为操作数),则提供寄存器是没有意义的.这可能是为什么我们将其称为指令集体系结构的原因,因为我们都是通过指令定义的角度来实现寄存器和行为的.

指令集体系结构定义了处理器的机器代码,并给出了处理器的行为某些状态和要执行的指令.

机器代码中的指令是二进制字符串,CPU会将它们解释为执行.

在机器代码中,没有汇编指令,标签,变量名等.这些都是汇编语言的产物.在机器代码中,如果可以的话,代表指令的二进制数字字符串(包含操作码和操作数)和由CPU处理的数据都被CPU视为数字(位字符串)而已.

尽管指令,宏,伪指令,数据和其他东西使汇编语言比事实更为近似,但是汇编语言几乎可以将1:1转换为机器代码指令.

通常,芯片制造商将定义汇编语言以及指令集体系结构-但是,汇编语言不是具有ISA的要求. ISA真正的意思是了解什么数字(位字符串)对处理器有什么意义.

尽管确实如此,但芯片制造商和/或其他人(例如Microsoft,Linux)通常也会定义应用程序二进制接口,其中包括调用约定,以帮助软件使用者编写可互操作的文件软件.

计算机单词与汇编指令之间的双射映射

是和否:是的,如果按照汇编指令的意思是每个可能指令的操作和行为的定义.

我要说的是机器码的位串与处理器如何解析编码的详细定义之间的映射,以及编码的作用,即编码对计算机状态的影响.

I am trying to wrap my head around what, exactly, an instruction set architecture (ISA) is. From what I have read, I have two interpretations.

My first interpretation is that an ISA is the set of all registers, assembly instructions and pseudo instructions, assembler directives, and instruction formats that comprise the assembly language that can be used to program a processor that implements the instruction set.

My second interpretation is that an ISA is a bijective mapping between computer words and assembly instructions. For example, the instruction add $s0, $t0, $t1, which computes the value $t0 + $t1 and stores it in $s0, corresponds to the word 000000 bin($t0) bin($t1) bin($rd) 00000 10000, where bin($reg) is the binary representation of the register $reg (MISP is used in this example).

I do not see the interpretations as mutually exclusive, as they can coexist under the assumption that a program written in the assembly language for a given ISA will be assembled to the same machine code for all processors that implement the ISA; however, I also do not regard this as evident, because if the ISA merely refers to the structure of the assembly language (as my first interpretation suggests), then the same program could be assembled into two different machine code representations depending on the processor.

Could someone clarify what exactly the term instruction set architecture encompasses?

解决方案

Instruction Set Architecture defines, nominally, each instruction that the machine can execute, along with things like the effects, conditions, and exceptions possible, etc..

Instructions are defined in terms of data they operate on, and these data are referred to as operands.  Typically, instructions will clump together into groups allowing a matrix of possible operations aka opcodes, and operands (to include addressing modes).  MIPS I-Type, J-Type are examples of these clumps, referred to as formats.

Instructions are key to an ISA.  There would be no point in providing a register, for example, if no instruction could reference that register (e.g as an operand).  This is probably why we call it an instruction set architecture, since we realize the registers and behaviors all through the lens of the definition of instructions.

The instruction set architecture defines the machine code of the processor, and the processor's behavior given certain states and instructions to execute.

Instructions in machine code are strings of binary digits, which the CPU interprets aka executes.

In machine code, there are no assembler directives, labels, variable names, etc...; these are all artifacts of assembly language.  In machine code, the strings of binary digits representing instructions (containing opcodes and operands) and data manipulated by the CPU are all seen by the CPU simply as numbers (bit strings), if you will. 

Assembly language can translate almost 1:1 to machine code instructions, though directives, macros, pseudo instructions, data, and other things are what makes that more of an approximation than a fact.

Usually, the chip maker will define an assembly language along with the instruction set architecture — however, assembly language is not a requirement to have an ISA.  All an ISA really means is understanding of what numbers (bit strings) have what meaning to the processor.

Indeed often though, the chip maker and/or someone else (e.g. Microsoft, Linux) will also define an Application Binary Interface, which includes a calling convention to help software consumers write interoperable software.

bijective mapping between computer words and assembly instructions

Yes and no: Yes, if by assembly instructions you mean the definitions of the operations and behaviors of each possible instruction.

I would say the mapping between bit strings of machine code and detailed definitions of how encodings are parsed by the processor, and what they do, i.e. their effect on computer state.

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

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