[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.2

Multiply Two 64 bit Numbers Using 32 Bit Words

Asked by Canoba in Assembly Programming Language

Tags: 32, add, assembly, bit, multiply

I am trying to multiply two 64 bit unsigned numbers using only 32 bit words. I understand how to multiply two 32 bit unsigned numbers but I cant figure out how to get the 64 bit number into two 32 bit words. Can someone give me an idea. Here is my 32 bit multiplication program. Any help would greatly be appreciated as I am new to the spim assembly language.

## $t1 ­ mask
## $t2 ­ multiplier (and right_hand_sum).
## $t3 ­ left_hand_sum.
## $t4 ­ multiplicand.
## $t5 - clear.
## $t6 - rightmost bit of left_hand_sum.
## $t7 - rightmost bit of right_hand_sum.
## $t8 - counter

## $v0 ­ syscall parameter / return values.
## $a0 ­ syscall parameters.
## $a1 ­ syscall parameters.

.text
.globl __start
__start:

## read the two integers
      li $v0, 5             # load multiplicand.
      syscall
      move $t4, $v0

      li $v0, 5             # load multiplier.
      syscall
      move $t2, $v0

      lw $t1, mask
      lw $t5, clear      
      
      li $t8, 32
continue:      
      
      beqz $t8, end


      and $t7, $t1, $t2
      beqz $t7, shift
      add $t3, $t3, $t4

shift:      and $t6, $t3, $t1      # store rightmost bit og l_sum in $t6
      and $t2, $t2, $t5      # clear rightmost bit of r_sum
      or $t2, $t2, $t6      # move stored right bit of l_sum to rightmost position of r_sum
      ror $t2, $t2, 1            # rotate r_sum
      srl $t3, $t3, 1            # shift l_sum right
                        # Use sra for twos complement numbers
      addiu $t8, $t8, -1
      b continue

      
end:      sw $t2, r_sum
      sw $t3, l_sum

      li $v0, 10
      syscall
.data
      r_sum: .word 0
      l_sum: .word 0

      mask:  .word 0x00000001
      clear: .word 0xFFFFFFFE

 
Related Solutions
Keywords: Multiply Two 64 bit Numbers Using 3…
 
Loading Advertisement...
 
[+][-]02/16/04 05:26 PM, ID: 10377953Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Assembly Programming Language
Tags: 32, add, assembly, bit, multiply
Sign Up Now!
Solution Provided By: Computer101
Participating Experts: 5
Solution Grade: A
 
[+][-]10/16/03 03:28 PM, ID: 9566002Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/16/03 07:03 PM, ID: 9566960Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/16/03 09:58 PM, ID: 9567527Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/28/03 05:16 PM, ID: 9840731Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/17/04 05:57 PM, ID: 10138636Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]02/12/04 12:15 AM, ID: 10340333Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92