Author image

Set-Bit Sort in MIPS Assembly & C/C++

In this project we will dig deep into the MIPS64 architecture innards to understand the role of pipelining in a CPU. We'll be using the free & open source emulator EduMIPS64 which is written in Java. The emulator supports a subset (indeed the majority) of the MIPS64 architecture's instruction set repertoire. We will attempt to optimize and thus minimize the execution time of the program.

To test drive it, we will put together a program which processes an unsorted table of 120 signed integer numbers xi and performs the following computation:

  • counts the number of ones (bit = 1) in the binary representation of each number and sorts them in increasing order of their number of one-bits. In case there are numbers with equal set-bits sort them in increasing order of their arithmetic value.

We won't be using console input for the numbers, they will reside in a file.

The following...