0

我正在阅读《编程语言概念》(Sebesta 第 10 版),并在文本中将正交性定义为“可以以相对较少的方式组合一组相对较小的原始构造来构建控制和数据结构语言”。但我对是什么使某种语言特征正交感到困惑。因为我可能不会解释文本的全部荣耀:),所以我在适当的文本下方包含了。

We can illustrate the use of orthogonality as a design concept by comparing
one aspect of the assembly languages of the IBM mainframe computers
and the VAX series of minicomputers. We consider a single simple situation:
adding two 32-bit integer values that reside in either memory or registers and
replacing one of the two values with the sum. The IBM mainframes have two
instructions for this purpose, which have the forms

A Reg1, memory_cell

AR Reg1, Reg2

where Reg1 and Reg2 represent registers. The semantics of these are:

Reg1 ← contents(Reg1) + contents(memory_cell)

Reg1 ← contents(Reg1) + contents(Reg2)


The VAX addition instruction for 32-bit integer values is

ADDL operand_1, operand_2

whose semantics is

operand_2 ← contents(operand_1) + contents(operand_2)

In this case, either operand can be a register or a memory cell.
The VAX instruction design is orthogonal in that a single instruction can
use either registers or memory cells as the operands. There are two ways to
specify operands, which can be combined in all possible ways. The IBM design
is not orthogonal. Only two out of four operand combinations possibilities are
legal, and the two require different instructions, A and AR.>

所以我的主要问题是为什么 VAX 指令是正交的。仅仅是因为它的构造需要较少的指令,并且所有内容都可以在一行中完成吗?如果 VAX 系列计算机采用两条指令,IBM 采用三条指令,VAX 语言会不会更加正交?任何帮助,将不胜感激。

4

1 回答 1

0

好。文本不决定它是关于正交语言还是指令集。指令集的显着特点是您可以使用(或不能使用)的寻址模式。如果您可以使用所有(或大多数)指令的所有寻址模式,则该指令集被称为正交(参见http://en.m.wikipedia.org/wiki/Orthogonal_instruction_set#section_1)。

于 2012-05-06T19:52:32.373 回答