Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help with a MIPS Assembly question Question MIPS Assembly for REP MOVSB MIPS is a Reduced Instruction Set Computing (RISC) ISA. Complex Instruction Set Computing

Help with a MIPS Assembly question

Question

MIPS Assembly for REP MOVSB MIPS is a Reduced Instruction Set Computing (RISC) ISA. Complex Instruction Set Computing (CISC) ISAssuch as Intels x86often use one instruction to perform the function of many instructions in a RISC ISA. Here you will implement the MIPS equivalent for a single Intel x86 instruction, REP MOVSB, which we will specify here. The REP MOVSB instruction uses three fixed x86 registers: ECX (count), ESI (source), and EDI (destination). The repeat (REP) prefix on the instruction indicates that it will repeat ECX times. Each iteration, it moves one byte from memory at address ESI to memory at address EDI, and 5 /6 then increments both pointers by one. Thus, the instruction copies ECX bytes from address ESI to address EDI.

a) Write the corresponding assembly code in MIPS ISA that accomplishes the same function as this instruction. You can use any general purpose register. Indicate which MIPS registers you have chosen to correspond to the x86 registers used by REP MOVSB. Try to minimize code size as much as possible.

b)What is the size of the MIPS assembly code you wrote in (a), in bytes? How does it compare to REP MOVSB in x86 (note: REP MOVSB occupies 2 bytes)?

c)) Assume the contents of the x86 register file are as follows before the execution of the REP MOVSB:

EAX: 0xccccaaaa

EBP: 0x00002222

ECX: 0xFEE1DEAD

EDX: 0xfeed4444

ESI:0xdecaffff

EDI: 0xdeaddeed

EBP: 0xe0000000

ESP: 0xe0000000

Now, consider the MIPS assembly code you wrote in (a). How many total instructions will be executed by your code to accomplish the same function as the single REP MOVSB in x86 accomplishes for the given register state?

(d) Assume the contents of the x86 register file are as follows before the execution of the REP MOVSB:

EAX: 0xccccaaaa

EBP: 0x00002222 6 /6

ECX: 0x00000000

EDX: 0xfeed4444

ESI:0xdecaffff

EDI: 0xdeaddeed

EBP: 0xe0000000

ESP: 0xe0000000

Now, answer the same question in (c) for the above register values.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions