1. What is a) 1 b) -1, encoded as a signed word in hexadecimal? 2. What is a) 1
ID: 2267525 • Letter: 1
Question
1. What is a) 1 b) -1, encoded as a signed word in hexadecimal? 2. What is a) 1 b)-1, encoded as a signed halfword in hexadecimal? 3. How do you convert a signed halfword to a signed word such that it represents the same (decoded) value? 4. What is the difference between the following instructions: Idw, Idh, Idb, Idhu, ldbu 5. What is the difference between the following instructions: stw, sth, stb 6. What is the hexidecimal value of the signed halfword at the address LAST in the array? 7. What is the hexidecimal value of the signed word at the address K in the linked list? 8. ls the signed word at address I positive or negative? 9. How do you check the value of the registers (r2 and r3) using the debugger at the end of your program? 10.How would you know at what address the output lists begin? 11. How do you examine the contents of the two output lists in memory using the debugger? 12. Why is the final br LOOP_FOREVER necessary? (Hint: What instructions would the processor execute after finishing processing the input list if br LOOP_FOREVER were not there?) 3. For the linked list whose first element is at IN LINKED LIST, show how the linked list will appear in memory by completing the following table, assume the linked list starts at address 0x1000: Address Data Word 0x1000 0x00000001 14. Draw the linked list as a block diagram. 15. Write the sequence of numbers, in hexadecimal, seen while traversing the linked list 16. Write a few lines of assembly to perform an unaligned memory access, test it in the lab and record the result 17. Write the assembly program that separates a list of numbers into a negative and positive list, and counts the number of each, as described above.Explanation / Answer
Answer :- 1) In hexadecimal signed word(32-bit)-
1 = 0x00000001 and -1 = 0x80000001 MSB bit = 1 for negative number in signed number system.
Answer :- 2) In hexadecimal signed half-word(16-bit)-
1 = 0x0001 and -1 = 0x8001 MSB bit = 1 for negative number in signed number system.
Answer :- 3) To convert a signed half word to a signed word, first clear the MSB bit in half word. Add this to 32-bit zero and set the MSB in the added result. Ex- num = 0x8001 is signed half word, so we do the same-
Clear the MSB i.e. num = num & 0x7FFF = 0x8001 & 0x7FFF = 0x0001
Add to 32-bit zero i.e. num = 0x00000000 + 0x0001 = 0x00000001
Now set the MSB i.e. num = num | 0x80000000 = 0x80000001 is the 32-bit signed number.
Answer :- 4) ldw => load word i.e. 32-bit load operation
ldh => load half word(16-bit) from memory
ldb => load a byte from memory(8-bit)
ldhu => load unsigned half word from memory
ldbu => load unsigned byte from memory
Answer :- 5) stw => store word to memory
sth => store half word to memory
stb => store byte to memory
Dear student, all these questions are related to Altera Processor. You can follow the datasheet for further answers. Thanks and have a nice day.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.