Question: The x86 instruction set includes the REP prefix that causes the instruction to be repeated a given number of times or until a condition is

The x86 instruction set includes the REP prefix that causes the instruction to be repeated a given number of times or until a condition is satisfied. Note that x86 instructions refer to 8 bits as a byte, 16 bits as a word, and 32 bits as a double word. The first three problems in this Exercise refer to the following x86 instruction:Instruction a. REP MOVSW b. REPNE SCASB Interpretation Repeat until ECX is zero: Mem16[EDI]=Mem16[ESI].


Write MIPS code that performs the same operation, assuming that $a0 corresponds to ECX, $a1 to EDI, $a2 to ESI, and $a3 to EAX.

Instruction a. REP MOVSW b. REPNE SCASB Interpretation Repeat until ECX is zero: Mem16[EDI]=Mem16[ESI]. EDI-EDI+2, ESI-ESI+2, ECX-ECX-1 Repeat until ECX is zero: If Mem8[EDI] AL then go to next instruction, otherwise EDI-EDI+1, ECX-ECI+1. Note: AL is the least- significant byte of the EAX register.

Step by Step Solution

3.42 Rating (152 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To replicate the functionality of the x86 instruction REP MOVSW in MIPS assembly we need to perform ... View full answer

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 Computer Organization Design Questions!