Mathematics
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.

answer
Answers: 2

Other questions on the subject: Mathematics

image
Mathematics, 21.06.2019 16:00, laylay4527
One card is dealt from a 52 card deck. find the probability that the dealt card is a 4 or a black 7
Answers: 2
image
Mathematics, 21.06.2019 19:30, HockeyBlockpk7039
Hardest math question of all time can you solve the equation. check for extraneous solutions.9∣9-8x∣ = 2x+3
Answers: 2
image
Mathematics, 21.06.2019 20:00, collinpeterson21
Question 3 (essay worth 10 points) (03.06 mc) part a: max rented a motorbike at $465 for 5 days. if he rents the same motorbike for a week, he has to pay a total rent of $625. write an equation in the standard form to represent the total rent (y) that max has to pay for renting the motorbike for x days. (4 points) part b: write the equation obtained in part a using function notation. (2 points) part c: describe the steps to graph the equation obtained above on the coordinate axes. mention the labels on the axes and the intervals. (4 points)
Answers: 1
image
Mathematics, 21.06.2019 20:00, stonerbabyy
Someone answer asap for ! the boiling point of water at an elevation of 0 feet is 212 degrees fahrenheit (°f). for every 1,000 feet of increase in elevation, the boiling point of water decreases by about 2°f. which of the following represents this relationship if b is the boiling point of water at an elevation of e thousand feet? a. e = 2b - 212 b. b = 2e - 212 c. e = -2b + 212 d. b = -2e + 212
Answers: 1
Do you know the correct answer?
For your programs in problems 1: write the instruction address, the binary lc-3 instruction, and th...

Questions in other subjects:

Konu
Mathematics, 01.02.2022 09:20