TAOCP 1.3.1 Exercise 10
The comparison indicator $\mathrm{CI}$ takes one of the three values $\mathrm{LESS}$, $\mathrm{EQUAL}$, or $\mathrm{GREATER}$.
Section 1.3.1: Description of MIX
Exercise 10. [15] List all the MIX operators that can possibly affect the setting of the comparison indicator.
Verified: yes
Solve time: 51s
Solution
The comparison indicator $\mathrm{CI}$ takes one of the three values $\mathrm{LESS}$, $\mathrm{EQUAL}$, or $\mathrm{GREATER}$. From the instruction tables in Section 1.3.1, $\mathrm{CI}$ is assigned only by instructions of the comparison family.
The relevant definition is given in the instruction format lines for opcodes $56$ through $63$, where each instruction explicitly states
$$ \mathrm{CI} \leftarrow r\ast(F) : V. $$
Each such instruction compares a register field with the value $V = M(F)$ and sets $\mathrm{CI}$ accordingly.
The operators that perform this action are exactly:
- $\mathrm{CMPA}(0:5)$
- $\mathrm{CMP1}(0:5)$
- $\mathrm{CMP2}(0:5)$
- $\mathrm{CMP3}(0:5)$
- $\mathrm{CMP4}(0:5)$
- $\mathrm{CMP5}(0:5)$
- $\mathrm{CMP6}(0:5)$
- $\mathrm{CMPX}(0:5)$
No other instruction in the listed MIX repertoire assigns a value to $\mathrm{CI}$. Arithmetic instructions such as $\mathrm{ADD}$, $\mathrm{SUB}$, $\mathrm{MUL}$, and $\mathrm{DIV}$ modify registers and possibly the overflow toggle but do not alter $\mathrm{CI}$. Jump instructions inspect $\mathrm{CI}$ but do not assign to it.
Hence the complete set of MIX operators that can affect the comparison indicator is precisely the comparison instructions listed above.
$$ \boxed{\mathrm{CMPA},\ \mathrm{CMP1},\ \mathrm{CMP2},\ \mathrm{CMP3},\ \mathrm{CMP4},\ \mathrm{CMP5},\ \mathrm{CMP6},\ \mathrm{CMPX}} $$
This completes the solution. ∎