Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The linked list will contain a s e n t i n e l node, used t o indicate the end o f the list.

The linked list will contain a sentinel node, used to indicate the end of the list. The elements in the list should be allocated on the heap, with memory allocated using the sbrk syscall available in RARS.
Assignment Details
The assignment consists of implementing 6 procedures (functions) defined inlinkedlist.asm. Each procedure is documented in the comment above the relevant procedure label. You can assume any pre-conditions are fulfilled when the procedure is called. If applicable, your solution must adhere to the post-conditions specified in the documentation.
The first procedure you should implement isLLPUSHFRONT. The tests for every other procedure requires instantiating the linked list, which involves pushing an element to the front of the list. The other procedures can be implemented in any order. You will receive partial credit for each procedure implemented correctly.
Specification
Your solution must follow the following specification:
1. Use 32-bit RISC-V.
2. Each node in the linked list should store a4-byte integer as well as a pointer to the next node.
3. Memory for nodes in the linked list should be allocated on the heap using the sbrk syscall in RARS.
4.An empty linked list consists of one sentinel node, which points to memory location 0x0 and has the value 0.
5. The linked list should not allocate more memory than necessary. If implemented correctly, all nodes should bein a contiguous section of memory on the heap ifLLPUSHFRONT is called successively. If allocations (withsbrk) are made in between calls toLLPUSHFRONT, then the nodes will not bein a contiguous section of memory. Your code must be able to handle nodes that aren't stored contiguously in memory.
6. You can assume memory addresses returned from sbrk are 4-byte aligned.
7. You must save any callee-saved registers before use in the procedures. Failure todoso may result inan incorrect test output. Linked List Example
After the following instructions (note, not assembly):The heap should look like the following diagram:Note that the Head of Linked List represents a register containing the address of the integer 3in the screenshot.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions

Question

Describe the new structures for the HRM function. page 676

Answered: 1 week ago