HOME

TheInfoList



OR:

MMIX (pronounced ''em-mix'') is a
64-bit In computer architecture, 64-bit Integer (computer science), integers, memory addresses, or other Data (computing), data units are those that are 64 bits wide. Also, 64-bit central processing unit, CPUs and arithmetic logic unit, ALUs are those ...
reduced instruction set computing 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 comput ...
(RISC)
architecture Architecture is the art and technique of designing and building, as distinguished from the skills associated with construction. It is both the process and the product of sketching, conceiving, planning, designing, and constructing building ...
designed by
Donald Knuth Donald Ervin Knuth ( ; born January 10, 1938) is an American computer scientist, mathematician, and professor emeritus at Stanford University. He is the 1974 recipient of the ACM Turing Award, informally considered the Nobel Prize of computer sc ...
, with significant contributions by
John L. Hennessy John Leroy Hennessy (born September 22, 1952) is an American computer scientist, academician and businessman who serves as Chairman of Alphabet Inc. Hennessy is one of the founders of MIPS Computer Systems Inc. as well as Atheros and served as t ...
(who contributed to the design of the
MIPS architecture MIPS (Microprocessor without Interlocked Pipelined Stages) is a family of reduced instruction set computer (RISC) instruction set architectures (ISA)Price, Charles (September 1995). ''MIPS IV Instruction Set'' (Revision 3.2), MIPS Technologies, ...
) and Richard L. Sites (who was an architect of the
Alpha Alpha (uppercase , lowercase ; grc, ἄλφα, ''álpha'', or ell, άλφα, álfa) is the first letter of the Greek alphabet. In the system of Greek numerals, it has a value of one. Alpha is derived from the Phoenician letter aleph , whic ...
architecture). Knuth has said that,
MMIX is a computer intended to illustrate machine-level aspects of programming. In my books ''
The Art of Computer Programming ''The Art of Computer Programming'' (''TAOCP'') is a comprehensive monograph written by the computer scientist Donald Knuth presenting programming algorithms and their analysis. Volumes 1–5 are intended to represent the central core of compu ...
'', it replaces MIX, the 1960s-style machine that formerly played such a role… I strove to design MMIX so that its machine language would be simple, elegant, and easy to learn. At the same time I was careful to include all of the complexities needed to achieve high performance in practice, so that MMIX could in principle be built and even perhaps be competitive with some of the fastest general-purpose computers in the marketplace."(Errata)
/ref>
Knuth started the design of MMIX in 1999, and released the stable version of the design in 2011. The processor is numbered as "2009" with Knuth explaining that this is the
arithmetic mean In mathematics and statistics, the arithmetic mean ( ) or arithmetic average, or just the ''mean'' or the ''average'' (when the context is clear), is the sum of a collection of numbers divided by the count of numbers in the collection. The colle ...
from the numbers of other computer architectures; as well as being "MMIX" in
Roman numerals Roman numerals are a numeral system that originated in ancient Rome and remained the usual way of writing numbers throughout Europe well into the Late Middle Ages. Numbers are written with combinations of letters from the Latin alphabet, eac ...
.


Architecture

MMIX is a
big-endian In computing, endianness, also known as byte sex, is the order or sequence of bytes of a word of digital data in computer memory. Endianness is primarily expressed as big-endian (BE) or little-endian (LE). A big-endian system stores the most sig ...
64-bit
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 comput ...
(RISC), with 256 64-bit general-purpose registers, 32 64-bit special-purpose registers, fixed-length 32-bit instructions and a 64-bit
virtual address space In computing, a virtual address space (VAS) or address space is the set of ranges of virtual addresses that an operating system makes available to a process. The range of virtual addresses usually starts at a low address and can extend to the hig ...
. The MMIX instruction set comprises 256 opcodes, one of which is reserved for future expansion. MMIX uses
IEEE 754 The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a technical standard for floating-point arithmetic established in 1985 by the Institute of Electrical and Electronics Engineers (IEEE). The standard addressed many problems found i ...
floating-point numbers.


Instructions

