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

Another question on Mathematics

question
Mathematics, 21.06.2019 16:40
14 pointslet x be the seats in the small van and y the seats in the large van. how many seats does the large van have? a company uses two vans to transport worker from a free parking lot to the workplace between 7: 00 and 9: 00a.m. one van has 9 more seats than the other. the smaller van makes two trips every morning while the larger one makes only one trip. the two vans can transport 69 people, maximum.how many seats does the larger van have?
Answers: 1
question
Mathematics, 21.06.2019 18:30
Iam a rectangle. my perimeter is 60 feet. how much are do i cover?
Answers: 1
question
Mathematics, 21.06.2019 20:00
Choose the linear inequality that describes the graph. the gray area represents the shaded region. a: y ≤ –4x – 2 b: y > –4x – 2 c: y ≥ –4x – 2 d: y < 4x – 2
Answers: 2
question
Mathematics, 22.06.2019 00:20
Three students, javier, sam, and corrine, participated in a fundraiser where people donated a certain amount of money per lap that the student ran. each student also had some initial donations that were collected before the run. the equations that represent each student's total donation, y, based on the number of laps ran, x, is shown below. match each equation with the correct rate of change for that student.
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
question
English, 22.10.2020 16:01
Questions on the website: 13722360