



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




CS472 1
CS472 2
CS472 3
CS472 4
ALU or branch instruction IF ID EX MEM WB Load or store instruction ALU or branch instruction Load or store instruction ALU or branch instruction Load or store instruction ALU or branch instruction Load or store instruction
IF ID EX MEM WB IF ID EX MEM WB IF ID EX MEM WB IF ID EX MEM WB IF ID EX MEM WB IF ID EX MEM WB IF ID EX MEM WB
CS472 7
Loop: lw $t0, 0($s1) 1 addi $s1, $s1, -4 2 addu $t0, $t0, $s2 3 bne $s1, $zero, Loop sw $t0, 0($s1) 4
CS472 8
Loop: addi $s1, $s1, -16 lw $t0, 0($s1) 1 lw $t1, 12($s1) 2 addu $t0, $t0, $s2 lw $t2, 8($s1) 3 addu $t1, $t1, $s2 lw $t3, 4($s1) 4 addu $t2, $t2, $s2 sw $t0, 0($s1) 5 addu $t3, $t3, $s2 sw $t1, 12($s1) 6 sw $t2, 8($s1) 7 bne $s1, $zero, Loop sw $t3, 4($s1) 8
CS472 9
Loop: lw $t0, 0($s1) # $t0 = array element add $t0, $t0, $s2 # add scalar in $s sw $t0, 0($s1) # store result addi $s1, $s1, -4 # decrement pointer bne $s1, $zero, Loop
CS472 10
Loop: lw $t0, 0($s1) lw $t1, -4($s1) add $t0, $t0, $s add $t1, $t1, $s sw $t0, 0($s1) sw $t1, -4($s1) addi $s1, $s1, - bne $s1, $zero, Loop
data hazards are gone