Question: Do the following well. It is not much, read the directions, do the comments as asked and do the explanations seperate to the comments asked.

Do the following well. It is not much, read the directions, do the comments as asked and do the explanations seperate to the comments asked. Write meaningful comments of the code given based on the instruction given and then write the descriptions as stated.
Consider the following code used to implement a new instruction: foo $t3,$t1,$t2:
This is the code:
mask : . word 0xFFFFF83F
s t a r t : l a $t0, mask
lw $t0,0( $ t 0)
l a $t3, s h f t r
lw $t3,0( $ t 3)
and $t3, $t3, $ t 0
andi $t2, $t2,0 x 001 f
s l l $t2, $t2,6
o r $t3, $t3, $ t 2
l a $t5, s h f t r
sw $t3,0( $ t 5)
s h f t r : s l l $t3, $t1,0
Above is the code, make sure it is formatted correctly when you send the comments etc. Following is the full directions:
Add meaningful comments to the code and write a brief (2 sentence max) description of what foo does. This is not the same as saying how it does it - e.g., when asked to describe what a pedestrian is doing, you would say they are walking, not that they are ilfting their left leg, angling it forward, putting it down, .... State at least one reason why writing self-modifying code such as this is a bad idea (and often times not actually allowed by the operating system)?
Some additional explanatory notes:
Recall that labels are just human-readable names of 32-bit immediates corresponding to the address that the OS will decide for them. For example, if the OS decides to start the program at 0xABCD1234, mask is the 32-bit immediate 0xABCD1234. In this case, the program does the same thing regardless of what the OS decides such programs are said to be relocatable (but all programs may not be
relocatable).
the la pseudo-instruction stores the 32-bit label (see previous note) into a
register. It is equivalent to li though some assemblers might not allow a label argument for li.
The .word directive yet has not been covered, This is an assembler directive, which is essentially an instruction to the assembler (NOT an assembly language instruction). In this case, it tells the assembler to reserve a word of memory initialized to 0xfffff83f. Mask is the address of this word (just as start is the address of the word in memory containing the machine code for that la instruction).
All directions and what you need above is there, do the comments and the explanation well. follow it well

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 Databases Questions!