Question

Question 3 1 pts Which of the following requests in this code snippet are unaligned. .text # Define the program instructions.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Unaligned memory accesses occur when code try to read N bytes of data starting from an address that is not evenly divisible by N .
number = 0x1001000
$t0 = 0x1001000
word size = 4 bytes
halfword size = 2 bytes
byte size = 1

lw $t1, 1($t0)
Address = 0x1001000 + 1 = 0x1001001 and it is not evenly divisible by 4.
This is unaligned.

lh $t2, 2($t0)
Address = 0x1001000 + 2 = 0x1001002 and it is evenly divisible by 2.
This is not unaligned.

lh $t3, 3($t0)
Address = 0x1001000 + 3 = 0x1001002 and it is not evenly divisible by 2.
This is unaligned.

lb $t4, 3($t0)
Address = 0x1001000 + 3 = 0x1001003 and it is evenly divisible by 1.
This is not unaligned.

lb $t5, 1($t0)
Address = 0x1001000 + 1 = 0x1001001 and it is evenly divisible by 1.
This is not unaligned.

Therefore
lw $t1, 1($t0)
lh $t3, 3($t0)

are unaligned

Add a comment
Know the answer?
Add Answer to:
Question 3 1 pts Which of the following requests in this code snippet are unaligned. .text...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • MIPS Insertion program.........I could really use some help ASAP

    I have this MIPS program and I'm having trouble with it. This program is user inputs numbers until zero and sorts and print the numbers in order. Please soove this issue. You can use any sorting algorithm except bubble sort.  Need it as soon as possible. Here is the code:.datanum: .word 0space: .byte ' ' .text main:  # la $t0, val # loads val into a register  # li $t1, 0      #keeps track of how many numbers entered  la $a0,...

  • .data A: .word 84 111 116 97 108 32 105 115 32 . text main:​li $v0,...

    .data A: .word 84 111 116 97 108 32 105 115 32 . text main:​li $v0, 1l ​li $s0,0 ​la $s1, A ​li $t3, 0 loop: ​slti $t0, $s0, 17   ​beq: $t0, $zero, end ​sll $t1, $s0 2 ​add $t2 $s1 $t1   ​syscall ​addi $s0, $s0, 1 ​j loop end: ​li $v0, 1 ​add $a0, $zero, $t3 ​syscall /// whats the output of above assembly program

  • I want to calculate Y[2]=X[3]+X[4] I'm not sure that I wrote right codes. .text main ....

    I want to calculate Y[2]=X[3]+X[4] I'm not sure that I wrote right codes. .text main . la $50, x #get base address of x la $s1, y #get base address of y lw $to, 12 ($50)#get data from memory of x[3] lw $t1 , 1 6($50) #get data from memory of x[4] add $t2, $t0, $t1 sw $t2, 8($51 ) #store result to y[2] li $v0, 10 #exit program syscall data x: word 5, 1, 17,-4, 6, 3 y: .word...

  • what is the output of the following assembly code ? .data A: .word 84 111 116 97 108 32 105 115 32 . text main:​li $v0, 1l ​li $s0,0 ​la $s1, A ​li $t3, 0 loop: ​slti $t0, $s0, 17   ​be...

    what is the output of the following assembly code ? .data A: .word 84 111 116 97 108 32 105 115 32 . text main:​li $v0, 1l ​li $s0,0 ​la $s1, A ​li $t3, 0 loop: ​slti $t0, $s0, 17   ​beq: $t0, $zero, end ​sll $t1, $s0 2 ​add $t2 $s1 $t1   ​syscall ​addi $s0, $s0, 1 ​j loop end: ​li $v0, 1 ​add $a0, $zero, $t3 ​syscall

  • Assignment 4 File “quad_sol.s” contains a quadratic polynomial solver, which calculates the integer solution of a quadratic polynomial equation. 1. Rewrite the program using instructions reordering to...

    Assignment 4 File “quad_sol.s” contains a quadratic polynomial solver, which calculates the integer solution of a quadratic polynomial equation. 1. Rewrite the program using instructions reordering to reduce the number of cycles needed to execute the program. Indicate the number of cycle reduction. 2. Describe how forwarding would affect the execution of the program. CODE # quad_sol.s # This assembly program calculates the integer solutions of a quadratic polynomial. # Inputs : The coefficients a,b,c of the equation a*x^2 +...

  • 1. Modify larger.s to let the user to enter three numbers and output the largest value...

    1. Modify larger.s to let the user to enter three numbers and output the largest value # larger.s-- prints the larger of two numbers specified # at runtime by the user. # Registers used: # $t0 - used to hold the first number. # $t1 - used to hold the second number. # $t2 - used to store the larger of $t1 and $t2. # $v0 - syscall parameter and return value. # $a0 - syscall parameter. .text main: ##...

  • Complete count_bits function. You are given an 32-bits integer stored in $t0. Count the number of...

    Complete count_bits function. You are given an 32-bits integer stored in $t0. Count the number of 1's in the given number. For example: 1111 0000 should return 4 j main ############################################################### # Data Section .data # new_line: .asciiz "\n" space: .asciiz " " double_range_lbl: .asciiz "\nDouble range (Decimal Values) \nExpected output:\n1200 -690 104\nObtained output:\n" swap_bits_lbl: .asciiz "\nSwap bits (Hexadecimal Values)\nExpected output:\n75757575 FD5775DF 064B9A83\nObtained output:\n" count_bits_lbl: .asciiz "\nCount bits \nExpected output:\n20 24 13\nObtained output:\n" swap_bits_test_data: .word 0xBABABABA, 0xFEABBAEF, 0x09876543 swap_bits_expected_data: .word...

  • WRITE THE FOLLOWING CODE IN FLOATING POINT NUMBERS IN ASSEMBLY LANGUAGE USING MIPS IN MARS .data...

    WRITE THE FOLLOWING CODE IN FLOATING POINT NUMBERS IN ASSEMBLY LANGUAGE USING MIPS IN MARS .data prompt: .asciiz "\nMaximum number is : " prompt1: .asciiz "\nMinimum number is : " prompt2: .asciiz "\nRange of the array is : " size: .word 10 #load array array: .word 23, -12, 45, -32, 52, -72, 8, 13,22,876 .text #load address of array and size la $s4,array #load address of A lw $t0,size #load i to t0 jal getArrayRange li $v0, 4    la...

  • (12 pts) The following code fragment processes an array and produces two important values in registers...

    (12 pts) The following code fragment processes an array and produces two important values in registers $v0 and $v1. Assume that the array consists of 5000 words indexed 0 through 4999, and its base address is stored in $a0 and its size (5000) in $a1. Describe what this code does. Specifically, what will be returned in $v0 and $v1? add $al, şal, $al add $al, şal, $al add $v0, şzero, $zero add $to, şzero, $zero add $t4, $a0, $to lw...

  • Write the assembly code that will transform a squared image into a negative print. (HARD-CODED OUTPUT...

    Write the assembly code that will transform a squared image into a negative print. (HARD-CODED OUTPUT WILL RESULT IN ZERO.) That is, every pixel whose unsigned value is 0 should change to 255, 1 should change to 254, 2 should change to 253, ... 255 should change to 0. $a0 contains the address of the input buffer, $a1 contains the address of the output buffer address, and $a2 contains the image dimension. Look at the below image for your reference:...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT