One instruction set computer
   HOME

TheInfoList



OR:

A one-instruction set computer (OISC), sometimes called an ultimate
reduced instruction set computer In computer engineering, a reduced instruction set computer (RISC) is a computer designed to simplify the individual instructions given to the computer to accomplish tasks. Compared to the instructions given to a complex instruction set comp ...
(URISC), is an
abstract machine An abstract machine is a computer science theoretical model that allows for a detailed and precise analysis of how a computer system functions. It is analogous to a mathematical function in that it receives inputs and produces outputs based on pr ...
that uses only one instructionobviating the need for a
machine language In computer programming, machine code is any low-level programming language, consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). Each instruction causes the CPU to perform a ver ...
opcode In computing, an opcode (abbreviated from operation code, also known as instruction machine code, instruction code, instruction syllable, instruction parcel or opstring) is the portion of a machine language instruction that specifies the operat ...
. With a judicious choice for the single instruction and given infinite resources, an OISC is capable of being a universal computer in the same manner as traditional computers that have multiple instructions. OISCs have been recommended as aids in teaching computer architecture and have been used as computational models in structural computing research. The first
carbon nanotube computer Carbon nanotube computers are a class of experimental computing processors constructed from carbon nanotube field-effect transistors, instead of from conventional silicon-based field-effect transistors. __NOTOC__ In a carbon nanotube field-effe ...
is a 1-bit one-instruction set computer (and has only 178 transistors).


Machine architecture

In a Turing-complete model, each memory location can store an arbitrary integer, anddepending on the modelthere may be arbitrarily many locations. The instructions themselves reside in memory as a sequence of such integers. There exists a class of universal computers with a single instruction based on bit manipulation such as bit copying or bit 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.Oleg Mazonka
"Bit Copying: The Ultimate Computational Simplicity"
Complex Systems Journal 2011, Vol 19, N3, pp. 263–285
Currently known OISCs can be roughly separated into three broad categories: * Bit-manipulating machines * Transport triggered architecture machines * Arithmetic-based Turing-complete machines


Bit-manipulating machines

Bit-manipulating machines are the simplest class.


FlipJump

Th
FlipJump
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.


BitBitJump

A bit copying machine, 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 of universal computation (i.e. being able to execute any algorithm and to interpret any other universal machine) because copying bits can conditionally modify the code that will be subsequently executed.


Toga computer

Another machine, called th
Toga Computer
inverts a bit and passes the execution conditionally depending on the result of inversion. The unique instruction is TOGA(a,b) which stands for TOGgle ''a'' And branch to ''b'' if the result of the toggle operation is true.


Multi-bit copying machine

Similar to BitBitJump, a multi-bit copying machine copies several bits at the same time. The problem of computational universality is solved in this case by keeping predefined jump tables in the memory.


Transport triggered architecture

