World Library  
Flag as Inappropriate
Email this Article

Mmix

Article Id: WHEBN0000020799
Reproduction Date:

Title: Mmix  
Author: World Heritage Encyclopedia
Language: English
Subject: The Art of Computer Programming, Donald Knuth, Robinson–Schensted–Knuth correspondence, LC-3, Abstract machine
Collection:
Publisher: World Heritage Encyclopedia
Publication
Date:
 

Mmix

MMIX
Designer Donald Knuth
Bits 64-bit
Design RISC
Encoding Fixed
Branching Condition Code
Endianness Big
Open Yes
Registers
32 special-purpose registers
General purpose 256
MMIX (pronounced em-mix) is a 64-bit 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. Sites (who was an architect of the Alpha architecture). In Knuth’s own words:

Architecture

MMIX is a 64-bit RISC, with 256 64-bit general-purpose registers and 32 64-bit special-purpose registers. MMIX is a big-endian machine with fixed-length 32-bit instructions and a 64-bit virtual address space. The MMIX instruction set comprises 256 opcodes, one of which is reserved for future expansion. MMIX uses IEEE 754 floating-point numbers.

Instructions

All instructions have an associated mnemonic. For example, instruction #20 (32) is associated with ADD. Most instructions have the symbolic form "OP X,Y,Z", where OP 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, ADD $0,$1,3 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. Two of the special registers, rL and rG, determine which of the general registers are local and which are global. All registers from $0 ... ([rL] − 1) are local registers, and represent a window into an internal stack of registers.[2] Registers from [rL] ... ([rG] − 1) 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 [rG] ... $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 $(rL − 1). 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.[2] 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:

  1. rB, the bootstrap register (trip)
    When tripping, rB ← $255 and $255 ← rJ. Thus saving rJ in a general register.
  2. 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.
  3. rE, the epsilon register
    Used for floating comparisons with respect to epsilon.
  4. rH, the himult register
    Used to store the left half of the 128-bit result of unsigned integer multiplication.
  5. rJ, the return-jump register
    Used to save the address of the next instruction by PUSHes and by POP to return from a PUSH.
  6. rM, the multiplex mask register
    Used by the multiplex instruction.
  7. rR, the remainder register
    Is set to the remainder of integer division.
  8. rBB, the bootstrap register (trap)
    When trapping, rBB ← $255 and $255 ← rJ. Thus saving rJ in a general register
  9. rC, the cycle counter
    Incremented every cycle.
  10. rN, the serial number
    A constant identifying this particular MMIX processor.
  11. rO, the register stack offset
    Used to implement the register stack.
  12. rS, the register stack pointer
    Used to implement the register stack.
  13. rI, the interval counter
    Decremented every cycle. Causes an interrupt when zero.
  14. rT, the trap address register
    Used to store the address of the trip vector.
  15. rTT, the dynamic trap address register
    Used to store the address of the trap vector.
  16. rK, the interrupt mask register
    Used to enable and disable specific interrupts.
  17. rQ, the interrupt request register
    Used to record interrupts as they occur.
  18. rU, the usage counter
    Used to keep a count of executed instructions.
  19. 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.
  20. rG, the global threshold register
    All general registers references with a number greater or equal to rG refer to global registers.
  21. rL, the local threshold register
    All general registers references with a number smaller than rL refer to local registers.
  22. rA, the arithmetic status register
    Used to record, enable and disable arithmetic exception like overflow and divide by zero.
  23. rF, the failure location register
    Used to store the address of the instruction that caused a failure.
  24. rP, the prediction register
    Used by conditional swap (CSWAP).
  25. rW, the where-interrupted register (trip)
    Used, when tripping, to store the address of the instruction after the one that was interrupted.
  26. rX, the execution register (trip)
    Used, when tripping, to store the instruction that was interrupted.
  27. rY, the Y operand (trip)
    Used, when tripping, to store the Y operand of the interrupted instruction.
  28. rZ, the Z operand (trip)
    Used, when tripping, to store the Z operand of the interrupted instruction.
  29. rWW, the where-interrupted register (trap)
    Used, when trapping, to store the address of the instruction after the one that was interrupted.
  30. rXX, the execution register (trap)
    Used, when trapping, to store the instruction that was interrupted.
  31. rYY, the Y operand (trap)
    Used, when trapping, to store the Y operand of the interrupted instruction.
  32. rZZ, the Z operand (trap)
    Used, when trapping, to store the Z operand of the interrupted instruction.

Hardware implementations

As of July 2010, no known hardware implementations of the MMIX instruction set architecture exist. However, the fpgammix[3] project implements MMIX in Verilog, making it possible to implement using a field-programmable gate array.

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[4] – Donald Knuth’s MMIX-SIM simple (behavioral) simulator, MMIXAL assembler, test suite, sample programs, full documentation, and MMIX architectural (pipeline) simulator (gzipped tar file).
  • MMIXX[5] – An X11-based graphics package contributed by Andrew Pochinsky of MIT’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 includes an MMIX back-end for its C/C++ compilers, contributed by Hans-Peter Nilsson and part of the main GCC distribution since late 2001. As of January 2011, 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.[6]
  • §3.17.26. MMIX Options for GNU GCC version 4.5.2[7] (GNU GCC Web site).
  • §9.25.  MMIX-dependent Features[8] for GNU as from GNU Binutils version 2.21, 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, Linux, or other similar operating system kernel onto MMIX hardware, were such hardware to exist.

See also

References

  1. ^ Knuth, Donald E. (October 1999), MMIXware: A RISC Computer for the Third Millennium, Lecture Notes in Computer Science Tutorial 1750, Heidelberg: Springer-Verlag,   (Errata)
  2. ^ a b  
  3. ^ master (2008-08-24). "fpgammix". Repo.or.cz. Retrieved 2014-05-25. 
  4. ^
  5. ^ "MMIXX". Malgil.com. 2002-03-06. Retrieved 2014-05-25. 
  6. ^ http://bitrange.com/mmix/install.html Installation instructions for GCC + MMIX tools
  7. ^ http://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/MMIX-Options.html §3.17.26. MMIX
  8. ^ "§9.25 MMIX Dependent Features". Sourceware.org. Retrieved 2014-05-25. 
  • Donald E. Knuth (2005). The Art of Computer Programming Volume 1 Fascicle 1: MMIX A RISC Computer for the New Millennium. Addison-Wesley. ISBN 0-201-85392-2 (errata)

External links

  • pageMMIXDonald Knuth's — A brief introduction to MMIX, and Knuth's reasons for using a hypothetical assembly language in TAoCP.
  • news pageMMIXDonald Knuth's — An open-source simulator written in CWEB, 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 — 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.
  • HomepageMMIXThe — In September 2011, MMIX has moved its home from Stanford to Munich.
  • 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.
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 


Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.