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

15 14 13 12 11 10 9 8 76 5 4 3 2 1 0 LDR Dst Base Offset 15 14 13 12 11 10 9 8 7

ID: 3913350 • Letter: 1

Question

15 14 13 12 11 10 9 8 76 5 4 3 2 1 0 LDR Dst Base Offset 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ADD Dst Src10 0 0 Src2 Let the memory contains the following dat:a Address Content 0110 010 001 000010 0110 011 001 000001 0001 000 011 000010 001 010 011 100 101 110 0000 0000 0000 0011 0000 0000 0000 0101 0000 0000 0000 0011 0000 0000 0000 0011 And the registers contain: Register Content 001 010 011 0000 0000 0000 0010 0000 0000 0000 0101 0000 0000 0000 0010 0000 0000 0000 0001 Assume the following opcodes LDR 0110 ADD 0001 HALT 0000 What is the content of the register file after the control units starting with PC-000 halts its instruction cycle? (i.e. complete the following table). Show all of your work. Register Content 001 010 011

Explanation / Answer

Consider the following table consisting of PC value and corresponding memory content,

PC                                   Corresponding Memory content                                                      

PC          OPCODE        DST BASE                Offset                   

Initially, PC=000, and M[000]=0110 010 001 000010

OPCODE 0110 denotes LDR, i.e. LDR R[010], M[R[001]+000010] ,

                                                                              where R[i] denotes content of ith register

                                                                              and M[i] denotes content of ith memory address

i.e. R[010]=M[R[001]+000010]

Since, R[010]= 0000 0000 0000 0101 and Offset =000010

So,R[010]=M[R[010]+Offset] = M[111] = 0000 0000 0000 0011

Now, PC = 001 and M[001]= 0110 011 001 000001

i.e. LDR R[011], M[R[001]+000001]

since R[001] = 0000 0000 0000 0101

So, R[011] = M[R[001]+000001] = M[110] =0000 0000 0000 0011

Now, PC=010 and M[010] = 0001 000 011 000010

i.e. ADD R[000], R[011], R[010]

Since, R[011] = 0000 0000 0000 0011 and R[010] =0000 0000 0000 0011

So, R[000] = R[011] + R[010] =0000 0000 0000 0110

Now, PC = 011 and M[011]=0000 0000 0000 0000

which is a HALT instruction, So execution of program will stop now.

So, Register contents are,

   Reg                  Content

000 0110 (LDR) 010(Reg Addr 1) 001(Reg Addr 2) 000010 001 0110 (LDR) 011(Reg Addr 1) 001(Reg Addr 2) 000001 010 0001(ADD) 000(Reg Addr 1) 011(Reg Addr 2) 000010 011 0000(HALT) 0000 0000 0000
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