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

Q1. (25 points) Provide an example of an LC-3 instruction and highlight the two

ID: 3706167 • Letter: Q

Question

Q1. (25 points) Provide an example of an LC-3 instruction and highlight the two main parts of any instruction.

Q2. (25 points) List the three different types of instructions that you might find in LC-3 instructions. Give one example of each.

Q3.(25 points each) What does each of the following instruction mean:

1001 010 010 111111

0001 010 011 1 00001

0001 001 010 0 00010

Q4. (25 Points) Provide the LCV-3 ISA for each of the following:

NOT R3, R3

ADD R3, R3, #1

ADD R1, R2, R3

ADD R1, R1, #0

AND R1, R1, #-1

Explanation / Answer

Q1. (25 points) Provide an example of an LC-3 instruction and highlight the two main parts of any instruction.

Answer: Example: ADD R1, R1, R2

ADD - Destination , Source , Source
ADD instruction takes in two numbers and stores their additiion/sum in the Destination register. The first source must be a register, while the second one may be either a register or an immediate value.

In the above example, R1 and R2 are two sources, which will be added and the result will be stored in destination register R1.

Most of the LC-3 instruction will take two things, Source and Destination. So, Source and Destination are the two main parts of any LC-3 instruction.

--------------------------------------------------------------------------------------------------------------------------------------------------

2. List the three different types of instructions that you might find in LC-3 instructions. Give one example of each.

Q3.(25 points each) What does each of the following instruction mean:

Answer:

1001 010 010 111111 = NOT R2,R2

Because, 1001 = NOT instruction, 010 - R2 register, 010 - R2 register, followed by 111111 = which is unused bits in NOT instruction

0001 010 011 1 00001 = ADD R2,R3,#1

Because, 0001 = ADD instruction, 010 = R2 register, 011 = R3 register, 1 = Immediate addressing mode, followed by 00001 = which is 5-bit 2's complement value (i.e, 1).

0001 001 010 0 00010 = ADD R1,R2,R2

Because, 0001 = ADD instruction, 001 = R1 register, 010 = R2 register, 0 = Register addressing mode, followed by 00010 = first two bits unused in register addressing mode followed by 3-bit representing register. so, here 010 = R2 register.

--------------------------------------------------------------------------------------------------------------------------------------------------------

Q4. (25 Points) Provide the LCV-3 ISA for each of the following:

Answer:

NOT R3, R3 = 1001 011 011 111111

NOT = 1001, R3 = 011, R3 = 011, 6 unused bits = 111111

ADD R3, R3, #1 = 0001 011 011 1 00001

ADD = 0001, R3 = 011, R3 = 011, Immediate addressing mode = 1, 5-bit two's complement value for #1= 00001

ADD R1, R2, R3 = 0001 001 010 0 00 011

ADD = 0001, R1 = 001, R2 = 010, Register addressing mode = 0, two unused bits = 00, R3 = 011

ADD R1, R1, #0 = 0001 001 001 1 00000

ADD = 0001, R1 = 001, R1 = 001, Immediate Addressing mode = 1, 5-bits value for 0 = 00000

AND R1, R1, #-1 = 0101 001 001 1 11111

AND = 0101, R1 = 001, R1 =001, Immediate Addressing mode = 1, 5-bits value for -1 = 11111

-----------------------------------------------------------------------------------------------------------------------------------------------------

Please upvote if you are happy with the answer