Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Translate the following Python program into the machine language described in Ap

ID: 3855224 • Letter: T

Question

Translate the following Python program into the machine language described in Appendix C. You may assume that the program begins at address 00, and the x is stored at memory cell whose address is XY.
x= 0

while (x < 3):

      x=x+ 1

part b

Translate the high-level statement
if (X == 0): Z=Y+ W
else: Z=Y+ X
into the machine language of Appendix C, assuming that W, X, Y, and Z are all values represented in two’s complement notation, each using one byte of memory.

APPENDIX C BELOW

Op-code Operand Description RXY LOAD the register R with the bit pattern found in the memory cell whose address is XY. Example: 14A3 would cause the contents of the memory cell located at address A3 to be placed in register 4 LOAD the register R with the bit pattern XY. Example: 20A3 would cause the value A3 to be placed in register 0. 2 RXY

Explanation / Answer

Part Aa

            1 RXY

            2 R$0

Loop: cmpl R, $3

            jle endloop

            6 RST

            C 000;

Part b:        

            1 RXY

            cmpl R, $0

            je else

           6 RYW

else:

          6 RYX

         2 ZR

        C 000;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote