Jump to content

Lc-3 Helppp


Guest asdasdasdasd

Recommended Posts

Guest asdasdasdasd

Problem 1:

We want to increase the number of registers that we can specify in the LC-3 ADD instruction to

32. Do you see any problem with that? Explain.

Problem 2:

What is the difference between the following LC-3 instructions A and B? How are they similar?

How are they different? (Hint: check page 232 in the textbook)

A: 0000111101010101

B: 0100111101010101

Problem 3:

The LC-3 does not have an opcode for the logical function OR. That is, there is no instruction in

the LC-3 ISA that performs the OR operation. However, we can write a sequence of instructions

to implement the OR operation. The four instruction sequence below performs the OR of the

contents of register 1 and register 2 and puts the result in register 3. Fill in the two missing

instructions so that four instruction sequence will do the job:

(1): 1001 100 001 111111

(2):

(3): 0101 110 100 000 101

(4):

 

Problem 4:

Which LC-3 addressing mode makes the most sense to use under the following conditions.

(There may be more than one correct answer to each of these; therefore, justify your answers

with some explanation.)

a. You want to load one value from an address which is less than ±28 locations away.

b. You want to load one value from an address which is more than ±28 locations away.

c. You want to load an array of sequential addresses.

Problem 5:

The PC contains x3010. The following memory locations contain values as shown:

x3050: x70A4

x70A2: x70A3

x70A3: xFFFF

x70A4: x123B

The following three LC-3 instructions are then executed, causing a value to be loaded into R6.

What is that value?

x3010: 1110 0110 0011 1111

x3011: 0110 1000 1100 0000

x3012: 0110 1101 0000 0000

We could replace the three-instruction sequence with a single instruction. What is it?

Problem 6:

It is the case that we REALLY do not need to have load indirect (1010) and store indirect (1011)

instructions. We can accomplish the same results using other instruction sequences instead of

using these instructions. Replace the store indirect (1011) instruction in the code below with

whatever instructions are necessary to perform the same function:

x3000: 0010 0000 0000 0010

x3001: 1011 0000 0000 0010

x3002: 1111 0000 0010 0101

x3003: 0000 0000 0100 1000

x3004: 1111 0011 1111 1111

 

Problem 7:

The following table shows a part of the LC-3’s memory:

Address Data

0011 0001 0000 0000

0011 0001 0000 0001

0011 0001 0000 0010

0011 0001 0000 0011

1001 001 001 111111

0001 010 000 000 001

1001 010 010 111111

0000 010 111111100

State what is known about R1 and R0 if the conditional branch redirects control to location

x3100.

Problem 8:

If the condition codes have values N=0, Z=0, and P=1 at the beginning of the execution of the

following sequence of instructions, what will their values be at the end of the execution of the

following sequence of LC-3 instructions?

x3050: 0000 0010 0000 0001

x3051: 0101 0000 0010 0000

x3052: 0001 0000 0010 0001

Link to comment
Share on other sites

That's blatently just a homework assignment. If you want help on individual parts, then we're prepared to help, but expecting someone else to do it for you is just plain cheating.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.