Question: Convert logical labels into actual addresses. This process requires two passes over the instruction array. - Pass one: find the mapping of labels to the

Convert logical labels into actual addresses. This process requires two passes over the instruction array.

- Pass one: find the mapping of labels to the PC where that label occurs

- Pass two: for each instruction with a non-zero branch_label (jumps and branches) calculate the appropriate address using the mapping.

EXAMPLE:

Convert logical labels into actual addresses. This process requires two passes over

Return a list of copies of the Instructions with the immediate field of the instruction filled in with the address calculated from the branch_label. The instruction should not be changed if it is not a branch instruction.

public static List resolve_addresses(List unresolved, int first_pc) {

return null;

}

before phase2: branch target for branch instructions indicated using branch_label field Address 0x00400000 0x00400004 0x00400008 0x0040000C 0x00400010 Label label1 Instruction addu Sto,$t0,$t1 abel"label1" ori to,t0,0xFF beqSt0,$12,label1 label-"label2", branch-label="label1" addiu $t1,t1,-1 addiu St2,$t2,-1 abe"label3" Important instruction field values label2 label3 after phase2: branch target for branch instructions indicated using immediate field Address 0x00400000 0x00400004 0x00400008 0x0040000C 0x00400010 Label Important instruction field values label1 label2 label3 Instruction addu St0,$t0,$t1 ori tO,$t0,0xFF beq to,$t2,-3 addiu St1,$t1,-1 addiu t2,t2,-1 immediate 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!