MIX is a hypothetical computer used in
Donald Knuth's monograph, ''
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 ...
'' (''TAOCP''). MIX's model number is 1009, which was derived by combining the model numbers and names of several contemporaneous, commercial machines deemed significant by the author. Also, "MIX" read as a Roman numeral is 1009.
The 1960s-era MIX has since been superseded by a new (also hypothetical) computer architecture,
MMIX
MMIX (pronounced ''em-mix'') is a 64-bit reduced instruction set computing (RISC) architecture designed by Donald Knuth, with significant contributions by John L. Hennessy (who contributed to the design of the MIPS architecture) and Richard L. S ...
, to be incorporated in forthcoming editions of ''TAOCP''.
Software implementations for both the MIX and MMIX architectures have been developed by Knuth and made freely available (named "MIXware" and "MMIXware", respectively). Several derivatives of Knuth's MIX/MMIX emulators also exist.
GNU MDK
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 ...
is one such software package; it is
free
Free may refer to:
Concept
* Freedom, having the ability to do something, without having to obey anyone/anything
* Freethought, a position that beliefs should be formed only on the basis of logic, reason, and empiricism
* Emancipate, to procur ...
and runs on a wide variety of platforms.
Their purpose for education is quite similar to
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 ...
's and
David A. Patterson's
DLX
The DLX (pronounced "Deluxe") is a RISC processor architecture designed by John L. Hennessy and David A. Patterson, the principal designers of the Stanford MIPS and the Berkeley RISC designs (respectively), the two benchmark examples of RISC desi ...
architecture, from ''Computer Organization and Design - The Hardware Software Interface''.
Architecture
MIX is a hybrid
binary
Binary may refer to:
Science and technology Mathematics
* Binary number, a representation of numbers using only two digits (0 and 1)
* Binary function, a function that takes two arguments
* Binary operation, a mathematical operation that t ...
–
decimal
The decimal numeral system (also called the base-ten positional numeral system and denary or decanary) is the standard system for denoting integer and non-integer numbers. It is the extension to non-integer numbers of the Hindu–Arabic numeral ...
computer. When programmed in binary, each byte has 6 bits (values range from 0 to 63). In decimal, each byte has 2 decimal digits (values range from 0 to 99). Bytes are grouped into words of five bytes plus a sign. Most programs written for MIX will work in either binary or decimal, so long as they do not try to store a value greater than 63 in a single byte.
A word has the range −1,073,741,823 to 1,073,741,823 (inclusive) in binary mode, and −9,999,999,999 to 9,999,999,999 (inclusive) in decimal mode. The
sign-and-magnitude
In computing, signed number representations are required to encode negative numbers in binary number systems.
In mathematics, negative numbers in any base are represented by prefixing them with a minus sign ("−"). However, in RAM or CPU regist ...
representation of integers in the MIX architecture distinguishes between “−0” and “+0.” This contrasts with modern computers, whose
two's-complement
Two's complement is a mathematical operation to reversibly convert a positive binary number into a negative binary number with equivalent (but negative) value, using the binary digit with the greatest place value (the leftmost bit in big- endian ...
representation of integer quantities includes a single representation for zero, but whose range for a given number of bits includes one more negative integer than the number of representable positive integers.
Registers
There are 9
registers in MIX:
* rA:
Accumulator (full word, five bytes and a sign).
* rX: Extension (full word, five bytes and a sign).
* rI1, rI2, rI3, rI4, rI5, rI6:
Index registers (two bytes and a sign).
* rJ: Jump address (two bytes, always positive).
A byte is assumed to be at least 6 bits. Most instructions can specify ''which'' of the "fields" (bytes) of a register are to be altered, using a suffix of the form ''(first:last)''. The zeroth field is the one-bit sign.
MIX also records whether the previous operation overflowed, and has a one-
trit comparison indicator (less than, equal to, or greater than).
Memory and input/output
The MIX machine has 4000 words of memory (each with 5 bytes and a sign), addressed from 0 to 3999. A variety of input and output devices are also included:
*Tape units (devices 0...7).
*Disk or drum units (devices 8...15).
*Card reader (device 16).
*Card punch (device 17).
*Line printer (device 18).
*Typewriter terminal (device 19).
*Paper tape (device 20).
Instructions
Each machine instruction in memory occupies one word, and consists of 4 parts: the address (2 bytes and the sign of the word) in memory to read or write; an index specification (1 byte, describing which rI index register to use) to add to the address; a modification (1 byte) that specifies which parts of the register or memory location will be read or altered; and the operation code (1 byte). All operation codes have an associated mnemonic.
MIX programs frequently use self-modifying code, in particular to return from a subroutine, as MIX lacks an automatic subroutine return stack.
Self-modifying code is facilitated by the modification byte, allowing the program to store data to, for example, the address part of the target instruction, leaving the rest of the instruction unmodified.
MIX programs are typically constructed using the MIXAL assembly language; for an example, see the
list hello world programs page.
Implementations
MIX has been implemented in software by:
* Knuth's ''MIXWare'' and the derived
GNU MDK
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 ...
;
*
9front's mix(1); and
* Hardware::Simulator::MIX on
CPAN
The Comprehensive Perl Archive Network (CPAN) is a repository of over 250,000 software modules and accompanying documentation for 39,000 distributions, written in the Perl programming language by over 12,000 contributors. ''CPAN'' can denote eith ...
.
An implementation of MIX was created for the iCE40HX8K
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 de ...
board in 2021.
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
Origin ...
*
DLX
The DLX (pronounced "Deluxe") is a RISC processor architecture designed by John L. Hennessy and David A. Patterson, the principal designers of the Stanford MIPS and the Berkeley RISC designs (respectively), the two benchmark examples of RISC desi ...
*
LC-3
*
Little man computer
*
MMIX
MMIX (pronounced ''em-mix'') is a 64-bit reduced instruction set computing (RISC) architecture designed by Donald Knuth, with significant contributions by John L. Hennessy (who contributed to the design of the MIPS architecture) and Richard L. S ...
*
MikroSim
References
External links
MMIX 2009: A RISC Computer for the Third MillenniumKnuth's official MIX page
Knuth's official MIX news
*, Knuth's original 1970 official MIX book, with
Tom Mix on the cover.
MMIXware: A RISC Computer for the Third MillenniumKnuth's official MIX book
*
{{Donald Knuth navbox
Educational abstract machines
Donald Knuth