All instructions have an associated mnemonic. For example, instruction #20 (32 decimal) is associated with ADD. Most instructions have the symbolic form , where specifies the sort of instruction, X specifies the register used to store the result of the instruction and the rest specify the operands of the instruction. Each of these fields is eight bits wide. For example, means "Set $0 to the sum of $1 and 3." Most instructions can take either immediate values or register contents; thus a single instruction mnemonic may correspond to one of two opcodes. MMIX programs are typically constructed using the MMIXAL assembly language. The below is a simple MMIXAL program, which prints the string " Hello, world!": LOC #100 % Set the address of the program % initially to 0x100. Main GETA $255,string % Put the address of the string % into register 255. TRAP 0,Fputs,StdOut % Write the string pointed to by % register 255 to the standard % output file. TRAP 0,Halt,0 % End process. string BYTE "Hello, world!",#a,0 % String to be printed. #a is % newline, 0 terminates the % string.


Registers

There are 256 directly addressable general-purpose architectural registers in an MMIX chip, designated by $0 through $255, and 32 special-purpose architectural registers. The special-purpose registers can be accessed with the GET and PUT instructions. Two of the special registers, rL and rG, determine which of the general registers are local and which are global. All registers from $0... are local registers, and represent a
window A window is an opening in a wall, door, roof, or vehicle that allows the exchange of light and may also allow the passage of sound and sometimes air. Modern windows are usually glazed or covered in some other transparent or translucent materia ...
into an internal stack of registers. Registers from L.. are "marginal registers", they always return 0 if they are used as a source in an operation. Using a marginal register as the destination of an operation will cause the machine to automatically increase rL to include that register. All registers G.. $255 are called global registers, and are not part of the register stack.


Local register stack

The local register stack provides each subroutine with its own rL local registers, designated by $0 through . Whenever a subroutine is called, a number of local registers are pushed down the stack (by shifting the start of the window). The arguments of the called subroutine are left in the remaining local registers. When a subroutine finishes it pops the previously pushed registers. Because the internal stack can contain only a finite number of registers, it may be necessary to store a part of the stack in memory. This is implemented with the special registers rO and rS which record which part of the local register stack is in memory and which part is still in local physical registers. The register stack provides for fast subroutine linkage.


Special registers

