Previous: Miscellaneous operators, Up: MIX instruction set [Contents][Index]
When writing MIXAL programs (or any kind of programs, for that matter), we shall often be interested in their execution time. Loosely speaking, we will be interested in the answer to the question: how long does it take a program to execute? Of course, this execution time will be a function of the input size, and the answer to our question is commonly given as the asymptotic behaviour as a function of the input size. At any rate, to compute this asymptotic behaviour, we need a measure of how long execution of a single instruction takes in our (virtual) CPU. Therefore, each MIX instruction will have an associated execution time, given in arbitrary units (in a real computer, the value of this unit will depend on the hardware configuration). When our MIX virtual machine executes programs, it will (optionally) give you the value of their execution time based upon the execution time of each single instruction.
In the following table, the execution times (in the above mentioned arbitrary units) of the MIX instructions are given.
NOP | 1 | ADD | 2 | SUB | 2 | MUL | 10 |
DIV | 12 | NUM | 10 | CHAR | 10 | HLT | 10 |
SLx | 2 | SRx | 2 | LDx | 2 | STx | 2 |
JBUS | 1 | IOC | 1 | IN | 1 | OUT | 1 |
JRED | 1 | Jx | 1 | INCx | 1 | DECx | 1 |
ENTx | 1 | ENNx | 1 | CMPx | 1 | MOVE | 1+2F |
In the above table, ’F’ stands for the number of blocks to be moved
(given by the FSPEC
subfield of the instruction); SLx
and
SRx
are a short cut for the byte-shifting operations; LDx
denote all the loading operations; STx
are the storing
operations; Jx
stands for all the jump operations, and so on with
the rest of abbreviations.