Programming‎ > ‎


MMIX 2009 a RISC computer for the third millennium

Brief outline
MMIX is a machine that operates primarily on 64-bit words. It has 256 general-purpose 64-bit registers that each can hold either fixed-point or floating-point numbers. Most instructions have the 4-byte form `OP X Y Z', where each of OP, X, Y, and Z is a single 8-bit byte. For example, if OP is the code for ADD the meaning is ``X=Y+Z''; i.e., ``Set register X to the contents of register Y plus the contents of register Z.'' The 256 possible OP codes fall into a dozen or so easily remembered categories.

A Message From Don Knuth, 01 September 2011

Welcome to all lovers of clean (or nearly clean) hardware design!

During the 1990s I spent considerable time designing a computer that would be representative of modern machines, yet easy to learn. Several of the leading experts in the field gave me considerable help with the design. The result was MMIX — "A RISC computer for the new millennium". In 1999 I completed the preliminary software to support basic MMIX programming and the simulation of many versions of the architecture. During the subsequent twelve years, this software has seen extensive use and it has successfully passed many "torture tests". Therefore I decided in September 2011 that it is now in such a satisfactory state that the current version of the software should become 100% stable — never again changing. This means that other software can be built around it, with the assurance that the underlying MMIX engine will remain the same forevermore.

(Realistically, I know that some bugs must still exist. After all, these are the most difficult programs that I've ever written! The pipeline meta-simulator allows an almost infinite variety of complex incarnations of the architecture to be configured; most of the dizzying combinations of multiple-issue, branch prediction, functional units, cache configurations, etc., etc., have therefore never yet been tried extensively. But such bugs exist also in real computers, and we have learned how to work around them.)

I believe MMIX is the best existing computer for educational purposes, if students want to experience a realistic machine with a minimum of kludgey inelegance. But it's also much more, because the meta-simulator allows us to experiment with an essentially unlimited variety of "virtual" machines that would be prohibitively expensive to build; we can see how much faster such computers would be able to operate, before deciding whether to actually manufacture them. Every time I play with this software, I'm struck by what a superb testbed it provides for system studies — and I wish that I had another lifetime in which I could explore these things personally. Furthermore I can see many other features, not present in MMIX Version 1, that ought to be studied carefully.

However, other people can do such things better than I. My own personal "calling" is to write about the process of computer programming, and to survey and organize the fascinating algorithms that computer scientists keep inventing at a great rate. Therefore I'm extremely pleased that I can now "pass the baton" to the excellent group of MMIXmasters at Munich University of Applied Science. For more than a decade, they've been leaders in the pedagogical uses of MMIX, and they've made significant contributions to interfaces between MMIX and other aspects of computing.

One thing that particularly interests me is the conversion of the machine language programs in Volumes 1, 2, and 3 of The Art of Computer Programming from the MIX computer to MMIX. I must finish writing Volumes 4 and 5 before I do this conversion myself. But I welcome attempts from readers who wish to propose what they think are the best MMIX equivalents of the existing MIX code. I probably won't have time to comment on such draft programs for several years, because the task of writing new material is so all-consuming; but I'm sure that well-written MMIX drafts will be enormously helpful to me when I do get around to preparing the next editions of Volumes 1, 2, and 3. So my hope is that people can use this website to share their ideas about such converted code. Paul Erd̷os often spoke of mathematical proofs that are so good, they belong to "The Book"; can you write MMIX programs that belong to "The Book"?

Happy hacking!