Aone-instruction set computer (OISC), sometimes referred to as anultimatereduced instruction set computer (URISC), is anabstract machine that uses only one instruction – obviating the need for amachine languageopcode.[1][2][3] With a judicious choice for the single instruction and given arbitrarily many resources, an OISC is capable of being auniversal computer in the same manner as traditional computers that have multiple instructions.[2]: 55 OISCs have been recommended as aids in teaching computer architecture[1]: 327 [2]: 2 and have been used as computational models in structural computing research.[3] The firstcarbon nanotube computer is a1-bit one-instruction set computer (and has only 178 transistors).[4]
In aTuring-complete model, each memory location can store an arbitrary integer, and – depending on the mode, there may be arbitrarily many locations. The instructions themselves reside in memory as a sequence of such integers.
There exists a class ofuniversal computers with a single instruction based on bit manipulation such asbit copying orbit inversion. Since their memory model is finite, as is the memory structure used in real computers, those bit manipulation machines are equivalent to real computers rather than to Turing machines.[5]
Currently known OISCs can be roughly separated into three broad categories:
Bit-manipulating machines are the simplest class.
TheFlipJump machine has 1 instruction, a;b - flips the bit a, then jumps to b. This is the most primitive OISC, but it's still useful. It can successfully do math/logic calculations, branching, pointers, and calling functions with the help of its standard library.
A bit copying machine,[5] called BitBitJump, copies one bit in memory and passes the execution unconditionally to the address specified by one of the operands of the instruction. This process turns out to be capable ofuniversal computation (i.e. being able to execute any algorithm and to interpret any other universal machine) because copying bits can conditionally modify the copying address that will be subsequently executed.
Another machine, called theToga Computer, inverts a bit and passes the execution conditionally depending on the result of inversion. The unique instruction is TOGA(a,b) which stands forTOGgleaAnd branch tob if the result of the toggle operation is true.
This sectionneeds expansion. You can help byadding to it.(December 2016) |
Similar to BitBitJump, a multi-bit copying machine copies several bits at the same time. The problem ofcomputational universality is solved in this case by keeping predefined jump tables in the memory.[clarification needed]
Transport triggered architecture (TTA) is a design in which computation is a side effect of data transport. Usually, some memory registers (triggering ports) within common address space perform an assigned operation when the instruction references them. For example, in an OISC using a single memory-to-memory copy instruction, this is done by triggering ports that perform arithmetic and instruction pointer jumps when written to.
Arithmetic-based Turing-complete machines use an arithmetic operation and a conditional jump. Like the two previous universal computers, this class is also Turing-complete. The instruction operates on integers which may also be addresses in memory.
Currently there are several known OISCs of this class, based on different arithmetic operations:
Common choices for the single instruction are:
Onlyone of these instructions is used in a given implementation. Hence, there is no need for an opcode to identify which instruction to execute; the choice of instruction is inherent in the design of the machine, and an OISC is typically named after the instruction it uses (e.g., an SBN OISC,[2]: 41 the SUBLEQ language,[3]: 4 etc.). Each of the above instructions can be used to construct a Turing-complete OISC.
This article presents only subtraction-based instructions among those that are not transport triggered. However, it is possible to construct Turing complete machines using an instruction based on other arithmetic operations, e.g., addition. For example, one variation known as DLN (Decrement and jump if not zero) has only two operands and uses decrement as the base operation. For more information see Subleq derivative languages[1].
TheSBNZ a, b, c, d instruction ("subtract and branch if not equal to zero") subtracts the contents at addressa from the contents at addressb, stores the result at addressc, and then,if the result is not 0, transfers control to addressd (if the result is equal to zero, execution proceeds to the next instruction in sequence).[3]
Thesubleq instruction ("subtract and branch if less than or equal to zero") subtracts the contents at addressa from the contents at addressb, stores the result at addressb, and then,if the result is not positive, transfers control to addressc (if the result is positive, execution proceeds to the next instruction in sequence).[3]: 4–7 Pseudocode:
Instructionsubleqa,b,c Mem[b] = Mem[b] - Mem[a]if (Mem[b] ≤ 0)goto cConditional branching can be suppressed by setting the third operand equal to the address of the next instruction in sequence. If the third operand is not written, this suppression is implied.
A variant is also possible with two operands and an internalaccumulator, where the accumulator is subtracted from the memory location specified by the first operand. The result is stored in both the accumulator and the memory location, and the second operand specifies the branch address:
Instructionsubleq2a,b Mem[a] = Mem[a] - ACCUM ACCUM = Mem[a]if (Mem[a] ≤ 0)goto bAlthough this uses only two (instead of three) operands per instruction, correspondingly more instructions are then needed to effect various logical operations.
It is possible to synthesize many types of higher-order instructions using only thesubleq instruction.[3]: 9–10
Unconditional branch:
subleqZ,Z,c
Addition can be performed by repeated subtraction, with no conditional branching; e.g., the following instructions result in the content at locationa being added to the content at locationb:
subleqa,ZsubleqZ,bsubleqZ,Z
The first instruction subtracts the content at locationa from the content at locationZ (which is 0) and stores the result (which is the negative of the content ata) in locationZ. The second instruction subtracts this result fromb, storing inb this difference (which is now the sum of the contents originally ata andb); the third instruction restores the value 0 toZ.
A copy instruction can be implemented similarly; e.g., the following instructions result in the content at locationb getting replaced by the content at locationa, again assuming the content at locationZ is maintained as 0:
subleqb,bsubleqa,ZsubleqZ,bsubleqZ,Z
Any desired arithmetic test can be built. For example, a branch-if-zero condition can be assembled from the following instructions:
subleqb,Z,L1subleqZ,Z,OUTL1:subleqZ,ZsubleqZ,b,cOUT:...
Subleq2 can also be used to synthesize higher-order instructions, although it generally requires more operations for a given task. For example, no fewer than 10 subleq2 instructions are required to flip all the bits in a given byte:
subleq2tmp; tmp = 0 (tmp = temporary register)subleq2tmpsubleq2one; acc = -1subleq2a; a' = a + 1subleq2Z; Z = - a - 1subleq2tmp; tmp = a + 1subleq2a; a' = 0subleq2tmp; load tmp into accsubleq2a; a' = - a - 1 ( = ~a )subleq2Z; set Z back to 0
The following program (written inpseudocode) emulates the execution of asubleq-based OISC:
intmemory[],program_counter,a,b,cprogram_counter=0while(program_counter>=0):a=memory[program_counter]b=memory[program_counter+1]c=memory[program_counter+2]if(a<0orb<0):program_counter=-1else:memory[b]=memory[b]-memory[a]if(memory[b]>0):program_counter+=3else:program_counter=c
This program assumes thatmemory[] is indexed bynonnegative integers. Consequently, for asubleq instruction (a,b,c), the program interpretsa < 0,b < 0, or an executed branch toc < 0 as a halting condition. Similar interpreters written in asubleq-based language (i.e.,self-interpreters, which may useself-modifying code as allowed by the nature of thesubleq instruction) can be found in the external links below.
A general purposeSMP-capable 64-bitoperating system calledDawn OS has been implemented in an emulated Subleq machine. The OS contains aC-like compiler. Some memory areas in the virtual machine are used for peripherals like the keyboard, mouse, hard drives, network card, etc. Basic applications written for it include a media player, painting tool, document reader and scientific calculator.[13]
A 32-bit Subleq computer with a graphic display and a keyboard calledIzhora has been constructed byYoel Matveyev as a largecellular automaton pattern.[14][15]
There is acompiler calledHigher Subleq written by Oleg Mazonka that compiles a simplified C program intosubleq code.[16]
Alternatively there is a self hostingForth implementation written by Richard James Howe that runs on top of a Subleq VM and is capable of interactive programming of the Subleq machine[17]
Thesubneg instruction ("subtract and branch if negative"), also calledSBN, is defined similarly tosubleq:[2]: 41, 51–52
Instructionsubnega,b,c Mem[b] = Mem[b] - Mem[a]if (Mem[b] < 0)goto cConditional branching can be suppressed by setting the third operand equal to the address of the next instruction in sequence. If the third operand is not written, this suppression is implied.
It is possible to synthesize many types of higher-order instructions using only thesubneg instruction. For simplicity, only one synthesized instruction is shown here to illustrate the difference betweensubleq andsubneg.
Unconditional branch:[2]: 88–89
subnegPOS,Z,c
whereZ andPOS are locations previously set to contain 0 and a positive integer, respectively;
Unconditional branching is assured only ifZ initially contains 0 (or a value less than the integer stored inPOS). A follow-up instruction is required to clearZ after the branching, assuming that the content ofZ must be maintained as 0.
A variant is also possible with four operands – subneg4. The reversal of minuend and subtrahend eases implementation in hardware. The non-destructive result simplifies the synthetic instructions.
Instructionsubnegs,m,r,j(* subtrahend, minuend, result and jump addresses *) Mem[r] = Mem[m] - Mem[s]if (Mem[r] < 0)goto jIn an attempt to make Turing machine more intuitive, Z. A. Melzak consider the task of computing with positive numbers. The machine has an infinite abacus, an infinite number of counters (pebbles, tally sticks) initially at a special location S. The machine is able to do one operation:
Take from location X as many counters as there are in location Y and transfer them to location Z and proceed to instruction y.
If this operation is not possible because there is not enough counters in X, then leave the abacus as it is and proceed to instruction n.[18]
In order to keep all numbers positive and mimic a human operator computing on a real world abacus, the test is performed before any subtraction. Pseudocode:
InstructionmelzakX,Y,Z,n,yif (Mem[X] < Mem[Y])goto n Mem[X] -= Mem[Y] Mem[Z] += Mem[Y]goto yAfter giving a few programs: multiplication, gcd, computing then-th prime number, representation in baseb of an arbitrary number, sorting in order of magnitude, Melzak shows explicitly how to simulate an arbitrary Turing machine on his arithmetic machine.
multiply:melzakP,ONE,S,stop; Move 1 counter from P to S. If not possible, move to stop.melzakS,Q,ANS,multiply,multiply; Move q counters from S to ANS. Move to the first instruction.stop:
where the memory location P isp, Q isq, ONE is 1, ANS is initially 0 and at the endpq, and S is a large number.
He mentions that it can easily be shown using the elements of recursive functions that every number calculable on the arithmetic machine is computable. A proof of which was given by Lambek[19] on an equivalent two instruction machine : X+ (increment X) and X− else T (decrement X if it not empty, else jump to T).
In areverse subtract and skip if borrow (RSSB) instruction, theaccumulator is subtracted from the memory location and the next instruction is skipped if there was a borrow (memory location was smaller than the accumulator). The result is stored in both the accumulator and the memory location. Theprogram counter is mapped to memory location 0. The accumulator is mapped to memory location 1.[2]
Instructionrssbx ACCUM = Mem[x] - ACCUM Mem[x] = ACCUMif (ACCUM < 0)goto PC + 2To set x to the value of y minus z:
# First, move z to the destination location x.RSSBtemp# Three instructions required to clear acc, temp [See Note 1]RSSBtempRSSBtempRSSBx# Two instructions clear acc, x, since acc is already clearRSSBxRSSBy# Load y into acc: no borrowRSSBtemp# Store -y into acc, temp: always borrow and skipRSSBtemp# SkippedRSSBx# Store y into x, acc# Second, perform the operation.RSSBtemp# Three instructions required to clear acc, tempRSSBtempRSSBtempRSSBz# Load zRSSBx# x = y - z [See Note 2]
A transport triggered architecture uses only themove instruction, hence it was originally called a "move machine". This instruction moves the contents of one memory location to another memory location combining with the current content of the new location:[2]: 42 [20]
Instructionmovxa,b (also writtena ->b) OP = GetOperation(Mem[b]) Mem[b] := OP(Mem[a], Mem[b])The operation performed is defined by the destination memory cell. Some cells are specialized in addition, some other in multiplication, etc. So memory cells are not simple store but coupled with anarithmetic logic unit (ALU) setup to perform only one sort of operation with the current value of the cell. Some of the cells arecontrol flow instructions to alter the program execution with jumps,conditional execution,subroutines,if-then-else,for-loop, etc...
A commercial transport triggered architecture microcontroller has been produced called MAXQ, which hides the apparent inconvenience of an OISC by using a "transfer map" that represents all possible destinations for themove instructions.[21]

