Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please give a full solution The MIPS instruction set includes several shift inst

ID: 3650152 • Letter: P

Question


Please give a full solution

The MIPS instruction set includes several shift instructions. They include logical-shift- left, logical-shift-right, and arithmetic-shift-right. Other architectures only provide an arithmetic shift-right instruction. Why doesn't MIPS offer an "arithmetic-shift-left" opcode? How would you implement in the assembler a logical-shift-left (LSL) pseudo-operation for a machine that didn't have this particular instruction? Be sure your LSL instruction can shift up to W bits where W is the machine word size in bits.

Explanation / Answer

a)It is so because in mips arithmetic shift left opcode and logic shift left are same,so no need to provide in separate. b)it resembles multiplication by 2 .so it can be assemble in loop mul $e1,$e1*2