logo

Crowdly

Browser

Add to Chrome

CA & OS (Computer Architecture) - EFREI - Fall 2026

Looking for CA & OS (Computer Architecture) - EFREI - Fall 2026 test answers and solutions? Browse our comprehensive collection of verified answers for CA & OS (Computer Architecture) - EFREI - Fall 2026 at moodle.lab.ii.agh.edu.pl.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

Control hazard

Control hazards are mainly related to the processor's execution of jump instructions (unconditional or conditional). To observe the behavior of the pipeline during the execution of jump instructions, the following program will be used:

;WinMIPS64 control hazard

; just simple for loop in MIPS asm

    .data

n:    .word 3

res:    .word 0

    

    .text

main:    

    xor r16,r16,r16    ; r16 = 0 loop counter

    xor r2,r2,r2    ; r2 = 0

    

    lw r17, n(r0) ; number of loop executions

    nop ; must be here to avoid RAW with next instr.

    

start_loop:    

    dsub r9, r16, r17 ; $t1= r9

    nop  ; must be here to avoid RAW with next instr.

    beqz r9, end_loop

    

    # code block

    daddi r2,r2,2

    dsub r2,r2,r0   ; r0 always contains 0

    daddi r16,r16,1 ; loop counter increment

    j start_loop

end_loop:    

    sw r2,res(r0)

    halt

Find the part of the clock cycle diagram that shows the first execution of the beqz r9, end_loop instruction. 

Analyze it and answer the questions.

Which instruction is fetched next (enters in the IF phase on clock cycle diagram) ?

❌
❌
✅
❌
View this question

Quelle instruction est exécutée ensuite  beqz r9, end_loop(entrée dans la phase EX sur le diagramme du cycle d'horloge) ?

0%
100%
0%
0%
View this question

Trouvez la partie du diagramme du cycle d'horloge qui illustre la dernière exécution de l' j start_loopinstruction. Analysez-la et répondez aux questions suivantes.

Quelle instruction est récupérée ensuite ?

0%
0%
100%
0%
View this question

Quelle instruction est exécutée ensuite beqz r9, end_loop(entrée dans la phase EX sur le diagramme du cycle d'horloge) ?

0%
0%
0%
100%
View this question

L'exécution de l'instruction indiquée dans la réponse à la question précédente  est-elle en cours ?

0%
100%
View this question

Si l'exécution de l'instruction est suspendue (la réponse à la question précédente était VRAIE ), comment expliquer cette suspension ?

View this question

L'exécution de l'instruction indiquée dans la réponse à la question précédente est-elle en cours ?

0%
100%
View this question

Si l'exécution de l'instruction est suspendue (la réponse à la question précédente était VRAIE), comment expliquer cette suspension ?

View this question

Analyze the program and try to evaluate the value of the res if the execution of the instruction that causes WAR stall was proceeded without waiting for the execution of the previous instruction to complete.

Calculated “wrong” res value:

View this question
W-A-R hazard

This type of hazard may occur when the latter instruction (j) stores the result of its execution in the resource (register or memory location) that earlier instruction (i) uses as their argument. The problem appears when the execution of earlier instruction (i) is delayed, and the latter instruction (j) is finished before earlier instruction (i) can take its argument. It may lead to a  wrong result of the execution instruction (i). The typical way to remove such a dependency is to delay the completion of the execution instruction (j) until the execution of instruction (i) is completed. 

To illustrate this problem, the following code will be used:

;WinMIPS64 WAR hazard example

    .data

A:    .double 10.0

B:    .double 5.0

C:    .double 3.5

D:    .double 1.0

E:    .double 3.14.0

res:    .double 0.0

    

    .text

main:    l.d f2,A(r0)

    l.d f3,B(r0)

    l.d f4,C(r0)

    l.d f5,D(r0)

    l.d f6,E(r0)

    

    add.d f2,f2,f3

    sub.d f2,f2,f4

    mul.d f4,f5,f6

    

    s.d f2,res(r0)

    halt

Enable data forwarding mechanism and execute the example program.

Analyze the clock cycle diagram and find the instruction that causes WAR stall.  

Mark the instruction that causes WAR stall.

❌
❌
❌
❌
✅
View this question

Want instant access to all verified answers on moodle.lab.ii.agh.edu.pl?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome