MMIX
MMIX [ ˈɛmɪks ] is a 64-bit model computer ( abstract machine ) with a RISC instruction set. Donald Knuth used it in his multi-volume reference work The Art of Computer Programming , to the presented algorithms to describe. MMIX replaces the older MIX model computer of the first editions with a modern, extended version.
Knuth justifies this choice by pointing out that programming in a hypothetical assembly language prevents his work from quickly appearing out of date. In the last few decades you have seen again and again new programming languages that only met with interest for a short time. In addition, a hardware-related language allows the problems in the efficient implementation of algorithms to be presented more concretely than a high-level programming language .
The MMIX is controlled via 256 machine commands. Most, especially the arithmetic logic commands only use register - operands . Like modern RISC processors, the MMIX has a relatively large number of general-purpose registers with 256. In addition, there are 32 special registers for displaying errors and certain conditions. In addition, in contrast to the MIX mentioned, MMIX also allows virtual addressing and thus the investigation of storage algorithms.
The fact that the MMIX not as hardware , rather than software - simulation is implemented, is probably one of the reasons why it is used mainly in research and teaching. The MMIX is particularly useful in the field of algorithm development and the efficiency measurement of algorithms. The simulator software provides information about the runtime or the required clock cycles and the number of commands executed by individual algorithms, thus enabling a direct and undisturbed comparison of different algorithms.
architecture
MMIX is a binary computer with a 64-bit virtual address space and 32-bit commands that use the big-endian convention.
Commands
All commands have mnemonics , such as ADD to 32. Most commands have the form OP X, Y, Z , where OP stands for the instruction and X for the register in which the result is stored. The rest designates the operands of the instruction. Each field is eight bits wide. ADD $ 0, $ 1,3 , for example, adds the contents of register $ 1 to 3 and stores the result in register $ 0.
MMIX programs normally use the MMIXAL assembly language (see the Hello World page ).
register
There are 256 general purpose registers in the MMIX chip, numbered from $ 0 to $ 255, and 32 special registers. When X is a number from 0 to 255 inclusive, registers rL and rG determine whether $ X is a local or global register.
Local register stack
The local register stack performs its own subroutines with its own rL local registers ($ 0 to $ (rL-1)). The arguments of the subroutines remain in the local registers of the subroutine when they are called. When returning from the subroutine, the registers previously placed on the stack ("PUSH") are read back ("POP"). Since there are only 512 local, physical registers, part of the stack is stored in main memory. With the special registers rO and rS you can see which part of the local register stack is already in the memory.
Special register
The 32 special registers are:
- rB, the bootstrap register (trip)
- When assigning, rB ← $ 255 and $ 255 ← rJ. Thus, rJ is stored in a normal register.
-
rD, dividend register
- "Unsigned Integer Division" uses this register.
-
rE, epsilon register
- For floating point comparisons with consideration of the epsilon
-
rH, Himultregister
- To save the left part of a 128-bit result after an "unsigned integer" multiplication.
-
rJ, return Jump register
- When PUSH is executed, the address of the next instruction is saved here and read when POP returns.
-
rM, multiplex mask register
- Used by the multiplex command
-
rR, residual register
- For the rest of an "integer division"
-
rBB, Bootstrap register (trap)
- When assigning, rBB ← $ 255 and $ 255 ← rJ. Thus, rJ is stored in a normal register.
-
rC, cycle counter
- Increases with each cycle
-
rN, serial number
- A constant that designates the MMIX processor
-
rO, register stack offset
- To implement the register stack
-
rS, register stack pointer
- To implement the register stack
-
rI, interval counter
- Decreases with each cycle. Triggers an interrupt at 0.
-
rT, trap address register
- For storing the address of the trip vector
-
rTT, dynamic trap address register
- For storing the address of the trip vector
-
rK, interrupt mask register
- To activate or deactivate interrupts
-
rQ, interrupt request register
- To save the interrupts when they occur
-
rU, Usage counter
- Counts the commands executed
-
rV, Virtual translation register
- To translate a virtual address into a physical one
-
rG, Global threshold register
- All registers greater than or equal to rG belong to the global registers.
-
rL, Local threshold register
- All registers smaller than rL belong to the local registers.
-
rA, Arithmetic status register
- For recording arithmetic exceptions such as overflows or division by zero
-
rF, Failure location register
- The address of the command that triggered an error is saved here.
-
rP, Prediction register
- Used by "conditional swap" (CSWAP)
-
rW, Where-interrupted register (trip)
- To save the next command that was interrupted by an interrupt
-
rX, execution register (trip)
- To save the command that was interrupted by an interrupt
-
rY, Y operand (trip)
- For storing the Y operand in the event of an interrupt
-
rZ, Z operand (trip)
- For storing the Z operand in the event of an interrupt
-
rWW, Where-interrupted register (trap)
- To save the next command that was interrupted by an interrupt
-
rXX, Execution register (trap)
- To save the command that was interrupted by an interrupt
-
rYY, Y operand (trap)
- For storing the Y operand in the event of an interrupt
-
rZZ, Z operand (trap)
- For storing the Z operand in the event of an interrupt
literature
- Heidi Anlauff, Axel Böttcher & Martin Ruckert: The MMIX book. A practical approach to computer science. Springer, Berlin [a. a.] 2002, ISBN 3-540-42408-3
- Donald E. Knuth: MMIXware: A RISC Computer for the Third Millennium. Springer, Berlin [a. a.] 1999, ISBN 3-540-66938-8
- ders .: The Art of Computer Programming. Vol. 1, Fascicle 1: MMIX - A RISC Computer for the New Millennium. 3rd edition. Addison-Wesley, 2005, ISBN 0-201-85392-2
Web links
- Donald Knuth's MMIX page (English)
- MMIX Homepage (English)