''
Transport triggered architecture In computer architecture, a transport triggered architecture (TTA) is a kind of processor_(computing), processor design in which programs directly control the internal transport bus (computing), buses of a processor. Computation happens as a side e ...
'' (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

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: * addition (addleq, add and branch if less than or equal to zero) * decrement (DJN, Decrement and branch (Jump) if Nonzero) * increment (P1eq, Plus 1 and branch if equal to another value) * subtraction (subleq, subtract and branch if less than or equal to zero) * positive subtraction when possible, else branch (Arithmetic machine)


Instruction types

Common choices for the single instruction are: * Subtract and branch if less than or equal to zero * Subtract and branch if negative * Subtract if positive else branch *
Reverse subtract and skip if borrow Reverse or reversing may refer to: Arts and media * ''Reverse'' (Eldritch album), 2001 * ''Reverse'' (2009 film), a Polish comedy-drama film * ''Reverse'' (2019 film), an Iranian crime-drama film * ''Reverse'' (Morandi album), 2005 * ''Reverse'' ...
*
Move Move may refer to: People * Daniil Move (born 1985), a Russian auto racing driver Brands and enterprises * Move (company), an online real estate company * Move (electronics store), a defunct Australian electronics retailer * Daihatsu Move Go ...
(used as part of a transport triggered architecture) * Subtract and branch if non zero (SBNZ a, b, c, destination) * Cryptoleq (heterogeneous encrypted and unencrypted computation) Only ''one'' 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, the SUBLEQ language, 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 language


Subtract and branch if not equal to zero

The SBNZ a, b, c, d instruction ("''subtract and branch if not equal to zero''") subtracts the contents at address ''a'' from the contents at address ''b'', stores the result at address ''c'', and then, ''if the result is not 0'', transfers control to address ''d'' (if the result is equal to zero, execution proceeds to the next instruction in sequence).


Subtract and branch if less than or equal to zero

The instruction ("''subtract and branch if less than or equal to zero''") subtracts the contents at address from the contents at address , stores the result at address , and then, ''if the result is not positive'', transfers control to address (if the result is positive, execution proceeds to the next instruction in sequence).
Pseudocode In computer science, pseudocode is a plain language description of the steps in an algorithm or another system. Pseudocode often uses structural conventions of a normal programming language, but is intended for human reading rather than machine re ...
: Instruction subleq a, b, c Mem = Mem - Mem if (Mem ≤ 0) goto c Conditional 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 internal accumulator, 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: Instruction subleq2 a, b Mem = Mem - ACCUM ACCUM = Mem if (Mem ≤ 0) goto b Although this uses only two (instead of three) operands per instruction, correspondingly more instructions are then needed to effect various logical operations.


Synthesized instructions

It is possible to synthesize many types of higher-order instructions using only the instruction. Unconditional branch: ; : subleq Z, Z, c Addition can be performed by repeated subtraction, with no conditional branching; e.g., the following instructions result in the content at location being added to the content at location : ; : subleq a, Z subleq Z, b subleq Z, Z The first instruction subtracts the content at location from the content at location (which is 0) and stores the result (which is the negative of the content at ) in location . The second instruction subtracts this result from , storing in this difference (which is now the sum of the contents originally at and ); the third instruction restores the value 0 to . A copy instruction can be implemented similarly; e.g., the following instructions result in the content at location getting replaced by the content at location , again assuming the content at location is maintained as 0: ; : subleq b, b subleq a, Z subleq Z, b subleq Z, Z Any desired arithmetic test can be built. For example, a branch-if-zero condition can be assembled from the following instructions: ; : subleq b, Z, L1 subleq Z, Z, OUT L1: subleq Z, Z subleq Z, b, c OUT: ... 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: ; : subleq2 tmp ; tmp = 0 (tmp = temporary register) subleq2 tmp subleq2 one ; acc = -1 subleq2 a ; a' = a + 1 subleq2 Z ; Z = - a - 1 subleq2 tmp ; tmp = a + 1 subleq2 a ; a' = 0 subleq2 tmp ; load tmp into acc subleq2 a ; a' = - a - 1 ( = ~a ) subleq2 Z ; set Z back to 0


Emulation

The following program (written in
pseudocode In computer science, pseudocode is a plain language description of the steps in an algorithm or another system. Pseudocode often uses structural conventions of a normal programming language, but is intended for human reading rather than machine re ...
) emulates the execution of a -based OISC: int memory[], program_counter, a, b, c program_counter = 0 while (program_counter >= 0): a = memory[program_counter] b = memory[program_counter+1] c = memory[program_counter+2] if (a < 0 or b < 0): program_counter = -1 else: memory = memory - memory if (memory > 0): program_counter += 3 else: program_counter = c This program assumes that is indexed by ''nonnegative'' integers. Consequently, for a instruction (, , ), the program interprets , , or an executed branch to as a halting condition. Similar interpreters written in a -based language (i.e.,
self-interpreter In computer science, an interpreter is a computer program that directly execution (computers), executes instructions written in a Programming language, programming or scripting language, without requiring them previously to have been Compiler, co ...
s, which may use
self-modifying code In computer science, self-modifying code (SMC) is code that alters its own instructions while it is executing – usually to reduce the instruction path length and improve performance or simply to reduce otherwise repetitively similar code, ...
as allowed by the nature of the instruction) can be found in the external links below. A general purpose SMP-capable 64-bit
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
called Dawn OS has been implemented in an emulated Subleq machine. The OS contains a C-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. A 32-bit Subleq computer with a graphic display and a keyboard called Izhora has been constructed by
Yoel Matveyev Yoel Matveyev (יואל מאַטוועיעוו), born in 1976, is a Yiddish poet, writer and journalist from Leningrad, USSR with background in computer programming.https://www.gazetaeao.ru/idish-obshhechelovecheskij-yazyk/ He taught himself Yiddis ...
as a large cellular automation pattern.


Compilation

There is a
compiler In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs tha ...
called Higher Subleq written by Oleg Mazonka that compiles a simplified C program into code.


Subtract and branch if negative

The instruction ("''subtract and branch if negative''"), also called , is defined similarly to : Instruction subneg a, b, c Mem = Mem - Mem if (Mem < 0) goto c Conditional 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.


Synthesized instructions

It is possible to synthesize many types of higher-order instructions using only the instruction. For simplicity, only one synthesized instruction is shown here to illustrate the difference between and . Unconditional branch: ; : subneg POS, Z, c where and are locations previously set to contain 0 and a positive integer, respectively; Unconditional branching is assured only if initially contains 0 (or a value less than the integer stored in ). A follow-up instruction is required to clear after the branching, assuming that the content of must be maintained as 0.


subneg4

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. Instruction subneg s, m, r, j ''(* subtrahend, minuend, result and jump addresses *)'' Mem = Mem - Mem if (Mem < 0) goto j


Arithmetic machine

In 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 Y, then leave the abacus as it is and proceed to instruction n.
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: Instruction melzak X, Y, Z, n, y if (Mem < Mem goto n Mem -= Mem Mem += Mem goto y After giving a few programs: multiplication, gcd, computing the ''n''-th prime number, representation in base ''b'' of an arbitrary number, sorting in order of magnitude, Melzak shows explicitly how to simulate an arbitrary Turing machine on his arithmetic machine. ; : multiply: melzak P, ONE, S, stop ; Move 1 counter from P to S. If not possible, move to stop. melzak S, Q, ANS, multiply, multiply ; Move q counters from S to ANS. Move to the first instruction. stop: where the memory location P is ''p'', Q is ''q'', ONE is 1, ANS is initially 0 and at the end ''pq'', 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 on an equivalent two instruction machine : X+ (increment X) and X− else T (decrement X if it not empty, else jump to T).


Reverse subtract and skip if borrow

In a ''reverse subtract and skip if borrow'' (RSSB) instruction, the accumulator 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. The
program counter The program counter (PC), commonly called the instruction pointer (IP) in Intel x86 and Itanium microprocessors, and sometimes called the instruction address register (IAR), the instruction counter, or just part of the instruction sequencer, i ...
is mapped to memory location 0. The accumulator is mapped to memory location 1. Instruction rssb x ACCUM = Mem - ACCUM Mem = ACCUM if (ACCUM < 0) goto PC + 2


Example

To set x to the value of y minus z: # First, move z to the destination location x. RSSB temp # Three instructions required to clear acc, temp ee Note 1 RSSB temp RSSB temp RSSB x # Two instructions clear acc, x, since acc is already clear RSSB x RSSB y # Load y into acc: no borrow RSSB temp # Store -y into acc, temp: always borrow and skip RSSB temp # Skipped RSSB x # Store y into x, acc # Second, perform the operation. RSSB temp # Three instructions required to clear acc, temp RSSB temp RSSB temp RSSB z # Load z RSSB x # x = y - z ee Note 2 * ote 1If the value stored at "temp" is initially a negative value and the instruction that executed right before the first "RSSB temp" in this routine borrowed, then four "RSSB temp" instructions will be required for the routine to work. * ote 2If the value stored at "z" is initially a negative value then the final "RSSB x" will be skipped and thus the routine will not work.


Transport triggered architecture

A transport triggered architecture uses only the ''move'' 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: Instruction movx a, b (also written ''a'' -> ''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 an
arithmetic logic unit In computing, an arithmetic logic unit (ALU) is a combinational digital circuit that performs arithmetic and bitwise operations on integer binary numbers. This is in contrast to a floating-point unit (FPU), which operates on floating point num ...
(ALU) setup to perform only one sort of operation with the current value of the cell. Some of the cells are
control flow In computer science, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated. The emphasis on explicit control flow distinguishes an '' ...
instructions to alter the program execution with jumps,
conditional execution Addressing modes are an aspect of the instruction set architecture in most central processing unit (CPU) designs. The various addressing modes that are defined in a given instruction set architecture define how the machine language instructions i ...
,
subroutines In computer programming, a function or subroutine is a sequence of program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed. Functions may ...
,
if-then-else In computer science, conditionals (that is, conditional statements, conditional expressions and conditional constructs,) are programming language commands for handling decisions. Specifically, conditionals perform different computations or actio ...
, 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 the ''move'' instructions.


Cryptoleq

Cryptoleq is a language consisting of one
eponymous An eponym is a person, a place, or a thing after whom or which someone or something is, or is believed to be, named. The adjectives which are derived from the word eponym include ''eponymous'' and ''eponymic''. Usage of the word The term ''epon ...
instruction, is capable of performing general-purpose computation on encrypted programs and is a close relative to Subleq. Cryptoleq works on continuous cells of memory using direct and indirect addressing, and performs two operations and on three values A, B, and C: Instruction cryptoleq a, b, c Mem = O1(Mem Mem if O2(Mem ≤ 0 IP = c else IP = IP + 3 where 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 operations and are defined as follows: :\begin O_1(x,y) & = & x^_y \,\bmod\, N^2 \end :\begin O_2(x) & = & \left \lfloor \frac \right \rfloor \end The main difference with Subleq is that in Subleq, simply subtracts from and equals to . Cryptoleq is also homomorphic to Subleq, modular inversion and multiplication is homomorphic to subtraction and the operation of corresponds the Subleq test if the values were unencrypted. A program written in Subleq can run on a Cryptoleq machine, meaning backwards compatibility. Cryptoleq though, implements fully homomorphic calculations and since the model is be able to do 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 the operation: :G(x,y) = \begin \tilde, & \textO_2(\bar)\text\leq 0 \\ \tilde, & \text \end where \tilde is the re-encrypted value of and \tilde is encrypted zero. is the encrypted value of a variable, let it be , and \bar 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 on Paillier cryptosystem.


See also

* FRACTRAN * Minimal axioms for Boolean algebra *
Register machine In mathematical logic and theoretical computer science a register machine is a generic class of abstract machines used in a manner similar to a Turing machine. All the models are Turing equivalent. Overview The register machine gets its name fro ...
*
Turing tarpit A Turing tarpit (or Turing tar-pit) is any programming language or computer interface that allows for flexibility in function but is difficult to learn and use because it offers little or no support for common tasks. The phrase was coined in 198 ...
*
Reduced instruction set computer In computer engineering, a reduced instruction set computer (RISC) is a computer designed to simplify the individual instructions given to the computer to accomplish tasks. Compared to the instructions given to a complex instruction set comp ...
*
Complex instruction set computer A complex instruction set computer (CISC ) is a computer architecture in which single instructions can execute several low-level operations (such as a load from memory, an arithmetic operation, and a memory store) or are capable of multi-step o ...
*
Zero instruction set computer No instruction set computing (NISC) is a computing architecture and compiler technology for designing highly efficient custom processors and hardware accelerators by allowing a compiler to have low-level control of hardware resources. Overview N ...


References


External links


Subleq on the esoteric programming languages wiki
– interpreters, compilers, examples and derivative languages * by Christopher Domas
Laboratory subleq computer
FPGA A field-programmable gate array (FPGA) is an integrated circuit designed to be configured by a customer or a designer after manufacturinghence the term '' field-programmable''. The FPGA configuration is generally specified using a hardware d ...
implementation using
VHDL The VHSIC Hardware Description Language (VHDL) is a hardware description language (HDL) that can model the behavior and structure of digital systems at multiple levels of abstraction, ranging from the system level down to that of logic gate ...

The Retrocomputing Museum
– SBN emulator and sample programs

– implemented with
7400 series The 7400 series of integrated circuits (ICs) are a popular logic family of transistor–transistor logic (TTL) logic chips. In 1964, Texas Instruments introduced the SN5400 series of logic chips, in a ceramic semiconductor package. A lo ...
integrated circuits
RSSB on the esoteric programming languages wiki
– interpreters and examples
Dr. Dobb's 32-bit OISC implementation
– transport triggered architecture (TTA) on an
FPGA A field-programmable gate array (FPGA) is an integrated circuit designed to be configured by a customer or a designer after manufacturinghence the term '' field-programmable''. The FPGA configuration is generally specified using a hardware d ...
using
Verilog Verilog, standardized as IEEE 1364, is a hardware description language (HDL) used to model electronic systems. It is most commonly used in the design and verification of digital circuits at the register-transfer level of abstraction. It is als ...

Introduction to the MAXQ Architecture
– includes transfer map diagram
OISC-Emulator
– graphical version
TrapCC
(recent Intel x86 MMUs are actually Turing-complete OISCs.)
Izhora
– Yoel Matveyev's Subleq computer built as a cellular automation
SBN simulator
– simulator and design inspired by
CARDboard Illustrative Aid to Computation CARDIAC (CARDboard Illustrative Aid to Computation) is a learning aid developed by David Hagelbarger and Saul Fingerman for Bell Telephone Laboratories in 1968 to teach high school students how computers work. The kit consists of an instruction ...

One-bit Computing at 60 Hertz
– intermediate between a computer and a
state machine A finite-state machine (FSM) or finite-state automaton (FSA, plural: ''automata''), finite automaton, or simply a state machine, is a mathematical model of computation. It is an abstract machine that can be in exactly one of a finite number ...

The NOR Machine
nfo on building a CPU with only one Instruction
Cryptoleq
ryptoleq resources repository
CAAMP
omputer Architecture A Minimalist Perspective
SICO
– Single Instruction COmputer: a variant of SUBLEQ using unsigned integers {{Authority control Models of computation Esoteric programming languages