Nowadays, Jim Green has produced a kind of computer called JG. In his computer, the instruction is represented by binary code. However when we code in this computer, we use some mnemonic symbols. For example, ADD R1, R2 means to add the number in register R1 and R2, then store the result to R1. But this instruction cannot be execute directly by computer, before this instruction is executed, it must be changed to binary code which can be executed by computer. Each instruction corresponds to a 16-bit binary code. The higher 6 bits indicates the operation code, the middle 5 bits indicates the destination operator, and the lower 5 bits indicates the source operator. You can see Form 1 for more details.
$$\begin{array} {|c|c|c|}
\hline
15 \quad \text{ operation code(6 bits)} \quad 10 & 9 \quad \text{destination operator code(5 bits)} \quad 5 & 4 \quad \text{source operator code(5 bits)} \quad 0\\
\hline
\end{array}
\\ \text{Form 1}$$
In JG system there are 6 instructions which are listed in Form 2.
$$\begin{array}{|l|l|}
\hline
\text{instruction} & \text{function}\\ \hline
\text{ADD Ra,Rb} & \text{Add the number in register Ra and Rb, then store the result to Ra.}\\ \hline
\text{SUB Ra,Rb} & \text{Subtract the number in register Ra to Rb, then store the result to Ra.}\\ \hline
\text{DIV Ra,Rb} & \text{Divide the number in register Ra by Rb, then store the result to Ra.}\\ \hline
\text{MUL Ra,Rb} & \text{Mulplicate the number in register Ra and Rb, then store the result to Ra.}\\ \hline
\text{MOVE Ra,Rb} & \text{Move the number in register Rb to Ra.}\\ \hline
\text{SET Ra} & \text{Set 0 to Ra.}\\ \hline
\end{array}\\
\text{Form 2}$$
Operation code is generated according to Form 3.
$$\begin{array}{|l|l|}
\hline
\text{Operation} \qquad \qquad \qquad & \text{Operation code} \qquad \qquad \qquad \qquad \\ \hline
\text{ADD} & \text{000001}\\ \hline
\text{SUB} & \text{000010}\\ \hline
\text{DIV} & \text{000011}\\ \hline
\text{MUL} & \text{000100}\\ \hline
\text{MOVE} & \text{000101}\\ \hline
\text{SET} & \text{000110}\\ \hline
\end{array}\\
\text{Form 3}$$
Destination operator code and source operator code is the register code of the register which is related to.
There are 31 registers in total. Their names are R1,R2,R3…,R30,R31. The register code of Ri is the last 5 bits of the number of i in the binary system. For eaxample the register code of R1 is 00001, the register code of R2 is 00010, the register code of R7 is 00111, the register code of R10 is 01010, the register code of R31 is 11111.
So we can transfer an instruction into a 16-bit binary code easyly. For example, if we want to transfer the instruction ADD R1,R2, we know the operation is ADD whose operation code is 000001, destination operator code is 00001 which is the register code of R1, and source operator code is 00010 which is the register code of R2. So we joint them to get the 16-bit binary code which is 0000010000100010.
However for the instruction SET Ra, there is no source register, so we fill the lower 5 bits with five 0s. For example, the 16-bit binary code of SET R10 is 0001100101000000
You are expected to write a program to transfer an instruction into a 16-bit binary code or vice-versa.