DOC PREVIEW
UW-Madison ECE 353 - Introduction to Microprocessor Systems

This preview shows page 1-2-3-4-5 out of 15 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

ECE 353 Introduction to Microprocessor SystemsTopicsProblemSlide 4Slide 5Slide 6Slide 7AnswerSlide 9Slide 10Slide 11Slide 12Slide 13Questions?Slide 15ECE 353Introduction to Microprocessor SystemsDiscussion 3TopicsSubroutines/Stack Frames/Multi-Precision ArithmeticQ & AProblemWrite a procedure that multiplies two 64-bit unsigned numbers and returns a 64-bit result in R1:R0. R1 – upper order bitsR0 – lower order bitsProblem(0). Draw a diagram showing the complete execution of a 64-bit multiplication using 32-bit multiplies and generating a 128-bit result. (Note: We will only use 64-bits of the result.) A BX C D------------------------------------------------------------------------------------------------------------------------(B*D)H (B*D)L(A*D)H (A*D)L(B*C)H (B*C)L(A*C)H (A*C)L XX XX R1 R0Problem(1). Write a main code fragment that calls the subroutine (mul64). Use a standard stack frame to pass two double-word parameters to the subroutine. Place them on the stack so that they are in little endian format. Put operand 1 on first.Clean up the stack after the subroutine returns.ProblemProblem(2). Draw a diagram of the stack at the point when the call is made to mul64. (Note: the stack is drawn as 32-bits in width.)Answer SP -> SP -> OP1 MSWOP1 LSWOP2 MSWOP2 LSWProblem(3). Write the complete subroutine that performs 64-bit unsigned multiplication, returning a 64-bit result.Use a standard stack frame to retrieve the source operands.Place the 64-bit result in R1:R0Allocate space for any temporary storage on the stack frame (do not use registers)(three words needed).Problem(2).mul64PUSH {R11,LR} ;context saveMOV R11, R13 ;get frame pointerSUB R13, R13, #12 ;allocate local variable space;B*DLDR R0, [R11, #16] ;get operand1 LSW (B)LDR R1, [R11, #8] ;get operand2 LSW (D)UMULL R0, R1, R0, R1 ;BDH:BDL in R1:R0STR R1, [R11, #-4] ;BDH to temp1 (local)STR R0, [R11, #-8] ;BDL to temp2 (local);A*DLDR R0, [R11, #8] ;get operand2 LSW (D)LDR R1, [R11, #20] ;get operand1 MSW (A)MUL R0, R0, R1 ;R0 = ADLSTR R0, [R11, #-12] ;ADL to temp3 (local);B*CLDR R0, [R11, #16] ;get operand1 LSW (B)LDR R1, [R11, #12] ;get operand2 MSW (C)MUL R1, R0, R1 ;R1 = BCL;add up MSW of resultLDR R0, [R11, #-12] ;get temp3 (ADL)ADD R1, R1, R0 ;R1 = BCL + ADLLDR R0, [R11, #-4] ;get temp1 (BDH)ADD R1, R1, R0 ;R1 = BCL + ADL + BDHLDR R0, [R11, #-8] ;get temp2 (BDL);cleanup and exitADD R13, R13, #12 ;deallocate local variable spacemul64_exitPOP {R11,PC} ;restore context and returnENDProblem(4). Update the drawing in part (2) to reflect the total stack frame used by the subroutine.Answer SP -> SP -> OP1 MSWOP1 LSWOP2 MSWOP2 LSWSP -> FP -> [FP + 20][FP + 16][FP + 12][FP + 8][FP - 4][FP - 8][FP -


View Full Document

UW-Madison ECE 353 - Introduction to Microprocessor Systems

Download Introduction to Microprocessor Systems
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Introduction to Microprocessor Systems and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Introduction to Microprocessor Systems 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?