Write an assembly program that first allocates and initializes two 16-bit signed numbers, A and B....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write an assembly program that first allocates and initializes two 16-bit signed numbers, A and B. This program will be responsible for passing data to the two subroutines SW_MUL and HW_MUL. [100 pts] Create a subroutine; called SW_MUL, which should calculate the product of A and B (can use any method to multiply the numbers). The parameters should be passed to the subroutine using the stack and the result is stored in R10. Create a subroutine; called HW_MUL, which should calculate the product of A and B using hardware multiplier. The parameters should be passed to the subroutine using registers and the result is stored in R11. Discuss how many clock cycles does the hardware multiplier requires to calculate the product. Assess the performance of both the subroutines by monitoring the number of clock cycles (Try different inputs before you conclude). Explain which one is more efficient and why? Question 2: Stack and subroutines -Solve this question by writing subroutines which get parameters and return value via the stack! -Explain the purpose of each instruction! a) Write a 32-bits addition subroutine that gets two operands from the stack and returns the sum. Each operand must be a 32-bits integer. b) A recursive subroutine that computes fib(n) = fib(n-1)+fib(n-2), fib(0) = 0, fib(1) = 1. SUBROUTINE: Similar to functions in C Starts with label Ends with RET Example: Subroutine Example RESET: loop: mov.w bis.b bic.b bis.b call bic.b bis.b call bic.b bis.b call bic.b jmp ; delay subroutine delay: mov.w dloop: sub.w jne ret #WDTPW|WDTHOLD,&WDTCTL; Stop watchdog timer ; Make ports 2.1, 2.3 and 2.5 Output Turn off all three LEDs Make port 2.1 ON, RED Make port 2.1 OFF, RED Make port 2.3 ON, GREEN :Make port 2.3 OFF, GREEN Make port 2.5 ON, BLUE : Make port 2.5 OFF, BLUE #0x2A, &P2DIR #0x2A, &P2OUT #0x02, &P2OUT #delay # 0x02, &P2OUT #0x04, &P2OUT #delay #0x04, &P2OUT #0x20, &P2OUT #delay #0x20, &P2OUT loop #0, r15 #1,r15 dloop ; Count down starts at 0 : Continue delay until back to zero Write an assembly program that first allocates and initializes two 16-bit signed numbers, A and B. This program will be responsible for passing data to the two subroutines SW_MUL and HW_MUL. [100 pts] Create a subroutine; called SW_MUL, which should calculate the product of A and B (can use any method to multiply the numbers). The parameters should be passed to the subroutine using the stack and the result is stored in R10. Create a subroutine; called HW_MUL, which should calculate the product of A and B using hardware multiplier. The parameters should be passed to the subroutine using registers and the result is stored in R11. Discuss how many clock cycles does the hardware multiplier requires to calculate the product. Assess the performance of both the subroutines by monitoring the number of clock cycles (Try different inputs before you conclude). Explain which one is more efficient and why? Question 2: Stack and subroutines -Solve this question by writing subroutines which get parameters and return value via the stack! -Explain the purpose of each instruction! a) Write a 32-bits addition subroutine that gets two operands from the stack and returns the sum. Each operand must be a 32-bits integer. b) A recursive subroutine that computes fib(n) = fib(n-1)+fib(n-2), fib(0) = 0, fib(1) = 1. SUBROUTINE: Similar to functions in C Starts with label Ends with RET Example: Subroutine Example RESET: loop: mov.w bis.b bic.b bis.b call bic.b bis.b call bic.b bis.b call bic.b jmp ; delay subroutine delay: mov.w dloop: sub.w jne ret #WDTPW|WDTHOLD,&WDTCTL; Stop watchdog timer ; Make ports 2.1, 2.3 and 2.5 Output Turn off all three LEDs Make port 2.1 ON, RED Make port 2.1 OFF, RED Make port 2.3 ON, GREEN :Make port 2.3 OFF, GREEN Make port 2.5 ON, BLUE : Make port 2.5 OFF, BLUE #0x2A, &P2DIR #0x2A, &P2OUT #0x02, &P2OUT #delay # 0x02, &P2OUT #0x04, &P2OUT #delay #0x04, &P2OUT #0x20, &P2OUT #delay #0x20, &P2OUT loop #0, r15 #1,r15 dloop ; Count down starts at 0 : Continue delay until back to zero
Expert Answer:
Related Book For
Posted Date:
Students also viewed these computer network questions
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
Job descriptions: In determining who will be responsible for what duties, you are to compile a Job description for the Assistant Front Office Manager, The Front Desk Agent, The Reservations Agent and...
-
In using the bolt cutter shown, a worker applies two 300-N forces to the handles. Determine the magnitude of the forces exerted by the cutter on the bolt. 300 N 12 mm 24 mm E 24 mm 460 mm 96 mm 300 N...
-
Pepsi ran an advertisement on national television promoting its Pepsi Points program whereby consumers could obtain points by purchasing Pepsi products and then redeem the points for certain apparel...
-
The value of Poisson ratio for steel lies between: (a) \(0.01-0.1\) (b) \(0.23-0.27\) (c) \(0.25-0.33\) (d) \(0.4-0.6\)
-
Alcatel Companys financial statements for 2018 are shown below: a. Compute the ratios listed above for Alcatel. b. Compared to the industry: 1. How liquid is the firm? 2. Are its managers generating...
-
The Grilton Tire Company manufactures racing tires for bicycles. Grilton sells tires for $50 each. Grilton is planning for the next year by developing a master budget by quarters. Griltons balance...
-
The correct syntax of the re . sub ( ) function is re . sub ( string , replacement, pattern ) re . sub ( pattern , string, replacement ) re . sub ( replacement , pattern, string ) re . sub ( pattern...
-
1 Carry out a PESTEL analysis of Alibaba at the time of the case. Evaluate the balance of opportunities and threats, using the same kind of figure as in Illustration 2.1. 2 Draw a basic sociogram of...
-
What is a fixture and how does a court determine whether an item is a fixture? Describe the similarities and differences between tenancy in common, joint tenancy with the right of survivorship, and...
-
The following Year 1 annual report was received by Clark from the qualified defined contribution plan provided by Clark's employer: Beginning balance Employer contribution O B. $250 $12,700 Plan...
-
Determine what the Toronto-Dominion Bank believes its duty, obligation or commitment is to it customers? In particular, does the financial institution believe its duty is to act in the best interests...
-
7. Draw a network regarding the following linear programming problem. Minimize 4.x12 +3x13 +2x23 -2x42 +6x34+3x35 +3x64 +65 -4x75 +2x76 subject to X12+ X13 -12 +*23
-
2. (7 pt) The potential energy between two Helium (He) atoms is represented by the following equation as a result of the van der Waals interaction between the two noble atoms, 12 E (r) = 4 [6] where...
-
During the accounting review, another comment caught your attention. The manager mentioned that one of the large POC consulting projects with National Bank seemed to be running well behind schedule....
-
It is easy to weld Aluminium using pressure welding but, Al gives problems in MMAW, SAW, Laser, and Resistance welding. Justify
-
On 1 July 2018, Parent Ltd acquired all the shares of Son Ltd, on a cum-div. basis, for $2,057,000. At this date, the equity of Son Ltd consisted of: $ 1,000,000 Share capital 500 000 shares...
-
Savoie Lte. is a manufacturer of specialized industrial machinery seeking to diversify its operations. After protracted negotiations, the directors decided to purchase the assets and liabilities of...
-
Federal, provincial, and territorial governments in Canada are now applying the accrual based financial reporting model used in the CICA PSA Handbook. This significant transformation in public sector...
-
What is meant by significant influence?
-
Macquarie Manufacturing Ltd prepared the following planned production data for the forthcoming year ending 30 June 2019. Required (a) Prepare a table showing the predetermined factory overhead rate...
-
Beautiful Bottles Pty Ltd, bottle manufacturer for the food industry, has just installed a job order costing system. The company uses machine hours to apply its overhead to work in process. On 1 May...
-
Green Consultants Pty Ltd specialise in consulting on landscape design. The company developed a predetermined charge-out rate based on hours for each of its consultants on 1 July 2019 to assign the...
Study smarter with the SolutionInn App