HOME

TheInfoList




In
computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of computation, automation, a ...
, an instruction set architecture (ISA), also called
computer architecture In computer engineering, computer architecture is a set of rules and methods that describe the functionality, organization, and implementation of computer systems. The architecture of a system refers to its structure in terms of separately specifi ...
, is an
abstract model A conceptual model is a representation of a system, made of the composition of concept Concepts are defined as abstract ideas or general notions that occur in the mind, in speech, or in thought. They are understood to be the fundamental building ...
of a
computer A computer is a machine that can be programmed to Execution (computing), carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of operations known as Computer program, programs. These ...

computer
. A device that executes instructions described by that ISA, such as a
central processing unit A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuit 200px, A circuit built on a printed circuit board (PCB). An electronic circuit is composed of individual electroni ...

central processing unit
(CPU), is called an ''implementation''. In general, an ISA defines the supported
instructions Instruction or instructions may refer to: Computing * Instruction, one operation of a processor within a computer architecture instruction set * Computer program, a collection of instructions Music * Instruction (band), a 2002 rock band from New Y ...
,
data type In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Alg ...
s, registers, the hardware support for managing
main memory Computer data storage is a technology consisting of computer components and Data storage device, recording media that are used to retain digital data (computing), data. It is a core function and fundamental component of computers. The cent ...
, fundamental features (such as the
memory consistency Memory is the faculty of the brain A brain is an organ (anatomy), organ that serves as the center of the nervous system in all vertebrate and most invertebrate animals. It is located in the head, usually close to the sensory organs for sense ...
,
addressing mode Addressing modes are an aspect of the instruction set architecture In computer science, an instruction set architecture (ISA), also called computer architecture, is an abstract model of a computer. A device that executes instructions described b ...
s,
virtual memory In computing, virtual memory, or virtual storage is a Memory management (operating systems), memory management technique that provides an "idealized abstraction of the storage resources that are actually available on a given machine" which "cre ...

virtual memory
), and the
input/output In computing, input/output (I/O, or informally io or IO) is the communication between an information processing system, such as a computer, and the outside world, possibly a human or another information processing system. Information, Inputs are ...
model of a family of implementations of the ISA. An ISA specifies the behavior of
machine code In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, ge ...
running on implementations of that ISA in a fashion that does not depend on the characteristics of that implementation, providing
binary compatibility Binary-code compatibility (binary compatible or object-code-compatible) is a property of computer systems A computer is a machine A machine is a man-made device that uses power to apply forces and control movement to perform an action ...
between implementations. This enables multiple implementations of an ISA that differ in characteristics such as
performance A performance is an act of staging or presenting a play, concert, or other form of entertainment. It is also defined as the action or process of carrying out or accomplishing an action, task, or function. Management science In the work place ...
, physical size, and monetary cost (among other things), but that are capable of running the same machine code, so that a lower-performance, lower-cost machine can be replaced with a higher-cost, higher-performance machine without having to replace software. It also enables the evolution of the
microarchitecture In computer engineering Computer engineering (CoE or CpE) is a branch of engineering Engineering is the use of scientific method, scientific principles to design and build machines, structures, and other items, including bridges, ...
s of the implementations of that ISA, so that a newer, higher-performance implementation of an ISA can run software that runs on previous generations of implementations. If an
operating system An operating system (OS) is system software System software is software designed to provide a platform for other software. Examples of system software include operating systems (OS) like macOS, Linux, Android (operating system), Android and Mi ...

operating system
maintains a standard and compatible
application binary interface In computer software Software is a collection of instructions Instruction or instructions may refer to: Computing * Instruction, one operation of a processor within a computer architecture instruction set * Computer program, a collection ...
(ABI) for a particular ISA, machine code will run on future implementations of that ISA and operating system. However, if an ISA supports running multiple operating systems, it does not guarantee that machine code for one operating system will run on another operating system, unless the first operating system supports running machine code built for the other operating system. An ISA can be extended by adding instructions or other capabilities, or adding support for larger addresses and data values; an implementation of the extended ISA will still be able to execute machine code for versions of the ISA without those extensions. Machine code using those extensions will only run on implementations that support those extensions. The binary compatibility that they provide make ISAs one of the most fundamental abstractions in
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and software. It has sci ...

computing
.


Overview

An instruction set architecture is distinguished from a
microarchitecture In computer engineering Computer engineering (CoE or CpE) is a branch of engineering Engineering is the use of scientific method, scientific principles to design and build machines, structures, and other items, including bridges, ...
, which is the set of
processor design Processor design is a subfield of computer engineering and electronics engineering (fabrication) that deals with creating a processor (computing), processor, a key component of computer hardware. The design process involves choosing an instruction ...
techniques used, in a particular processor, to implement the instruction set. Processors with different microarchitectures can share a common instruction set. For example, the
Intel Intel Corporation is an American multinational corporation A multinational company (MNC) is a corporate A corporation is an organization—usually a group of people or a company A company, abbreviated as co., is a Legal personalit ...

Intel
Pentium Pentium is a brand used for a series of x86 architecture-compatible microprocessors produced by Intel. The Pentium (original), original Pentium was released in 1993. After that, the Pentium II and Pentium III were released. In their form , ...
and the
AMD Advanced Micro Devices, Inc. (AMD) is an American multinational Multinational may refer to: * Multinational corporation, a corporate organization operating in multiple countries * Multinational force, a military body from multiple countries * M ...
Athlon Athlon is the brand name applied to a series of x86-compatible microprocessor A microprocessor is a computer processor where the data processing logic and control is included on a single integrated circuit An integrated circuit o ...

Athlon
implement nearly identical versions of the
x86 instruction set The x86 x86 is a family of instruction set architecture In computer science, an instruction set architecture (ISA), also called computer architecture, is an abstract model of a computer. A device that executes instructions described ...
, but they have radically different internal designs. The concept of an ''architecture'', distinct from the design of a specific machine, was developed by
Fred Brooks Frederick Phillips "Fred" Brooks Jr. (born April 19, 1931) is an American computer architect, software engineer A software engineer is a person who applies the principles of software engineering to the design, development, maintenance, testin ...

Fred Brooks
at IBM during the design phase of
System/360 The IBM System/360 (S/360) is a family of mainframe computer A mainframe computer, informally called a mainframe or big iron, is a computer used primarily by large organizations for critical applications like bulk data processing for t ...
. Some
virtual machine In computing, a virtual machine (VM) is the virtualization/emulator, emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve special ...
s that support
bytecode Bytecode, also termed portable code or p-code, is a form of instruction set In computer science, an instruction set architecture (ISA), also called computer architecture, is an abstract model of a computer. A device that executes instructions ...
as their ISA such as
Smalltalk Smalltalk is an object-oriented programming, object-oriented, dynamically typed reflection (computer science), reflective programming language. Smalltalk was created as the language underpinning the "new world" of computing exemplified by "human ...

Smalltalk
, the Java virtual machine, and
Microsoft Microsoft Corporation is an American multinational corporation, multinational technology company, technology corporation which produces Software, computer software, consumer electronics, personal computers, and related services. Its best-know ...

Microsoft
's
Common Language Runtime The Common Language Runtime (CLR), the virtual machine component of Microsoft .NET Framework, manages the execution of .NET programs. Just-in-time compilation converts the managed code (compiled intermediate language code) into machine instructio ...

Common Language Runtime
, implement this by translating the bytecode for commonly used code paths into native machine code. In addition, these virtual machines execute less frequently used code paths by interpretation (see:
Just-in-time compilation In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and softwar ...
).
Transmeta Transmeta Corporation was an American fabless semiconductor company based in Santa Clara, California Santa Clara () is a city in Santa Clara County, California Santa Clara County, officially the County of Santa Clara, is California's List of ...

Transmeta
implemented the x86 instruction set atop
VLIW Very long instruction word (VLIW) refers to instruction set architectures designed to exploit instruction level parallelism (ILP). Whereas conventional central processing units (CPU, processor) mostly allow programs to specify instructions to exec ...
processors in this fashion.


Classification of ISAs

