Question: The following Code is a MIPS for allocating memory. This code is meant to allocate and deallocate memory on user demand. The following restrictions are

The following Code is a MIPS for allocating memory. This code is meant to
allocate and deallocate memory on user demand. The following restrictions
are listed below
The memory pool is limited to 4096 bytes
The memory pool divided into equal chunks of 32 bytes (chosen due
to MIPS architecture). Thus, the 4096 bytes memory will be divided
into 128 chunks.
Despite allocation requests coming in any size, the actual allocations
should be performed in integer multiples of chunks. Therefore, the
byte size request will be rounded up to the closest multiple of 32.
To succeed in this task, the code must allocate and deallocate
memory upon request. If some of the requests cannot be handled,
exception handling must be activated to resolve the issue.
When assembling the code in mars I was greeted with two errors. (The
errors are highlighted)
add $v0, $t4, memory_pool # Starting address of the current block:
"memory_pool": operand is of incorrect type
div $a1, chunk_size # Divide address by chunk size:
"chunk_size": operand is of incorrect type
Please Debug the Code. It has been implemented below
The following Code is a MIPS for allocating

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!