Question

I have an urgent project in which I'm supposed to implement bignum. I only have experience working in IA-32, any basic advice would be helpful.

Was it helpful?

Solution

If you don't have hardware to learn the architecture on, perhaps SPIM can help.

OTHER TIPS

I'd write it in C or C++ and use the compiler to generate assembly code. You can look for things to fix (if it's not a stellar compiler), and along the way, you'll learn how the assembly language works, the CPU features, etc.

First, do not do it. Instead, use an existing library, such as GMP. Wikipedia references a whole list of such libraries, with various licenses. Some are even released under public domain.

Now, let us suppose that you cannot tolerate using an existing library for some reason. Then my advice is: do it in C. MIPS32 is a RISC-like architecture designed to make compilation efficient. Since C compilers are not perfect, some performance gain can be achieved by doing manual assembly, but not a big gain (as a rule of thumb, expect a +30% speed for optimized assembly compared to optimized C -- and an awfully larger development cost, too).

That being said, you may want to know what a MIPS32 can do, so that you can better optimize C source code, and inspect what the compiler produces, to decide whether you are doing it right or not. A good source is the "MIPS32® Architecture for Programmers" which can be downloaded from this page. You will want to have a look at volumes I and II.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top