Fall 2016-2017CSSE 232CSSE 232 – Computer Architecture IRose-Hulman Institute of TechnologyComputer Science and Software Engineering DepartmentHomework 1 Solutions1. (10 points) Please pay attention to this question.The goal is to get you to see thebigger picture of what the code is doing. The answer is not to simply explain what eachinstruction is doing. Consider the following code used to implement the instructionsllv $s0, $s1, $s2which uses the least significant 5 bits of the value in register $s2 to specify the amountregister $s1 should be shifted left:.datamask:.word0xfffff83f.textstart: lw$t0, masklw$s0, shifterand$s0, $s0, $t0andi$s2, $s2, 0x1fsll$s2, $s2, 6or$s0, $s0, $s2sw$s0, shiftershifter:sll$s0, $s1, 0Add comments to the code and describe how it works. Note that the twolwinstructionsare pseudoinstructions that use a label to specify a memory address that contains theword of data to be loaded. Why do you suppose that writing “self-modifying code”such as this is a bad idea?
5 September 2016Page 1