Chat with us, powered by LiveChat embedded systems | Writedemy

embedded systems

embedded systems

EECS 3100 Embedded Systems Homework #4

Instructions  There are 18 questions on this assignment. Answer all for full credit. Questions or their subparts are not

necessarily equally weighted.

 You may work in groups of two but you must formulate your own responses, answers or solutions for each question or problem. Formulating one answer or solution and copying from each other is not permissible.

 Provide rationale, explanation, trace of solution or reasoning for your answers where applicable. Simply and magically providing responses or answers for those questions or problems that require reasoning may not receive any credit.

 Submission must be in hardcopy and delivered by the student in person. Use blank and letter size typing (printer) paper and in portrait layout.

 You may use handwriting or word processor or combination for your submission. However, it must be organized, legible and presentable.

 Write your full name, rocket ID and your group member’s name on the top right of the first page of your submission. For multiple sheets, staple them at the top left.

————————————————————————————————– Questions

1. Suppose r0 = 0x8000, and the memory layout is as follows:

Address Data 0x8007 0x79 0x8006 0xCD 0x8005 0xA3 0x8004 0xFD 0x8003 0x0D 0x8002 0xEB 0x8001 0x2C 0x8000 0x1A

a) What is the value of r1 after running LDR r1, [r0] if the system is (i) little endian or (ii) big endian?

b) Suppose the system is set as little endian. What are the values of r1 and r0 if the instructions are executed separately?

 LDR r1, [r0, #4]

 LDR r1, [r0], #4

 LDR r1, [r0, #4]!

2. Suppose r0 = 0x20000000 and r1 = 0x12345678. All bytes in memory are initialized to 0x00. Suppose the following assembly instruction sequence has been executed successfully. Draw a

table to show the memory values if the processor uses little endian.

STR r1, [r0], #4 STR r1, [r0, #4]! STR r1, [r0, #4]

Page 2 of 3

3. Repeat Question 2 if the processor uses big endian. 4. Complete the following arithmetic operations in two’s complement binary representation

assuming a six-bit system. What are the values of the carry flag and overflow flag?

 -7 + (-29)

 31 + 11

 15 – 19

5. What are the overflow and carry flag values for the following operations? (Assume a four-bit system.)

Carry Overflow

1101 + 1100

1101 – 1100

1100 + 1010

0100 – 0110

0100 + 0010

0100 + 0110

1100 – 0110

6. Suppose r0=0x0F0F0F0F and r1=0xFEDCBA98, find the result of the following operations. Note that the below instructions are not part of a program. Each instruction runs independently,

without influencing each other. (1) EOR r3, r1, r0 (2) ORR r3, r1, r0 (3) AND r3, r1, r0 (4) BIC r3, r1, r0 (5) MVN r3, r1 (6) MVN r3, r0 (7) ADD r3, r1, #0

7. Suppose r0=0x56789ABC, find the result of executing following instructions. Note that the below instructions are not part of a program. Each instruction runs independently, without

influencing each other. (1) RBIT r1, r0 (2) REV r1, r0 (3) REV16 r1, r0 (4) REVSH r1, r0

8. Translate the following C statement into an assembly program, assuming 16-bit signed integers x, y and z (i.e. signed short) are stored in 32-bit registers r0, r1, and r2, respectively.

9. Translate the following C statement into an assembly program, assuming 16-bit unsigned integers x and y (i.e. unsigned short) are stored in registers r0, and r1, respectively.

10. Write an assembly program that calculates the value of the following polynomial, assuming signed integers x and y are stored in registers r0 and r1, respectively.

. 11. Write an assembly program that calculates the remainder of the division between two

unsigned integers.

Page 3 of 3

12. Cortex-M4 processors do not provide any rotation left instructions. They only provide ROR (rotate right) and RRX (rotate right extended). Write an assembly instruction sequence to

implement “rotate left” operation.

13. Write an assembly instruction sequence that reverses the byte order of a register without using the REV instruction.

14. Write an assembly instruction sequence that swaps the upper half-word and the lower half- word of a register.

15. Implement the BFC (bit field clear) instruction by using other assembly instructions.

16. Suppose Mask = 0x00000F0F and P = 0xABCDABCD. What are the results of the following bitwise operations? Consider each one separately and independently operating on its

operands.

(1) Q = P & Mask; (2) Q = P | Mask; (3) Q = P ^ Mask; (4) Q = ~Mask; (5) Q = P & ~Mask;

17. Suppose r0 = 0xFFFFFFFF, r1 = 0x00000001, and r2 = 0x00000000. Initially N, Z, C, and V flags are zero. Find the value of the N, Z, C, and V flags upon executing the following

instructions. (Assume each instruction runs individually, i.e. these instructions are not part of

a program.) Do NOT use the debugger as you are expected to reason and conclude values for

the flags. (1) ADD r3, r0, r2 (2) SUBS r3, r0, r0 (3) ADDS r3, r0, r2 (4) LSL r3, r0, #1 (5) LSRS r3, r1, #1 (6) ANDS r3, r0, r2

18. Suppose we have a hypothetical processor, of which each register has only five bits. r0 = 0b11101 and r1 = 0b10110. What are the N, Z, C, V flags upon executing the following

instructions? Assume initially N=0, Z=0, C=1, V=0, and these instructions are executed

independently (i.e. they are NOT part of a program). Do NOT use the debugger! You must

determine the flag values through reasoning. (1) ADDS r3, r0, r1 (2) SUBS r3, r0, r1 (3) EOR r3, r0, r1 (4) ANDS r3, r1, r1, LSL #3

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.

Do you need an answer to this or any other questions?

About Writedemy

We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.

How It Works

To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Are there Discounts?

All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.

Hire a tutor today CLICK HERE to make your first order