# ECE 690 Term Project

Use the **QTSPIM or MARS simulator** for the MIPS microprocessor architecture.

Assume only integer operations in this project (i.e., no operations of the floating-point type).

## PROGRAM TO DEVELOP AND SIMULATE

GIVEN an array of ten 64-bit numbers in memory starting at a known location (say SOURCE), apply __RUN-LENGTH ENCODING__ to its binary contents to achieve lossless data compression. Store the result (i.e., the counts of alternating sequences of “0”s and “1”s) in the memory starting at a known location (say DEST). Assume that each count is stored in a byte (i.e., the count fits in 8 bits) and another output (say SIZE) contains the total number of 8-bit counts.

Assume the big endian representation for stored numbers.

### EXAMPLE

**Assume the 32-bit input at SOURCE:**

**00000000010011111111000000001111**

__Step 1__: Identify contiguous sequences of “0”s and “1”s in this 32-bit input

__Step 2:__ Count the “0”s and “1”s in these sequences and store the counts sequentially in the array DEST assuming that the first count is for “0”s (the most significant bits in the 32-bit sequence).

ð *The result in DEST for our input is “912884” (with SIZE=6) since the binary input contains 9 “0”s which are followed by 1 “1”, which is followed by 2 “0”s, which are followed by 8 “1”s, etc. *

**NOTE**: Short MIPS tutorials can be found at many sites, such as:

- http://logos.cs.uic.edu/366/notes/mips%20quick%20tutorial.htm
- http://www.eecs.harvard.edu/~ellard/Courses/cs50-asm.pdf (with example codes at the end of the tutorial that you could use to get experience with the simulator)
__http://chortle.ccsu.edu/assemblytutorial/__

**Run your code for the following hexadecimal input: **

**The lowest address (SOURCE) stores the most significant byte of the first 64-bit number. **

{`4444440000000000 (first 64-bit number) FFFFFFFFFFFF0000 0000000000055555 00000000000FFFFF FFFFFFFF00000000 000000FFFFFFFFFF 0000000000000000 FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFA AAAAAAAAA0000000 `}

**Binary representation of this input: **

**Lowest address (SOURCE) **

{`0100010001000100010001000000000000000000000000000000000000000000 1111111111111111111111111111111111111111111111110000000000000000 0000000000000000000000000000000000000000000001010101010101010101 0000000000000000000000000000000000000000000011111111111111111111 1111111111111111111111111111111100000000000000000000000000000000 0000000000000000000000001111111111111111111111111111111111111111 0000000000000000000000000000000000000000000000000000000000000000 1111111111111111111111111111111111111111111111111111111111111111 1111111111111111111111111111111111111111111111111111111111111010 1010101010101010101010101010101010100000000000000000000000000000 `}