Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
MMIX
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Architecture== MMIX is a [[Endianness|big-endian]] 64-bit [[reduced instruction set computer]] (RISC), with 256 64-bit general-purpose registers, 32 64-bit special-purpose registers, [[instruction set#Instruction length|fixed-length]] 32-bit [[instruction (computer science)|instruction]]s and a 64-bit [[virtual address space]]. The MMIX instruction set comprises 256 opcodes, one of which is reserved for future expansion.{{citation needed|date=January 2017}} MMIX uses [[IEEE 754]] 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 {{code|OP X,Y,Z}}, where {{mono|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, {{code|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!]]": <syntaxhighlight lang="text"> 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. </syntaxhighlight> ===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... {{nowrap|([rL] β 1)}} are local registers, and represent a [[Register window|window]] into an internal stack of registers.<ref name="rstack" /> Registers from [rL]... {{nowrap|([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 {{nowrap|$(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.<ref name="rstack">{{cite book|last=Knuth|first=Donald|author-link=Donald Knuth|title=MMIXβA RISC Computer for the New Millennium|series=The Art of Computer Programming|volume=1, Fasc. 1|year=2005|publisher=Addison Wesley|page=58|chapter=Section 1.4.2'}}</ref> 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: # <li value="0">'''rB, the bootstrap register (trip)'''</li> #: 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]]ed in several ways. External hardware, such as timers, are a common source of [[preemption (computing)|preemption interrupts]]. Many instructions cause an interrupt in certain exceptional cases; such as the [[memory protection]] [[page fault]] exceptions used to implement virtual memory, and floating point [[exception handling]]. 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]] instructions TRIP and TRAP, similar to some kinds of [[trap (computing)|trap]] in other computer systems. In particular, a [[system call]] from a user program to the operating system uses a TRAP instruction.<ref name="MMIXware" />{{rp|38}}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)