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

Using the symbol table on the right, write the corresponding LC-3 machine langua

ID: 647205 • Letter: U

Question

Using the symbol table on the right, write the corresponding LC-3 machine language word (16 bits, binary) for each assembly language statement below. Assume in each case the instruction/data word is located at address x3010. (In other words, this is NOT a sequence of instructions.) If a translation cannot be performed with the information given, write ILLEGAL in the blank space.

Assembly Language       Machine Language

AND R2, R3, #8          ________________________________

LEA R1, FUDGE           ________________________________

JMP CAKE                ________________________________

BRnp PIE                ________________________________

LDR R4, R5, #-2         ________________________________

OUT                     ________________________________

LDI R1, TART            ________________________________

ST R7, COOKIE           ________________________________

Symbol

Value

CAKE

x3001

PIE

x3009

COOKIE

x3025

TART

x3811

DONUT

x3100

FUDGE

x3040

thanks

C

Symbol

Value

CAKE

x3001

PIE

x3009

COOKIE

x3025

TART

x3811

DONUT

x3100

FUDGE

x3040

Explanation / Answer

Assembly Language       Machine Language

AND R2, R3, #8 0101 DR SR1 1 imm8________________________________

LEA R1, FUDGE 1110 DR x3040 ________________________________

JMP CAKE 1100 000 x3001 000000 ________________________________

BRnp PIE 0000 101 x3009 ________________________________

LDR R4, R5, #-2 0110 ________________________________

OUT                     __ILLEGAL______________________________

LDI R1, TART 1010 R1 x3811 ________________________________

ST R7, COOKIE 0011 R7 x3025 _______________________________

xNumber The number in hexadecimal notation. #Number The number in decimal notation. A[l:r] The field delimited by bit [l] on the left and bit [r] on the right, of the datum A. For example, if PC contains 0011001100111111, then PC[15:9] is 0011001. PC[2:2] is 1. If l and r are the same bit number, the notation is usually abbreviated PC[2]. BaseR Base Register; one of R0..R7, used in conjunction with a six-bit offset to compute Base+offset addresses. DR Destination Register; one of R0..R7, which specifies which register the result of an instruction should be written to. imm5 A 5-bit immediate value; bits [4:0] of an instruction when used as a literal (immediate) value. Taken as a 5-bit, 2