Cryptoleq[22] is a language similar to Subleq. It consists of oneeponymous instruction and is capable of performing general-purpose computation on encrypted programs. Cryptoleq works on continuous cells of memory using direct and indirect addressing, and performs two operationsO1 andO2 on three values A, B, and C:
Instructioncryptoleqa,b,c Mem[b] = O1(Mem[a], Mem[b])if O2(Mem[b]) ≤ 0 IP = celse IP = IP + 3where a, b and c are addressed by the instruction pointer, IP, with the value of IP addressing a, IP + 1 point to b and IP + 2 to c.
In Cryptoleq operationsO1 andO2 are defined as follows:
The main difference with Subleq is that in Subleq,O1(x,y) simply subtractsy fromx andO2(x) equals tox. Cryptoleq is also homomorphic to Subleq, modular inversion and multiplication is homomorphic to subtraction and the operation ofO2 corresponds the Subleq test if the values were unencrypted. A program written in Subleq can run on a Cryptoleq machine, meaning backwards compatibility. However, Cryptoleq implements fully homomorphic calculations and is capable of multiplications. Multiplication on an encrypted domain is assisted by a unique function G that is assumed to be difficult to reverse engineer and allows re-encryption of a value based on theO2 operation:
where is the re-encrypted value ofy and is encrypted zero.x is the encrypted value of a variable, let it bem, and equals.
The multiplication algorithm is based on addition and subtraction, uses the function G and does not have conditional jumps nor branches. Cryptoleq encryption is based onPaillier cryptosystem.