Question
1. Assume that we have C variables assigned to MIPS registers as follows: a = $s0, b = $s1, c = $s2, d = $s3.
1. Assume that we have C variables assigned to MIPS registers as follows: a =
$s0, b = $s1, c = $s2, d = $s3. Write MIPS assembly code that will implement the C
statement a = b (c + d);.
2. Now assume that we have C variables assigned to MIPS registers as follows:
a = $t0 and the base address of array X is stored in $t1. Assume that array X is stored in
main memory, with the base address referring to array element X[0].
Write MIPS assembly code that will implement the C statement X[10] = a;.
3. You are given the MIPS instruction sw $t0, 40($t1). Determine the binary representation of this instruction,
then convert to hexadecimal form.
4. What MIPS instruction does the following hexadecimal machine code represent?
0x012A4022
5.
Assume we have the following MIPS code, starting at memory address
1000H:
1000H | LOOP: | slt | $t2, $zero, $t1 |
1004H |
| beq | $t2, $zero, DONE |
1008H |
| subi | $t1, $t1, 1 |
100CH |
| addi | $s2, $s2, 2 |
1010H |
| j | LOOP |
1014H | DONE: |
|
|
If we use PC relative addressing, what is the constant for DONE in the beq instruction?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started