联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2021-04-21 11:16

CISC 260 Machine Organization and Assembly Language

(Spring 2021)

Assignment # 5

(Due: April 26, 2021)

Problem 1 [15 pts]. Show the IEEE 754 binary representation for the following fraction

numbers in single precision. Give your answer in hexadecimal. State if each number can

be represented exactly.

a. – 18.625

b. 3.14

Problem 2 [15 pts]. What decimal number does the following bit pattern represent if it is

a single precision floating-point number using the IEEE 754 standard?

a. 0xC0210000

b. 0xCD001000

Problem 3 [15 pts]. A single precision IEEE 754 number is stored in memory at address

X. Write a sequence of ARM instructions to multiply the number at X by 16 and store the

result back at X. You must accomplish this without using any floating-point instructions

(you may ignore overflow or underflow). Note: this is a paper-pencil problem.

Problem 4 [15 pts]. At a candy shop, the 1st candy costs 10cents. Each subsequent candy

costs 10 cents more than the previous one. For one dollar, how many candies can you

purchase at most? Here is a program written in C to answer that question.

float fundLeft = 1.0;

float cost;

int numCandies = 0;

for(cost=0.1; cost <= fundLeft; cost += 0.1) {

numCandies++;

fundLeft = fundLeft - cost;

}

printf(”%d candies; %f left over\n”, numCandies, fundLeft);

Run the program and report the result. If the result is not what is expected, explain why?

Modify the program so that the correct answer can be obtained. Present your modified

program.

Problem 5 [40 points]: Implement in ARM7 assembly language a linked list for sorting.

In the main function, open a file to read a sequence of unsorted integers. For the first

input integer, create a root node (8 bytes), holding the integer and one empty pointer. For

each of the following input integers, build a link (call it X) containing the number and

insert it to the linked list such that for any link with smaller integer should go before X

2

and any link with an integer of bigger or equal value should go after X. After all integers

are inserted, the program would traverse the linked list and print out the sorted integers

separated by space onto the screen. (See next page)

Specification: you should write Insert as a recursive function.

Submission: For problem 5, a plain text file (with .s extension) containing your

assembly code should be submitted on Canvas.

data Null or a Pointer to

the next node


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp