Question

(MIPS Assembly Language): Assume the following piece of MIPS code: label1: .text 0x4000fc lui $t0, 1022...

(MIPS Assembly Language):

Assume the following piece of MIPS code:

label1:

.text 0x4000fc
lui $t0, 1022
ori $t0, $t0, 2048
srl $t1, $t0, 18
sw $t0, 101($t1)
slti $t2, $t1, 5
beq $t2, $0, label3

label2:...

...
label3:...
a) The code modifies a word in memory at the following address (circle one):

  1. (i) 1022

  2. (ii) 101

  3. (iii) 5

  4. (iv) 10220000

  5. (v) Other (provide your own answer): _________________

b) The following value is stored in memory (circle one):

  1. (i) 0x17

  2. (ii) 0

  3. (iii) 1023

  4. (iv) 67043320

  5. (v) Other (provide your own answer): ___________________

c) After the branch instruction is executed, the program will continue at (circle one):

(i)label1 (ii) label2 (iii) label3 (iv) The program does not continue

d) Show the sequence of addresses issued by the CPU to execute the code (the first five instructions only):

Address

R/W

Data Bus

Comments(optical)

Homework Answers

Answer #1

lui $t0, 1022
$t0 = 0000 0000 0000 0000 0000 0011 1111 1110

ori $t0, $t0, 2048
$t0 = 0000 0000 0000 0000 0000 1011 1111 1110 (2048 + 1022 = 3070)

srl $t1, $t0, 18
$t1 = 0000 0000 0000 0000 0000 0000 0000 0000

sw $t0, 101($t1)
Mem[$t1 + 101] = $t0

a) The code modifies a word in memory at address = 101
b) value is stored in memory = 3070
c) As $t1=0 and ($t1 < 5) $t2=1
After the branch instruction is executed, the program will continue at label2

(d)the sequence of addresses issued by the CPU to execute the code
0x4000fc
0x400100
0x400104
0x400108
0x40010c

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
This is a homework assignment for Computer Architecture and some question use MIPS Assembly language. 1.    ...
This is a homework assignment for Computer Architecture and some question use MIPS Assembly language. 1.     In the following MIPS assembly code, translate all the instructions to their corresponding machine code in hexadecimal format. This code is stored in the memory from address 0x1fff0000. Loop: sw $t1, 4($s0)        addi $t1, $t1, -1    sll $t1, $t1, 2        bne $t1, $s5, Exit    addi $s0, $s0, 4          j Loop Exit: … 2.     Find the MIPS...
Question: Write down the corresponding MIPS machine language of the following assembly language code. lw $S0,...
Question: Write down the corresponding MIPS machine language of the following assembly language code. lw $S0, 64($S1) add $t0,$S0,$S1 sub $t1,$S3,$S4 sw $t1,100($S1) addi $S4,$S6,100
1a. Using the MIPS program below (with bugs intact), determine the instruction format for each instruction...
1a. Using the MIPS program below (with bugs intact), determine the instruction format for each instruction and write the decimal values of each instruction field. addi $v0, $zero, 0 loop: lw $v1, 0($a0) sw $v1, 0($a1) sll $a0, $a0, 2 add $a1, $a1, $a0 beq $v1, $zero, loop 1b. Translate the following C/Java code to MIPS assembly code. Assume that the values of a, i, and j are in registers $s0, $t0, and $t1, respectively. Assume that register $s2 holds...
Assembly Programming in MIPS Write a program in MIPS assembler that performs the following computations: Prompts...
Assembly Programming in MIPS Write a program in MIPS assembler that performs the following computations: Prompts the user to enter two integers and stores the smaller one in the first data memory word (with the lowest address) and the larger one in the second data memory word. Then divides the larger word by the smaller one in integer and stores the integer quotient in the third data memory word and the remainder in the fourth data memory word. Finally, it...