MIPS - Making a 64 bit number when you only have 32 bit register support

  • Thread starter Thread starter Kerren
  • Start date Start date
  • Tags Tags
    Bit Mips Support
Click For Summary
SUMMARY

The discussion focuses on methods to create a 64-bit number using only 32-bit registers in MIPS architecture. The user explores several strategies, including using an overflow register, allocating memory on the heap, and attempting to utilize the $f register, which are ultimately unsuccessful. The user seeks alternative solutions for handling overflow during addition and forming a 64-bit representation from 32-bit components. The conversation highlights the limitations of 32-bit registers in representing larger numbers and the need for creative programming techniques.

PREREQUISITES
  • Understanding of MIPS assembly language
  • Knowledge of binary arithmetic and overflow handling
  • Familiarity with memory allocation in programming
  • Basic concepts of register architecture and data types
NEXT STEPS
  • Research MIPS assembly language techniques for handling overflow
  • Learn about memory management and dereferencing in MIPS
  • Explore bit manipulation techniques for constructing larger data types
  • Investigate the use of floating-point registers in MIPS for larger number representation
USEFUL FOR

Programmers working with MIPS architecture, computer science students studying assembly language, and developers needing to manage data types in constrained environments.

Kerren
Messages
9
Reaction score
0
Hey guys I've been working on this program for just over a week now and I just can't seem to find any way around my problem. The problem I'm having is:

I'm trying to add 32 bit numbers together and if there is an overflow then I'd like to find a way to output the result as a 64 bit number.

I had a couple of ideas (as of yet, none of them have worked :biggrin:) so here they are:

  1. My first bright idea :biggrin:
    I tried to add numbers together and when there was an overflow I'd increment another register (lets call it the "overflow" register). Once the calculation was done I would just output the overflow register next to the other register to make a "64 bit" number :smile: In theory this would work IF we were working in decimal (base 10) because when there is an overflow a digit is added to the front of the result, however, in binary there is not always a whole new digit added to the front of the result so this didn't work for me and I got some pretty funny answers :smile:!
  2. The second idea
    I tried to allocate 8 bytes in the heap memory block and just save the result to that. The problem I had is that I can't dereference that allocated memory in the actual add function. This means that I have to use an intermediate register for calculating the result and then I would copy this intermediate register to the allocated memory. This defeats the point of the allocated memory because the intermediate register is only 32 bits :smile:
  3. The third (untested) idea
    I want to read in an actual binary input and then I can shift the bits and if there is an overflow I add them to a new binary number (the overflow register) and then output both the overflow register and the result register together to form a 64 bit number. The problem I'm having is that I don't actually know how to make a binary variable (is there even such a thing as a "binary variable" :biggrin:??)
  4. The fourth idea
    I tried to use the $f register because it looks to me like they are 64 bit registers but it seems like they are private registers that I cannot access. Does anyone know any way around this?
  5. Other thoughts
    Is there any way to link registers together so that they can form virtual 64 bit ones (I know that's a really hopeful thought :smile:)?

    Also does anyone have any other ideas on how to make a 64 bit system using only 32 bit registers?

Thanks guys!
 
Engineering news on Phys.org
I'm an idiot! I thought I put this in the course work section :)! Can we move this quick?
 

Similar threads

Replies
7
Views
14K
  • · Replies 30 ·
2
Replies
30
Views
7K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 5 ·
Replies
5
Views
2K
  • Sticky
  • · Replies 13 ·
Replies
13
Views
8K
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 7 ·
Replies
7
Views
4K
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K