subject
Mathematics, 28.11.2019 03:31 cchavcchav9606

For your programs in problems 1: write the instruction address, the binary lc-3 instruction, and the corresponding rtl or assembly in the following format:

0001 001 010 1 00100 ; r1 ← r2 + 4

0001 001 010 1 00100 ; add r1, r2, #4

note how bits are arranged in groups that correspond to instruction-specific operands.

if you are not sure about the rtl format of a certain instruction, you can refer to appendix a of your patt & patel text or read sections 5.5 and 6.1. try to make your program as simple and intuitive as you can.

lc-3 programming in machine language

1) for each of the following tasks, systematically decompose the problem to the level of lc-3 instructions, then write lc-3 instructions to implement your solution. turn in your flow chart and lc-3 instructions in binary. for credit, each instruction must be annotated with a comment in rtl or assembly.

a) write a program that computes r3−r4 and stores the result in r5. to receive credit, you can only modify the contents of r5, and no other register, and your solution should have no more than 6 lines of code.

b) write a program that computes the absolute value of the number stored in r1, and stores the result in r0. to receive credit, you can only modify the contents of r0, and no other register, and your solution should have no more than 7 lines of code.

c) assuming that r2≥0, write a program that determines if the value stored in r2 is even. if r2 is even, store in r1 the value 1, otherwise store the value -1. to receive credit, you can only modify the contents of r1, and no other register, and your solution should have no more than 7 lines of code.

d) write a program that adds each of the numbers stored in memory locations d through e, inclusive, and stores the result in register r2. assume that address d can be found in register r3 and address e can be found in register r4. to receive credit, you can only modify the contents of r2, r3, r4, r5, and no other registers, and your solution should have no more than 12 lines of code.

e) multiplication of two integers can be achieved by repeated additions. similarly, division of two integers can be achieved by repeated subtractions. assume that r0≥0 and r1> 0. write a program that computes r0÷r1 and stores the quotient in r2. (the program does not need to store the remainder.) to receive credit, you can only modify the contents of r0, r1, r2, and no other registers, and your solution should have no more than 10 lines of code.

f) write a program that counts the number of bits equal to one in r1, and stores the result in r2. for example, if r1=x0a0c, then r2=x0004 after the program runs. to receive credit, you can only modify the contents of r1 and r2, and no other register, and your solution should have no more than 9 lines of code.

ansver
Answers: 2

Other questions on the subject: Mathematics

image
Mathematics, 21.06.2019 15:40, helper4282
The number of lattes sold daily for two coffee shops is shown in the table: lattes 12 52 57 33 51 15 46 45 based on the data, what is the difference between the median of the data, including the possible outlier(s) and excluding the possible outlier(s)? 48.5 23 8.4 3
Answers: 3
image
Mathematics, 21.06.2019 19:40, evarod
Afactory makes propeller drive shafts for ships. a quality assurance engineer at the factory needs to estimate the true mean length of the shafts. she randomly selects four drive shafts made at the factory, measures their lengths, and finds their sample mean to be 1000 mm. the lengths are known to follow a normal distribution whose standard deviation is 2 mm. calculate a 95% confidence interval for the true mean length of the shafts. input your answers for the margin of error, lower bound, and upper bound.
Answers: 3
image
Mathematics, 21.06.2019 23:00, DisneyGirl11
In an equilateral triangle, each angle is represented by 5y+3. what is the value of y? a. 9.7 b. 10.8 c. 11.4 d. 7.2
Answers: 1
image
Mathematics, 22.06.2019 01:30, gwoodbyrne
Study results indicate that the mean length of time people spend on a bus in a city is between 21.2 min and 24.5 min what is the study margin of the error?
Answers: 1
You know the right answer?
For your programs in problems 1: write the instruction address, the binary lc-3 instruction, and th...

Questions in other subjects:

Konu
Chemistry, 16.04.2020 04:14
Konu
Biology, 16.04.2020 04:14