Previous: , Up: MIX instruction set   [Contents][Index]


2.1.2.12 Execution times

When writing MIXAL programs (or any kind of programs, for that matter), whe shall often be interested in their execution time. Loosely speaking, we will interested in the answer to the question: how long takes 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.

NOP1ADD2SUB2MUL10
DIV12NUM10CHAR10HLT10
SLx2SRx2LDx2STx2
JBUS1IOC1IN1OUT1
JRED1Jx1INCx1DECx1
ENTx1ENNx1CMPx1MOVE1+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.