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!
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): .dataA: .word 10B: .word 8C: .word 0 .textmain: 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.
In this section, you will evaluate how long it takes to execute different types of the instructions of the MIPS computer.
Load and execute in step mode following program:
main: dadd r1,r0,r1 ; r1 = r0+r1 halt .text nop
As a result of the execution you should receive clock cycle diagram of the execution similar to this on the image:
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 (
In this section, you will evaluate how long it takes to execute different types of the instructions of the MIPS computer.
Load and execute in step mode following program:
main: dadd r1,r0,r1 ; r1 = r0+r1 halt .text nop
As a result of the execution you should receive clock cycle diagram of the execution similar to this on the image:
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 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 .datan: .word 3res: .word 0 .textmain: 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_loopend_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) ??
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 .dataA: .double 10.0B: .double 5.0C: .double 3.5D: .double 1.0E: .double 3.14.0res: .double 0.0 .textmain: 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 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 .dataA: .word 2B: .word 3C: .word 7D: .word 0 .textmain: 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?