logo

Crowdly

Browser

Додати до Chrome

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

Шукаєте відповіді та рішення тестів для CA & OS (Computer Architecture) - EFREI - Fall 2026? Перегляньте нашу велику колекцію перевірених відповідей для CA & OS (Computer Architecture) - EFREI - Fall 2026 в moodle.lab.ii.agh.edu.pl.

Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!

Observation of the pipelined execution of a simple program

In this section you will try to evaluate the impact of the pipelined execution of the program on its performance.

Prepare and load the test program (copy & paste following code):

      .data

A:    .word 10

B:    .word 8

C:    .word 0

    

      .text

main:    ld r4,A(r0)

         ld r5,B(r0)

         dadd r3,r4,r5

         sd r3,C(r0)

         syscall 0

In menu “Configure” check and enable the option “Enable forwarding”.

Execute the program in single cycle instruction mode. Observe the pipeline window and the clock cycle diagram.

What is the number of clock cycles (n) used for the execution of  this program that appears in the "Statistic" window.

0%
100%
0%
0%
Переглянути це питання

In this section, you will evaluate how long it takes to execute different types of the instructions of the MIPS computer.

Number of clock cycles for dadd instruction (integer addition)

Load and execute in step mode following program:

        .text

main:    dadd

r1,r0,r1 ; r1 = r0+r1 

         nop

 

       halt

As a result of the execution you should receive clock cycle diagram of the execution similar to this on the image:

Clock cycle diagram foo dadd insdtruction.

Analyze this clock cycle diagram of execution of the program and answer the question: 

How many clock cycles does the execution of the instruction dadd r1,r0,r1 take (each box in clock cycle diagram represents one clock tick )?

❌
❌
❌
✅
Переглянути це питання

The user program consists of 25 instructions, each of which is executed

in one clock cycle, and 5 instructions, each of which executes in 5 clock

cycles.

The average cycles per

instruction (

CPI) for that program is:

❌
❌
✅
❌
Переглянути це питання

In this section, you will evaluate how long it takes to execute different types of the instructions of the MIPS computer.

Number of clock cycles for dadd instruction (integer addition)

Load and execute in step mode following program:

        .text

main:    dadd

r1,r0,r1 ; r1 = r0+r1 

         nop

 

       halt

As a result of the execution you should receive clock cycle diagram of the execution similar to this on the image:

Clock cycle diagram foo dadd insdtruction.

Analyze this clock cycle diagram of execution of the program and answer the question: 

How many clock cycles does the execution of the instruction dadd r1,r0,r1 take (each box in clock cycle diagram represents one clock tick )?

❌
❌
❌
✅
Переглянути це питання
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.

    beq r9, r0, end_loop    ; branch if equal -> if (r9 == (r0=0)) go to 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)

    syscall 0

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) ?

❌
✅
❌
❌
Переглянути це питання

Which instruction is executed next after beq r9, r0, end_loop (enters in the EX phase on clock cycle diagram) ??

❌
❌
✅
❌
Переглянути це питання
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:    

    LDC1 f2,A(r0)

    LDC1 f3,B(r0)

    LDC1 f4,C(r0)

    LDC1 f5,D(r0)

    LDC1 f6,E(r0)

    

    add.d f2,f2,f3

    sub.d f2,f2,f4

    mul.d f4,f5,f6

    

    SDC1 f2,res(r0)

    syscall 0

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.

❌
❌
❌
❌
✅
Переглянути це питання

How many instructions were executed?

Переглянути це питання
R-A-W hazard

R-A-W hazard is one of the most common problems related to the pipelined and parallel instruction execution by the processor. This type of hazard occurs when the later instruction (j) requires  the results of the previous instruction (i) to be executed, but the execution of the earlier instruction (i) has not finished yet (the completion of the execution – the end of the WB phase of the instruction cycle in MIPS). If the program execution is not interfered with, it may happen that the later instruction (j) will perform operations on an incorrect argument - the correct value of the argument  for the instruction (j) is not available before the execution of the earlier instruction (i) is completed. The occurrence of this type of disturbance can be observed during the execution of the example program:

;MIPS64 RAW hazard example

    .data

A:    .word 2

B:    .word 3

C:    .word 7

D:    .word 0

    

    .text

main:    ld r1,A(r0)

    ld r2,B(r0)

    dadd r3,r1,r2

    sw r3,C(r0)

    lw r4,C(r0)

    dadd r5,r1,r4

    sw r5,D(r0)

    syscall 0

Analyze that program and calculate how many clock cycles are needed to execute it on the sequential processor. Let’s assume that the execution of any instruction takes 5 clock cycles.

How many clock cycles are needed to execute this program on a sequential processor?

Переглянути це питання

Calculate the speedup in relation to the pipelined execution of the program with the DF mechanism disabled.

speedupDF = CPIpip / CPIpipDF

What is the speedup value?

Переглянути це питання

Хочете миттєвий доступ до всіх перевірених відповідей на moodle.lab.ii.agh.edu.pl?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome