Digital Systems Design HW

profilemustafa88
new_microsoft_word_document.docx

Digital Systems Design EET3350, Fall 2016

Homework 3

Due Date: 6:30 PM, 10/17/2016

1. Implement the following function in Assembly. Where out, a,

b, c are all Unsigned Integers of 32 bits.

out = c * (a + b << 2);

2. Write an assembly program that reverses an array M. Assume

size of M is 10 bytes and use stack related instructions only.

3. Compare three register values in R0, R1 and R2, find the largest

one, and store it into R3.

4. Write an assembly program that has a subroutine named rmndr

which computes the remainder for a variable N when it is divided

by 10 and stores the result into a variable M. Your implementation

should have basic ARM instructions.

5. Write an assembly program that has a subroutine named pow

which computes M^N for two variables and stores the result in P

variable. Assume M, N, and P are 32-bit unsigned. Your

implementation should have basic ARM instructions.

6. Write a C program that prints the following in the screen:

*****

****

***

**

*

7. Write a C program that checks a character X and if it finds bit 0

or bit 1 of X is 1, then it sets bit 7 and 6 to 1 otherwise 0. Use

bitwise operators for it.

8. Write a C program that checks a character X and if it finds bit 0

of X is 1, then it toggles bit 3 repeatedly else sets bit 3 to 1. Use

bitwise operators for it.

9. Write a C program that has a function abs(float X) which

returns the absolute value of a real number X, where X is a user

input. Don't use the built-in abs() function.

10. Write a C program that prints the prime factor of an integer X.

For example, X = 20 it should print 2, 2, and 5.