最小指令集来解决与计算机程序的任何问题最小、指令集、计算机、程序

2023-09-11 03:18:41 作者:昏君作派

几年前,我曾听说有人正要证明,每一个计算机程序,可以只用三个指令解决:

Years ago, I have heard that someone was about to demonstrate that every computer program could be solved with just three instructions:

分配 条件 循环

请我想听听你的意见。我的意思是重新presenting任何算法为计算机程序。你是否同意这种说法?

Please I would like to hear your opinion. I mean representing any algorithm as a computer program. Do you agree with this?

推荐答案

没有必要。最小理论计算机只需要一个指令。他们被称为一个指令集计算机(OISC短,有点像最终RISC)。

No need. The minimal theoretical computer needs just one instruction. They are called One Instruction Set Computers (OISC for short, kinda like the ultimate RISC).

有两种类型。第一个是理论上的纯粹的一个指令的机器,该指令真正的工作原理是在普通CPU的常规指令。该指令通常是:

There are two types. The first is a theoretically "pure" one instruction machine in which the instruction really works like a regular instruction in normal CPUs. The instruction is usually:

subtract and branch if less than zero

或其变化。该维基百科的文章有如何单指令可以用来写code仿效其他指令的例子。

or variations thereof. The wikipedia article have examples of how this single instruction can be used to write code that emulates other instructions.

第二类是不可以理论上纯净。这是传输触发体系结构(维基百科再次,抱歉)。这个家庭的架构也被称为移动的机器,我已经设计并建造了一些我自己。

The second type is not theoretically pure. It is the transfer triggered architecture (wikipedia again, sorry). This family of architectures are also known as move machines and I have designed and built some myself.

有人认为此举机器,因为机器作弊实际上所有的常规指令只,它们是存储器映射的,而不是被的运算code部分。但是,移动设备不仅是理论上的,它们是实用的(就像我说的,我已经建立了一些我自己)。甚至有市售由马​​克西姆内置的CPU系列:该 MAXQ 。如果你看一下MAXQ指令集(他们称之为转移设置,因为有真的只有一个指令,我通常把它叫做寄存器设置),你会看到MAXQ汇编看起来更像一个标准的蓄能器架构。

Some consider move machines cheating since the machine actually have all the regular instructions only that they are memory mapped instead of being part of the opcode. But move machines are not merely theoretical, they are practical (like I said, I've built some myself). There is even a commercially available family of CPUs built by Maxim: the MAXQ. If you look at the MAXQ instruction set (they call it transfer set since there is really only one instruction, I usually call it register set) you will see that MAXQ assembly looks rather like a standard accumulator based architecture.