An ISA may be classified in a number of different ways. A common classification is by architectural ''complexity''. A
complex instruction set computer A complex instruction set computer (CISC ) is a computer in which single instruction set architecture, instructions can execute several low-level operations (such as a load from Memory (computers), memory, an arithmetic operator (programming), ope ...
(CISC) has many specialized instructions, some of which may only be rarely used in practical programs. A
reduced instruction set computer In computer engineering Computer engineering (CoE or CpE) is a branch of engineering that integrates several fields of computer science and electronic engineering required to develop computer hardware and computer software, software. Com ...
(RISC) simplifies the processor by efficiently implementing only the instructions that are frequently used in programs, while the less common operations are implemented as subroutines, having their resulting additional processor execution time offset by infrequent use. Other types include
very long instruction word Very long instruction word (VLIW) refers to instruction set architecture In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical ...
(VLIW) architectures, and the closely related ''long instruction word'' (LIW) and ''
explicitly parallel instruction computing Explicitly parallel instruction computing (EPIC) is a term coined in 1997 by the HP–Intel alliance to describe a computing paradigm that researchers had been investigating since the early 1980s. This paradigm is also called ''Independence'' ar ...
'' (EPIC) architectures. These architectures seek to exploit
instruction-level parallelism Instruction-level parallelism (ILP) is a measure of how many of the instructions in a computer program A computer program is a collection of instructions that can be executed by a computer to perform a specific task. A computer program is ...
with less hardware than RISC and CISC by making the
compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily ...

compiler
responsible for instruction issue and scheduling. Architectures with even less complexity have been studied, such as the minimal instruction set computer (MISC) and one instruction set computer (OISC). These are theoretically important types, but have not been commercialized.


Instructions

Machine language In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, ...
is built up from discrete ''statements'' or ''instructions''. On the processing architecture, a given instruction may specify: *opcode (the instruction to be performed) e.g. add, copy, test *any explicit operands: :: registers ::literal/constant values ::
addressing mode Addressing modes are an aspect of the instruction set architecture In computer science, an instruction set architecture (ISA), also called computer architecture, is an abstract model of a computer. A device that executes instructions described b ...
s used to access memory More complex operations are built up by combining these simple instructions, which are executed sequentially, or as otherwise directed by
control flow In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algor ...
instructions.


Instruction types

Examples of operations common to many instruction sets include:


Data handling and memory operations

*''Set'' a
register A register is an authoritative list of one kind of information. Register or registration may refer to: Arts entertainment, and media Music * Register (music), the relative "height" or range of a note, melody, part, instrument, etc. * ''Regis ...
to a fixed constant value. *''Copy'' data from a memory location or a register to a memory location or a register (a machine instruction is often called ''move''; however, the term is misleading). They are used to store the contents of a register, the contents of another memory location or the result of a computation, or to retrieve stored data to perform a computation on it later. They are often called load and store operations. *''Read'' and ''write'' data from hardware devices.


Arithmetic and logic operations

*''Add'', ''subtract'', ''multiply'', or ''divide'' the values of two registers, placing the result in a register, possibly setting one or more condition codes in a
status register A status register, flag register, or condition code register (CCR) is a collection of status flag A flag is a piece of textile, fabric (most often rectangular or quadrilateral) with a distinctive design and colours. It is used as a symbol, a si ...
. **', ' in some ISAs, saving operand fetch in trivial cases. *Perform
bitwise operation In computer programming, a bitwise operation operates on a bit string, a bit array or a Binary numeral system, binary numeral (considered as a bit string) at the level of its individual bits. It is a fast and simple action, basic to the higher le ...
s, e.g., taking the ''
conjunction Conjunction may refer to: * Conjunction (astronomy), in which two astronomical bodies appear close together in the sky * Conjunction (astrology), astrological aspect in horoscopic astrology * Conjunction (grammar), a part of speech * Logical conjun ...
'' and ''
disjunction In logic, disjunction is a logical connective typically notated \lor whose meaning either refines or corresponds to that of natural language expressions such as "or". In classical logic, it is given a truth functional semantics of logic, sema ...
'' of corresponding bits in a pair of registers, taking the ''
negation In logic Logic is an interdisciplinary field which studies truth and reasoning Reason is the capacity of consciously making sense of things, applying logic Logic (from Ancient Greek, Greek: grc, wikt:λογική, λογική, ...
'' of each bit in a register. *''Compare'' two values in registers (for example, to see if one is less, or if they are equal). *''s'' for arithmetic on floating-point numbers.


Control flow operations

*''
Branch A branch ( or , ) or tree branch (sometimes referred to in botany Botany, also called , plant biology or phytology, is the science of plant life and a branch of biology. A botanist, plant scientist or phytologist is a scientist who spe ...
'' to another location in the program and execute instructions there. *'' Conditionally branch'' to another location if a certain condition holds. *'' Indirectly branch'' to another location. *''
Call Call or Calls may refer to: Arts, entertainment, and media Games * Call, a type of betting in poker * Call, in the game of contract bridge, a bid, pass, double, or redouble in the bidding stage Music and dance * Call (band), from Lahore, Pakis ...
'' another block of code, while saving the location of the next instruction as a point to return to.


Coprocessor instructions

*Load/store data to and from a coprocessor or exchanging with CPU registers. *Perform coprocessor operations.


Complex instructions

Processors may include "complex" instructions in their instruction set. A single "complex" instruction does something that may take many instructions on other computers. Such instructions are typified by instructions that take multiple steps, control multiple functional units, or otherwise appear on a larger scale than the bulk of simple instructions implemented by the given processor. Some examples of "complex" instructions include: *transferring multiple registers to or from memory (especially the stack) at once *moving large blocks of memory (e.g. string copy or DMA transfer) *complicated integer and floating-point arithmetic (e.g.
square root In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities ...

square root
, or
transcendental function In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It h ...
s such as
logarithm In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no ...

logarithm
,
sine In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). ...

sine
,
cosine In mathematics, the trigonometric functions (also called circular functions, angle functions or goniometric functions) are real functions which relate an angle of a right-angled triangle to ratios of two side lengths. They are widely used in al ...

cosine
, etc.) *''s'', a single instruction performing an operation on many homogeneous values in parallel, possibly in dedicated SIMD registers *performing an atomic
test-and-setIn computer science, the test-and-set instruction is an instruction used to write 1 (set) to a memory location and return its old value as a single atomic (computer science), atomic (i.e., non-interruptible) operation. If multiple processes may acces ...
instruction or other read-modify-write atomic instruction *instructions that perform ALU operations with an operand from memory rather than a register Complex instructions are more common in CISC instruction sets than in RISC instruction sets, but RISC instruction sets may include them as well. RISC instruction sets generally do not include ALU operations with memory operands, or instructions to move large blocks of memory, but most RISC instruction sets include
SIMD Single instruction, multiple data (SIMD) is a type of parallel computer, parallel processing in Flynn's taxonomy. SIMD can be internal (part of the hardware design) and it can be directly accessible through an instruction set architecture (IS ...

SIMD
or
vector Vector may refer to: Biology *Vector (epidemiology) In epidemiology Epidemiology is the study and analysis of the distribution (who, when, and where), patterns and risk factor, determinants of health and disease conditions in defined pop ...
instructions that perform the same arithmetic operation on multiple pieces of data at the same time. SIMD instructions have the ability of manipulating large vectors and matrices in minimal time. SIMD instructions allow easy
parallelization Parallel computing is a type of computation Computation is any type of calculation A calculation is a deliberate process that transforms one or more inputs into one or more results. The term is used in a variety of senses, from the very defi ...
of algorithms commonly involved in sound, image, and video processing. Various SIMD implementations have been brought to market under trade names such as
MMX MMX may refer to: * 2010 2010 was designated as: * * * *International Year for the Rapprochement of Cultures Pronunciation There is a debate among experts and the general public on how to pronounce specific years of the 21st century in En ...
,
3DNow!3DNow! is an extension to the x86 x86 is a family of instruction set architectures initially developed by Intel Intel Corporation is an American multinational corporation and technology company headquartered in Santa Clara, Californ ...
, and
AltiVec AltiVec is a single-precision floating point In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development ...
.


Instruction encoding

On traditional architectures, an instruction includes an
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 code, machine language instruction (computer sc ...
that specifies the operation to perform, such as ''add contents of memory to register''—and zero or more
operand In mathematics an operand is the object of a mathematical operation, i.e., it is the object or quantity that is operated on. Example The following arithmetic expression shows an example of operators and operands: :3 + 6 = 9 In the above example, ...
specifiers, which may specify registers, memory locations, or literal data. The operand specifiers may have
addressing mode Addressing modes are an aspect of the instruction set architecture In computer science, an instruction set architecture (ISA), also called computer architecture, is an abstract model of a computer. A device that executes instructions described b ...
s determining their meaning or may be in fixed fields. In
very long instruction word Very long instruction word (VLIW) refers to instruction set architecture In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical ...
(VLIW) architectures, which include many
microcode In processor design Processor design is a subfield of computer engineering and electronics engineering (fabrication) that deals with creating a processor (computing), processor, a key component of computer hardware. The design process involves ch ...
architectures, multiple simultaneous opcodes and operands are specified in a single instruction. Some exotic instruction sets do not have an opcode field, such as
transport triggered architecture In computer architecture In computer engineering, computer architecture is a set of rules and methods that describe the functionality, organization, and implementation of computer A computer is a machine that can be programmed to carry out s ...
s (TTA), only operand(s). The Forth virtual machine and other " 0-operand" instruction sets lack any operand specifier fields, such as some
stack machine In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algori ...
s including NOSC. Conditional instructions often have a predicate field—a few bits that encode the specific condition to cause an operation to be performed rather than not performed. For example, a conditional branch instruction will transfer control if the condition is true, so that execution proceeds to a different part of the program, and not transfer control if the condition is false, so that execution continues sequentially. Some instruction sets also have conditional moves, so that the move will be executed, and the data stored in the target location, if the condition is true, and not executed, and the target location not modified, if the condition is false. Similarly, IBM
z/Architecture z/Architecture, initially and briefly called ESA Modal Extensions (ESAME), is IBM's 64-bit computing, 64-bit Complex instruction set computer, CISC instruction set architecture implemented by its mainframe computers. IBM introduced its first ...
has a conditional store instruction. A few instruction sets include a predicate field in every instruction; this is called
branch predication In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algori ...
.


Number of operands

Instruction sets may be categorized by the maximum number of operands ''explicitly'' specified in instructions. (In the examples that follow, ''a'', ''b'', and ''c'' are (direct or calculated) addresses referring to memory cells, while ''reg1'' and so on refer to machine registers.) C = A+B *0-operand (''zero-address machines''), so called
stack machine In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algori ...
s: All arithmetic operations take place using the top one or two positions on the stack: push a, push b, add, pop c. **C = A+B needs ''four instructions''. For stack machines, the terms "0-operand" and "zero-address" apply to arithmetic instructions, but not to all instructions, as 1-operand push and pop instructions are used to access memory. *1-operand (''one-address machines''), so called
accumulator machine In a computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of operations known as Computer program, programs. These progr ...
s, include early computers and many small
microcontroller A microcontroller (MCU for ''microcontroller unit'') is a small computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of ...

microcontroller
s: most instructions specify a single right operand (that is, constant, a register, or a memory location), with the implicit accumulator as the left operand (and the destination if there is one): load a, add b, store c. **C = A+B needs ''three instructions''. *2-operand — many CISC and RISC machines fall under this category: **CISC — move A to ''C''; then add B to ''C''. ***C = A+B needs ''two instructions''. This effectively 'stores' the result without an explicit ''store'' instruction. **CISC — Often machines ar
limited to one memory operand
per instruction: load a,reg1; add b,reg1; store reg1,c; This requires a load/store pair for any memory movement regardless of whether the add result is an augmentation stored to a different place, as in C = A+B, or the same memory location: A = A+B. ***C = A+B needs ''three instructions''. **RISC — Requiring explicit memory loads, the instructions would be: load a,reg1; load b,reg2; add reg1,reg2; store reg2,c. ***C = A+B needs ''four instructions''. *3-operand, allowing better reuse of data:The evolution of RISC technology at IBM by John Cocke
– IBM Journal of R&D, Volume 44, Numbers 1/2, p.48 (2000)
**CISC — It becomes either a single instruction: add a,b,c ***C = A+B needs ''one instruction''. **CISC — Or, on machines limited to two memory operands per instruction, move a,reg1; add reg1,b,c; ***C = A+B needs ''two instructions''. **RISC — arithmetic instructions use registers only, so explicit 2-operand load/store instructions are needed: load a,reg1; load b,reg2; add reg1+reg2->reg3; store reg3,c; ***C = A+B needs ''four instructions''. ***Unlike 2-operand or 1-operand, this leaves all three values a, b, and c in registers available for further reuse. *more operands—some CISC machines permit a variety of addressing modes that allow more than 3 operands (registers or memory accesses), such as the
VAX VAX is a series of computers featuring a 32-bit 32-bit microcomputers are computers in which 32-bit microprocessor A microprocessor is a computer processor where the data processing logic and control is included on a single integrate ...
"POLY" polynomial evaluation instruction. Due to the large number of bits needed to encode the three registers of a 3-operand instruction, RISC architectures that have 16-bit instructions are invariably 2-operand designs, such as the Atmel AVR, TI MSP430, and some versions of
ARM Thumb ARM (stylised in lowercase as arm, previously an acronym for Advanced RISC Machines and originally Acorn RISC Machine) is a family of reduced instruction set computing (RISC) instruction set, architectures for central processing unit, comp ...
. RISC architectures that have 32-bit instructions are usually 3-operand designs, such as the
ARM In human anatomy, the arm is the part of the upper limb The upper Limb (anatomy), limbs or upper extremities are the forelimbs of an upright posture, upright-postured tetrapod vertebrate, extending from the scapulae and clavicles down to and incl ...
,
AVR32 The AVR32 is a 32-bit 32-bit microcomputer A microcomputer is a small, relatively inexpensive computer with a microprocessor as its central processing unit (CPU). It includes a microprocessor, Computer memory, memory and minimal input/ou ...
, MIPS,
Power ISA The Power ISA is an instruction set architecture In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their ...
, and
SPARC SPARC (Scalable Processor Architecture) is a reduced instruction set computing (RISC) instruction set architecture originally developed by Sun Microsystems. Its design was strongly influenced by the experimental Berkeley RISC system developed i ...

SPARC
architectures. Each instruction specifies some number of operands (registers, memory locations, or immediate values) ''explicitly''. Some instructions give one or both operands implicitly, such as by being stored on top of the or in an implicit register. If some of the operands are given implicitly, fewer operands need be specified in the instruction. When a "destination operand" explicitly specifies the destination, an additional operand must be supplied. Consequently, the number of operands encoded in an instruction may differ from the mathematically necessary number of arguments for a logical or arithmetic operation (the
arity Arity () is the number of arguments In logic Logic (from Ancient Greek, Greek: grc, wikt:λογική, λογική, label=none, lit=possessed of reason, intellectual, dialectical, argumentative, translit=logikḗ)Also related to (''logo ...
). Operands are either encoded in the "opcode" representation of the instruction, or else are given as values or addresses following the opcode.


Register pressure

''Register pressure'' measures the availability of free registers at any point in time during the program execution. Register pressure is high when a large number of the available registers are in use; thus, the higher the register pressure, the more often the register contents must be spilled into memory. Increasing the number of registers in an architecture decreases register pressure but increases the cost. While embedded instruction sets such as
Thumb The thumb is the first digit of the hand, next to the index finger. When a person is standing in the medical anatomical position (where the palm is facing to the front), the thumb is the outermost digit. The Medical Latin English noun for thumb ...
suffer from extremely high register pressure because they have small register sets, general-purpose RISC ISAs like MIPS and
Alpha Alpha (uppercase , lowercase ; grc, ἄλφα, ''álpha'', modern pronunciation ''álfa'') is the first letter Letter, letters, or literature may refer to: Characters typeface * Letter (alphabet) A letter is a segmental symbol A s ...
enjoy low register pressure. CISC ISAs like x86-64 offer low register pressure despite having smaller register sets. This is due to the many addressing modes and optimizations (such as sub-register addressing, memory operands in ALU instructions, absolute addressing, PC-relative addressing, and register-to-register spills) that CISC ISAs offer.


Instruction length

The size or length of an instruction varies widely, from as little as four bits in some
microcontroller A microcontroller (MCU for ''microcontroller unit'') is a small computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of ...

microcontroller
s to many hundreds of bits in some
VLIW Very long instruction word (VLIW) refers to instruction set architectures designed to exploit instruction level parallelism (ILP). Whereas conventional central processing units (CPU, processor) mostly allow programs to specify instructions to exec ...
systems. Processors used in
personal computer A personal computer (PC) is a multi-purpose computer whose size, capabilities, and price make it feasible for individual use. Personal computers are intended to be operated directly by an end user, rather than by a computer expert or technician ...
s,
mainframe A pair of IBM mainframes. On the left is the IBM z Systems z13. On the right is the IBM LinuxONE Rockhopper.">IBM_LinuxONE.html" ;"title="IBM z Systems z13. On the right is the IBM LinuxONE">IBM z Systems z13. On the right is the IBM LinuxONE R ...
s, and
supercomputer upright=1.5, Computing power of the top 1 supercomputer each year, measured in FLOPS A supercomputer is a computer with a high level of performance as compared to a general-purpose computer. The performance of a supercomputer is commonly mea ...

supercomputer
s have instruction sizes between 8 and 64 bits. The longest possible instruction on x86 is 15 bytes (120 bits). Within an instruction set, different instructions may have different lengths. In some architectures, notably most
reduced instruction set computer In computer engineering Computer engineering (CoE or CpE) is a branch of engineering that integrates several fields of computer science and electronic engineering required to develop computer hardware and computer software, software. Com ...
s (RISC), , typically corresponding with that architecture's
word size In computing, a word is the natural unit of data used by a particular Central processing unit, processor design. A word is a fixed-sized Data (computing), piece of data handled as a unit by the instruction set or the hardware of the processor. The ...
. In other architectures, instructions have variable length, typically integral multiples of a
byte The byte is a unit of digital information that most commonly consists of eight bit The bit is a basic unit of information in computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It ...
or a halfword. Some, such as the
ARM In human anatomy, the arm is the part of the upper limb The upper Limb (anatomy), limbs or upper extremities are the forelimbs of an upright posture, upright-postured tetrapod vertebrate, extending from the scapulae and clavicles down to and incl ...
with ''Thumb-extension'' have ''mixed'' variable encoding, that is two fixed, usually 32-bit and 16-bit encodings, where instructions cannot be mixed freely but must be switched between on a branch (or exception boundary in ARMv8). A RISC instruction set normally has a fixed instruction length (often 4 bytes = 32 bits), whereas a typical CISC instruction set may have instructions of widely varying length (1 to 15 bytes for x86). Fixed-length instructions are less complicated to handle than variable-length instructions for several reasons (not having to check whether an instruction straddles a cache line or virtual memory page boundary, for instance), and are therefore somewhat easier to optimize for speed.


Code density

In early 1960s computers, main memory was expensive and very limited, even on mainframes. Minimizing the size of a program to make sure it would fit in the limited memory was often central. Thus the combined size of all the instructions needed to perform a particular task, the ''code density'', was an important characteristic of any instruction set. It remained important on the initially-tiny memories of minicomputers and then microprocessors. Density remains important today, for smartphone applications, applications downloaded into browsers over slow Internet connections, and in ROMs for embedded applications. A more general advantage of increased density is improved effectiveness of caches and instruction prefetch. Computers with high code density often have complex instructions for procedure entry, parameterized returns, loops, etc. (therefore retroactively named ''Complex Instruction Set Computers'',
CISC CISC may refer to: *Caribbean Island Swimming Championships *Chongqing Iron and Steel Company * Clean intermittent self-catheterisation, a form of urinary catheterization *Complex instruction set computer *Criminal Intelligence Service Canada *Cana ...
). However, more typical, or frequent, "CISC" instructions merely combine a basic ALU operation, such as "add", with the access of one or more operands in memory (using
addressing mode Addressing modes are an aspect of the instruction set architecture In computer science, an instruction set architecture (ISA), also called computer architecture, is an abstract model of a computer. A device that executes instructions described b ...
s such as direct, indirect, indexed, etc.). Certain architectures may allow two or three operands (including the result) directly in memory or may be able to perform functions such as automatic pointer increment, etc. Software-implemented instruction sets may have even more complex and powerful instructions. ''Reduced instruction-set computers'',
RISC In computer engineering Computer engineering (CoE or CpE) is a branch of engineering Engineering is the use of scientific principles to design and build machines, structures, and other items, including bridges, tunnels, roads, v ...
, were first widely implemented during a period of rapidly growing memory subsystems. They sacrifice code density to simplify implementation circuitry, and try to increase performance via higher clock frequencies and more registers. A single RISC instruction typically performs only a single operation, such as an "add" of registers or a "load" from a memory location into a register. A RISC instruction set normally has a fixed instruction length, whereas a typical CISC instruction set has instructions of widely varying length. However, as RISC computers normally require more and often longer instructions to implement a given task, they inherently make less optimal use of bus bandwidth and cache memories. Certain embedded RISC ISAs like
Thumb The thumb is the first digit of the hand, next to the index finger. When a person is standing in the medical anatomical position (where the palm is facing to the front), the thumb is the outermost digit. The Medical Latin English noun for thumb ...

Thumb
and
AVR32 The AVR32 is a 32-bit 32-bit microcomputer A microcomputer is a small, relatively inexpensive computer with a microprocessor as its central processing unit (CPU). It includes a microprocessor, Computer memory, memory and minimal input/ou ...
typically exhibit very high density owing to a technique called code compression. This technique packs two 16-bit instructions into one 32-bit word, which is then unpacked at the decode stage and executed as two instructions. Minimal instruction set computers (MISC) are a form of
stack machine In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algori ...
, where there are few separate instructions (16-64), so that multiple instructions can be fit into a single machine word. These types of cores often take little silicon to implement, so they can be easily realized in an
FPGA A field-programmable gate array (FPGA) is an integrated circuit An integrated circuit or monolithic integrated circuit (also referred to as an IC, a chip, or a microchip) is a set of electronic circuit 200px, A circuit built on a pr ...
or in a
multi-core A multi-core processor is a computer processor on a single integrated circuit An integrated circuit or monolithic integrated circuit (also referred to as an IC, a chip, or a microchip) is a set of electronic circuit 200px, A circuit ...
form. The code density of MISC is similar to the code density of RISC; the increased instruction density is offset by requiring more of the primitive instructions to do a task. There has been research into
executable compression Executable compression is any means of compressing an executable In computing, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, causes a computer "to perform indicated tas ...
as a mechanism for improving code density. The mathematics of
Kolmogorov complexity Image:Mandelpart2 red.png, upright=1.4, This image illustrates part of the Mandelbrot set fractal. Simply storing the 24-bit color of each pixel in this image would require 1.61 million bytes, but a small computer program can reproduce these 1.61 mi ...
describes the challenges and limits of this.


Representation

The instructions constituting a program are rarely specified using their internal, numeric form (
machine code In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, ge ...
); they may be specified by programmers using an
assembly language In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, gene ...
or, more commonly, may be generated from
high-level programming language In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of , , ...
s by
compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily ...

compiler
s.


Design

The design of instruction sets is a complex issue. There were two stages in history for the microprocessor. The first was the CISC (Complex Instruction Set Computer), which had many different instructions. In the 1970s, however, places like IBM did research and found that many instructions in the set could be eliminated. The result was the RISC (Reduced Instruction Set Computer), an architecture that uses a smaller set of instructions. A simpler instruction set may offer the potential for higher speeds, reduced processor size, and reduced power consumption. However, a more complex set may optimize common operations, improve memory and
cache Cache, caching, or caché may refer to: Places * Cache (Aosta) Cache is a frazione of the city of Aosta, in the Aosta Valley region of Italy. Frazioni of Aosta Valley Aosta {{Aosta-geo-stub ..., a frazione in Italy * Cache Creek (disambig ...
efficiency, or simplify programming. Some instruction set designers reserve one or more opcodes for some kind of
system call In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and so ...
or
software interrupt In digital computer A computer is a machine A machine is a man-made device that uses power to apply forces and control movement to perform an action. Machines can be driven by animals and people A people is a plurality of per ...
. For example,
MOS Technology 6502 The MOS Technology 6502 (typically pronounced "sixty-five-oh-two" or "six-five-oh-two") William Mensch and the moderator both pronounce the 6502 microprocessor as ''"sixty-five-oh-two"''. is an 8-bit In computer architecture In computer ...
uses 00H,
Zilog Z80 The Z80 is an 8-bit In computer architecture In computer engineering, computer architecture is a set of rules and methods that describe the functionality, organization, and implementation of computer systems. Some definitions of archite ...

Zilog Z80
uses the eight codes C7,CF,D7,DF,E7,EF,F7,FFH while
Motorola 68000 The Motorola 68000 (sometimes shortened to Motorola 68k or m68k and usually pronounced "sixty-eight-thousand") is a 16/32-bit complex instruction set computer A complex instruction set computer (CISC ) is a computer in which single instructi ...
use codes in the range A000..AFFFH. Fast virtual machines are much easier to implement if an instruction set meets the
Popek and Goldberg virtualization requirements #REDIRECT Popek and Goldberg virtualization requirements#REDIRECT Popek and Goldberg virtualization requirementsThe Popek and Goldberg virtualization requirements are a set of conditions sufficient for a computer architecture to support system virt ...
. The
NOP slide In computer security, a NOP slide, NOP sled or NOP ramp is a sequence of NOP (code), NOP (no-operation) instructions meant to "slide" the CPU's instruction execution flow to its final, desired destination whenever the program branch instruction, bra ...
used in
immunity-aware programming When writing firmware In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardwar ...
is much easier to implement if the "unprogrammed" state of the memory is interpreted as a NOP (code), NOP. On systems with multiple processors, non-blocking synchronization algorithms are much easier to implement if the instruction set includes support for something such as "fetch-and-add", "load-link/store-conditional" (LL/SC), or "atomic compare-and-swap".


Instruction set implementation

Any given instruction set can be implemented in a variety of ways. All ways of implementing a particular instruction set provide the same programming model, and all implementations of that instruction set are able to run the same executables. The various ways of implementing an instruction set give different tradeoffs between cost, performance, power consumption, size, etc. When designing the
microarchitecture In computer engineering Computer engineering (CoE or CpE) is a branch of engineering Engineering is the use of scientific method, scientific principles to design and build machines, structures, and other items, including bridges, ...
of a processor, engineers use blocks of "hard-wired" electronic circuitry (often designed separately) such as adders, multiplexers, counters, registers, ALUs, etc. Some kind of register transfer language is then often used to describe the decoding and sequencing of each instruction of an ISA using this physical microarchitecture. There are two basic ways to build a control unit to implement this description (although many designs use middle ways or compromises): # Some computer designs "hardwire" the complete instruction set decoding and sequencing (just like the rest of the microarchitecture). # Other designs employ
microcode In processor design Processor design is a subfield of computer engineering and electronics engineering (fabrication) that deals with creating a processor (computing), processor, a key component of computer hardware. The design process involves ch ...
routines or tables (or both) to do this—typically as on-chip read-only memory, ROMs or programmable logic array, PLAs or both (although separate RAMs and read-only memory#Historical examples, ROMs have been used historically). The Western Digital MCP-1600 is an older example, using a dedicated, separate ROM for microcode. Some designs use a combination of hardwired design and microcode for the control unit. Some CPU designs use a writable control store—they compile the instruction set to a writable RAM or flash memory, flash inside the CPU (such as the Rekursiv processor and the Imsys Cjip), or an FPGA (reconfigurable computing). An ISA can also be emulator, emulated in software by an interpreter (computing), interpreter. Naturally, due to the interpretation overhead, this is slower than directly running programs on the emulated hardware, unless the hardware running the emulator is an order of magnitude faster. Today, it is common practice for vendors of new ISAs or microarchitectures to make software emulators available to software developers before the hardware implementation is ready. Often the details of the implementation have a strong influence on the particular instructions selected for the instruction set. For example, many implementations of the instruction pipeline only allow a single memory load or memory store per instruction, leading to a load–store architecture (RISC). For another example, some early ways of implementing the instruction pipeline led to a delay slot. The demands of high-speed digital signal processing have pushed in the opposite direction—forcing instructions to be implemented in a particular way. For example, to perform digital filters fast enough, the MAC instruction in a typical digital signal processor (DSP) must use a kind of Harvard architecture that can fetch an instruction and two data words simultaneously, and it requires a single-cycle multiply–accumulate binary multiplier, multiplier.


See also

*Comparison of instruction set architectures *Computer architecture *CPU design *Compressed instruction set *Emulator *Simulator *List of instruction sets *Instruction set simulator *OVPsim full systems simulator providing ability to create/model/emulate any instruction set using C and standard APIs *Register transfer language (RTL) *Micro-operation


References


Further reading

*


External links

*
Programming Textfiles: Bowen's Instruction Summary Cards
{{Authority control Central processing unit Instruction processing, Set architectures Instruction set architectures, Microprocessors, *Instruction set