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

(1) Please complete the assembly language program to compute: ~ {[10 * 2) & (48

ID: 3732132 • Letter: #

Question

(1) Please complete the assembly language program to compute:

~{[10 * 2) & (48 / 4)] ^ [(10 * 2)] | (48 / 4)]}

The symbols are operations defined as below:

* : multiplication operation

/ : division operation

&: bitwise logical AND operation

| : bitwise logical OR operation

^: bitwise logical XOR operation

~: bitwise logical NOT operation

# Midterm Question

.text

.globl main

main:

____________ # load 10 into $8

____________ # load 48 into $9

____________ # compute 10*2 and put the result into $8

____________ # compute 48/4 and put the result into $9

____________ # compute 48/4 and put the result into $9

____________ # compute AND operation and put the result in $10

____________ # compute OR operation and put the result in $10

____________ # compute XOR operation and put the result in $12

____________ # compute NOT operation and put the result in $12

## End of file

(2) What are the hexadecimal patterns stored in $8, $9, $10, $11 and $12 after the execution of the program ? (Note that each register is 32 bits)

Explanation / Answer

Please find the answer below:

.text

.globl main

main:

li $8,10 # load 10 into $8

li $9,48 # load 48 into $9

mul $8,$8,2 # compute 10*2 and put the result into $8

div $9,$9,4 # compute 48/4 and put the result into $9

and $10,$8,$9    # compute AND operation and put the result in $10

or $11,$8,$9 # compute OR operation and put the result in $10

xor $12,$8,$9   # compute XOR operation and put the result in $12

not $12,$12 # compute NOT operation and put the result in $12

## End of file

The value of the register after execution will be:

$8 : 0x000000014

$9,   0x00000000c

$10, 0x000000004

$11  0x00000001c

$12 0xffffffffffffffffe7