Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Question What is an educational benefit trust and how is it used?

Answered: 1 week ago

Question

Question How are VEBA assets allocated when a plan terminates?

Answered: 1 week ago

Question

Question May a taxpayer roll over money from an IRA to an HSA?

Answered: 1 week ago