- Figure 3.10 in textbook 2nd edition or Figure A.6 in the 3rd
edition
;-------------------------------------------------------------------
; Example to illustrate RAW w and w/o data forwarding, similar to
; Figure 3.10 or A.6 in textbook
;-------------------------------------------------------------------
main:
add r1,r2,r3 ;store a new value in r1
sub r4,r1,r5 ;use r1
and r6,r1,r7 ;use r1
or r8,r1,r9 ;use r1
xor r10,r1,r11 ;use r1
nop
nop
nop
nop
add r1,r2,r3 ;store a new value in r1
sub r4,r1,r5 ;use r1 & store new r4
and r6,r4,r7 ;use r4
or r8,r6,r9 ;use r6
xor r10,r8,r11 ;use r8
Finish:
trap 0
- Figures 3.11 and 3.12 in textbook 2nd edition, or Figure A.9
in the 3rd edition
;-------------------------------------------------------------------
; Example to illustrate RAW w and w/o data forwarding, similar to
; Figures 3.11 and 3.12 or A.9 in textbook
;-------------------------------------------------------------------
main:
add r1,r2,r3
lw r4,0(r1) ;load into r4 using r1
sw 12(r1),r4 ;store r4 using r1
nop
nop
nop
nop
lw r1,0(r2)
sub r4,r1,r5
and r6,r1,r7
or r8,r1,r9
Finish:
trap 0
- Example to illustrate multiple data and structural hazards
;-------------------------------------------------------------------
; Example to illustrate data and structural hazards
;-------------------------------------------------------------------
main:
addf f1,f2,f3
multf f2,f4,f5
addf f3,f3,f4
multf f6,f6,f6
addf f1,f3,f5
addf f2,f3,f4
Finish:
trap 0