The 32 special physical architectural registers are as follows: #
  • rB, the bootstrap register (trip)
  • #: When tripping, rB ← $255 and $255 ← rJ. Thus saving rJ in a general register. # rD, the dividend register #: Unsigned integer divide uses this as the left half of the 128-bit input that is to be divided by the other operand. # rE, the epsilon register #: Used for floating comparisons with respect to epsilon. # rH, the himult register #: Used to store the left half of the 128-bit result of unsigned integer multiplication. # rJ, the return-jump register #: Used to save the address of the next instruction by PUSHes and by POP to return from a PUSH. # rM, the multiplex mask register #: Used by the multiplex instruction. # rR, the remainder register #:Is set to the remainder of integer division. # rBB, the bootstrap register (trap) #: When trapping, rBB ← $255 and $255 ← rJ. Thus saving rJ in a general register # rC, the cycle counter #: Incremented every cycle. # rN, the serial number #: A constant identifying this particular MMIX processor. # rO, the register stack offset #: Used to implement the register stack. # rS, the register stack pointer #: Used to implement the register stack. # rI, the interval counter #: Decremented every cycle. Causes an interrupt when zero. # rT, the trap address register #: Used to store the address of the trip vector. # rTT, the dynamic trap address register #: Used to store the address of the trap vector. # rK, the interrupt mask register #: Used to enable and disable specific interrupts. # rQ, the interrupt request register #: Used to record interrupts as they occur. # rU, the usage counter #: Used to keep a count of executed instructions. # rV, the virtual translation register #: Used to translate virtual addresses to physical addresses. Contains the size and number of segments, the root location of the page table and the address space number. # rG, the global threshold register #: All general registers references with a number greater or equal to rG refer to global registers. # rL, the local threshold register #: All general registers references with a number smaller than rL refer to local registers. # rA, the arithmetic status register #: Used to record, enable and disable arithmetic exception like overflow and divide by zero. # rF, the failure location register #: Used to store the address of the instruction that caused a failure. # rP, the prediction register #: Used by conditional swap (CSWAP). # rW, the where-interrupted register (trip) #: Used, when tripping, to store the address of the instruction after the one that was interrupted. # rX, the execution register (trip) #: Used, when tripping, to store the instruction that was interrupted. # rY, the Y operand (trip) #: Used, when tripping, to store the Y operand of the interrupted instruction. # rZ, the Z operand (trip) #: Used, when tripping, to store the Z operand of the interrupted instruction. # rWW, the where-interrupted register (trap) #: Used, when trapping, to store the address of the instruction after the one that was interrupted. # rXX, the execution register (trap) #: Used, when trapping, to store the instruction that was interrupted. # rYY, the Y operand (trap) #: Used, when trapping, to store the Y operand of the interrupted instruction. # rZZ, the Z operand (trap) #: Used, when trapping, to store the Z operand of the interrupted instruction. Like programs running on almost all other CPUs, MMIX programs can be
    interrupt In digital computers, an interrupt (sometimes referred to as a trap) is a request for the processor to ''interrupt'' currently executing code (when permitted), so that the event can be processed in a timely manner. If the request is accepted, ...
    ed in several ways. External hardware, such as timers, are a common source of preemption interrupts. Many instructions cause an interrupt in certain exceptional cases; such as the
    memory protection Memory protection is a way to control memory access rights on a computer, and is a part of most modern instruction set architectures and operating systems. The main purpose of memory protection is to prevent a process from accessing memory that ha ...
    page fault In computing, a page fault (sometimes called PF or hard fault) is an exception that the memory management unit (MMU) raises when a process accesses a memory page without proper preparations. Accessing the page requires a mapping to be added to t ...
    exceptions used to implement virtual memory, and floating point
    exception handling In computing and computer programming, exception handling is the process of responding to the occurrence of ''exceptions'' – anomalous or exceptional conditions requiring special processing – during the execution of a program. In general, an ...
    . MMIX has 2 kinds of interrupts: "trips" and "traps". The main difference between "trips" and "traps" is that traps send control to a "trap handler" program in the operating system (trapping), but trips send control to a "trip handler" program in the user application (tripping). Users can also force any interrupt handler to run with explicit
    software interrupt In digital computers, an interrupt (sometimes referred to as a trap) is a request for the processor to ''interrupt'' currently executing code (when permitted), so that the event can be processed in a timely manner. If the request is accepted, ...
    instructions TRIP and TRAP, similar to some kinds of
    trap A trap is a mechanical device used to capture or restrain an animal for purposes such as hunting, pest control, or ecological research. Trap or TRAP may also refer to: Art and entertainment Films and television * ''Trap'' (2015 film), Fil ...
    in other computer systems. In particular, a
    system call In computing, a system call (commonly abbreviated to syscall) is the programmatic way in which a computer program requests a service from the operating system on which it is executed. This may include hardware-related services (for example, acc ...
    from a user program to the operating system uses a TRAP instruction.


    Hardware implementations

    , no known hardware implementations of the MMIX instruction set architecture exist. However, the fpgammix project implements MMIX in
    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 ...
    , making it possible to implement using a
    field-programmable gate array 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 ...
    .


    Software tools

    The MMIX instruction set architecture is supported by a number of software tools for computer architecture research and software development.


    Simulators and assembler

    * MMIXware – Donald Knuth's MMIX-SIM simple (behavioral) simulator, MMIXAL assembler, test suite, sample programs, full documentation, and MMIX architectural (pipeline) simulator (
    gzip gzip is a file format and a software application used for file compression and decompression. The program was created by Jean-loup Gailly and Mark Adler as a free software replacement for the compress program used in early Unix systems, and in ...
    ped
    tar Tar is a dark brown or black viscous liquid of hydrocarbons and free carbon, obtained from a wide variety of organic materials through destructive distillation. Tar can be produced from coal, wood, petroleum, or peat. "a dark brown or black bit ...
    file). * MMIXX – An
    X11 The X Window System (X11, or simply X) is a windowing system for bitmap displays, common on Unix-like operating systems. X provides the basic framework for a GUI environment: drawing and moving windows on the display device and interacting wi ...
    -based graphics package contributed by Andrew Pochinsky of
    MIT The Massachusetts Institute of Technology (MIT) is a private land-grant research university in Cambridge, Massachusetts. Established in 1861, MIT has played a key role in the development of modern technology and science, and is one of the m ...
    ’s Center for Theoretical Physics which, when combined with the MMIXware sources above, augments the MMIX virtual machine with a 640×480 pixel, true-color ‘virtual display’ (for UNIX/Linux).


    Compiler

    The
    GNU Compiler Collection The GNU Compiler Collection (GCC) is an optimizing compiler produced by the GNU Project supporting various programming languages, hardware architectures and operating systems. The Free Software Foundation (FSF) distributes GCC as free software ...
    includes an MMIX back-end for its C/
    C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
    compilers, contributed by Hans-Peter Nilsson and part of the main GCC distribution since late 2001. , the MMIX back-end to GCC continues to be actively developed and maintained by volunteers. * Installation instructions for GCC + MMIX tools by Hans-Peter Nilsson. * §3.17.26. MMIX Options for
    GNU GNU () is an extensive collection of free software (383 packages as of January 2022), which can be used as an operating system or can be used in parts with other operating systems. The use of the completed GNU tools led to the family of operat ...
    GCC version 7.2.0 (GNU GCC Web site). * §9.28. MMIX-dependent Features for
    GNU GNU () is an extensive collection of free software (383 packages as of January 2022), which can be used as an operating system or can be used in parts with other operating systems. The use of the completed GNU tools led to the family of operat ...
    as from
    GNU Binutils The GNU Binary Utilities, or , are a set of programming tools for creating and managing binary programs, object files, libraries, profile data, and assembly source code. Tools They were originally written by programmers at Cygnus Solutions. ...
    version 2.29, the assembler back-end for GNU GCC (GNU Binutils Web site). The above tools could theoretically be used to compile, build, and bootstrap an entire
    FreeBSD FreeBSD is a free and open-source Unix-like operating system descended from the Berkeley Software Distribution (BSD), which was based on Research Unix. The first version of FreeBSD was released in 1993. In 2005, FreeBSD was the most popular ...
    ,
    Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which ...
    , or other similar operating system kernel onto MMIX hardware, were such hardware to exist.


    See also

    *
    Educational programming language An educational programming language is a programming language that is designed mostly as an instrument for learning, and less as a tool for writing programs to perform work. Types of educational programming languages Assembly languages Origi ...
    * DLX * LC-3 * Little man computer * MikroSim * MIX *
    NAR 2 NAR 2 ( Serbian Nastavni Računar 2, en. ''Educational Computer'' 2) is a theoretical model of a 32-bit word computer created by Faculty of Mathematics of University of Belgrade professor Nedeljko Parezanović as an enhancement to its predecessor ...
    , another processor designed by a professor to help students learn


    References

    * Donald E. Knuth (2005). ''The Art of Computer Programming Volume 1 Fascicle 1: MMIX A RISC Computer for the New Millennium''. Addison-Wesley.
    (errata)
    * Martin Ruckert (2015). ''MMIX Supplement, The: Supplement to The Art of Computer Programming Volumes 1, 2, 3 by Donald E. Knuth''. Addison-Wesley.


    External links


    MMIX Home Page
    — A brief introduction to MMIX, and Knuth's reasons for using a hypothetical
    assembly language In computer programming, assembly language (or assembler language, or symbolic machine code), often referred to simply as Assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence be ...
    in TAoCP.
    Donald Knuth's MMIX news page
    — An
    open source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
    simulator written in
    CWEB Web is a computer programming system created by Donald E. Knuth as the first implementation of what he called "literate programming": the idea that one could create software as works of literature, by embedding source code inside descriptive t ...
    , a programmer's manual, and example programs.
    MMIXmasters web site
    — A web site for the volunteers (MMIXmasters) who are converting all of the programs in TAOCP, Volumes 1–3, from the old MIX to the new MMIX.

    — VMMMIX is the MMIX virtual machine. It has console, HDD and Ethernet I/Os. Currently, this virtual machine runs on Windows only. And Linux runs on this MMIX virtual machine.
    The VMB Homepage
    — The Virtual Motherboard Project offers a plug and play collection of devices that can be used with an appropriate version of the MMIX CPU. {{DEFAULTSORT:Mmix Donald Knuth Educational abstract machines Instruction set architectures 2011 establishments