Question

In: Computer Science

1. Assume we have 8 registers, R0~R7, and we have a pipeline of 6 stages: Instruction...

1. Assume we have 8 registers, R0~R7, and we have a pipeline of 6 stages:

Instruction Fetch (IF), Instruction Issue (II), Operands Fetch (OF), Execution (EX), Write Back (WB), and Commitment (CO). Each stage needs exactly 1 cycle to finish its work.

Also assume that the pipeline supports forwarding, which means the result of WB can be forwarded to OF.

Given the following piece of instructions:

R1 = R0 + R2

R3 = R4 + R5

R6 = R1 + R3

R0 = R2 + R7

  1. Identify all the data dependencies and their types.
  1. Assume we run the instructions in the 6 stage pipeline that supports forwarding, register renaming, and out-of-order execution. Show which of the registers should be renamed, and show the new order of the instructions.
  1. How many cycles do we need if we run the instructions in the 6 stage pipeline that supports forwarding, register renaming, and out-of-order execution?


    2. C Programming Language was developed in 1970’s, but why the classic 1980’s arcade game “Donkey Kong” was still written in an assembly language?

Solutions

Expert Solution

Multiple questions asked in a single post, Solution for the first problem is provided below, please comment if any doubts:

1.

i)

  • The data decencies are a result of mixed use registers in a sequence of instruction such that their appearances in various instruction make it dependable on another instruction.
  • The dependencies in the given instruction sequence are:
    1. There is a dependency between first and third instruction
      • Here R1 resister is used in both the instructions.
      • It is of type Read-after-Write
    2. There is a dependency between second and third instruction
      • Here R3 resister is used in both the instructions.
      • It is of type Read-after-Write
    3. There is a dependency between first and fourth instruction
      • Here R0 resister is used in both the instructions.
      • It is of type Write-after-read

ii)

  • The register renaming and out-of-order execution can be used to reduce the dependency in nearer instruction so as to increase the efficiency in pipelined execution.
  • The given instruction set is:
    • R1 = R0 + R2
    • R3 = R4 + R5
    • R6 = R1 + R3
    • R0 = R2 + R7
  • The resister R0 in the first instruction can be renamed as R1 since there is a write after read dependency between first and fourth instruction then reordering of third and fourth instruction can be done, the modified instruction set is shown below:
    • R1 = R1 + R2
    • R3 = R4 + R5
    • R0 = R2 + R7
    • R6 = R1 + R3
  • The pipeline can be depicted as given below:

Instruction

1

2

3

4

5

6

7

8

9

R1 = R1 + R2

IF

II

OF

EX

WB

CO

R3 = R4 + R5

IF

II

OF

EX

WB

CO

R0 = R2 + R7

IF

II

OF

EX

WB

CO

R6 = R1 + R3

IF

II

OF

EX

WB

CO

Number of cycles required in the pipelined execution is 9.


Related Solutions

Assume you have a superscalar CPU with in-order issue and in-order instructions that uses 8 registers...
Assume you have a superscalar CPU with in-order issue and in-order instructions that uses 8 registers (R0-R7). The usual rules include: up to two instructions can be issued in one cycle; instructions have to complete in the order they are issued; an instruction attempting to write to a register that is being read by any incomplete instruction cannot be issued until the incomplete instruction completes; any instruction attempting to read a register that is being written to by any incomplete...
Example: A 3-address computer has 40 instructions, 16 Registers, and 256KB memory. Assume each instruction has...
Example: A 3-address computer has 40 instructions, 16 Registers, and 256KB memory. Assume each instruction has three operands. Two registers and the third operand is a direct address location of a memory. Find minimum size of PC, MAR, MDR, IR. Solution: OPCODE R1, R2, address OPCODE is 6 bits since 2^6>40 Register field is 4 bits since 2^4 =16 Memory field is 18 bits since 2^18=256K Instruction length =6+4+4+18=32 bits MDR=32 bits IR=32 bits MAR=18 PC=18 Please explain
We assume a superscalar pipeline capable of fetching and decoding two instructions at a time, having...
We assume a superscalar pipeline capable of fetching and decoding two instructions at a time, having two separate functional units (e.g., one integer arithmetic and one floating-point arithmetic), and having two instances of the write-back pipeline stage. Assume the following constraints on a six-instruction code fragment: Inst-1 is a floating point operation Inst-2 requires two cycles to execute and depends on output of Inst-1 Inst-3 and Inst-4 conflict for the same functional unit. Inst-3 and Inst-4 are floating point operations....
Assume that the registers have the following values (all in hex) and that CS= 1000, DS...
Assume that the registers have the following values (all in hex) and that CS= 1000, DS = 2000, SS=3000, SI=4000, DI = 5000, BX=6080, BP= 7000, AX=25FF, CX=8791, and DX=1299. Calculate the physical address of the memory where the operand is stored and the contents of the memory locations in each of the addressing examples. a) MOV [SI], AL b) MOV [SI+BX+8], AH c) MOV [BX]+300, DX Now Examine the status of the CF, PF, AF, ZF, and SF if...
5. (20%) Suppose we have an array int a [8] = {1, 2, 3, 5, 6};...
5. (20%) Suppose we have an array int a [8] = {1, 2, 3, 5, 6}; and we also have a linked list L of 5 entries 1 -> 2 -> 3 -> 5 -> 6, where 1 is the first in the linked list L, followed by 2 etc. We want to put a new item 4 between 3 and 5 in the array a and in the linked list L (a) Explain in plain English how you do...
1- Assume that the state of the 8086 registers and memory just prior to the execution...
1- Assume that the state of the 8086 registers and memory just prior to the execution of each instruction is given as below: (AX) = 0010 H (BX) = 0020 H (CX) = 0030 H (DX) = 0040 H (SI) = 0100 H (DI) = 0200 H (CF) = 1 (DS:100H) = 10 H (DS:101H) = 00 H (DS:120H) = FF H (DS:121H) = FF H (DS:130H) = 08 H (DS:131H) = 00 H (DS:150H) = 02 H (DS:151H) =...
Assume we have a society with 1 producer and 1 consumer and we are looking at...
Assume we have a society with 1 producer and 1 consumer and we are looking at the market for coconuts. Let us simplify further and assume that the producer can harvest only 1 coconut with a marginal cost of $5. The marginal benefit to the consumer for the coconut is $10. From question b and onwards, assume the two economic agents agree to a price of $9 for the coconut. What is the maximum possible price for these two agents...
1. Assume we roll 6 dice. What is the probability that the roll contains: a. 6...
1. Assume we roll 6 dice. What is the probability that the roll contains: a. 6 of the same number b. 3 of one number, 2 of a second number, and 1 non-matching number c. 3 pairs of different numbers
Assume that we have 3 Stocks A, B & C. A B C Expected return 8%...
Assume that we have 3 Stocks A, B & C. A B C Expected return 8% 12% 6% Variance 0.012 0.028 0.009 If the covariance between stock A & B return is equal to 0.009159, stock A & C return is equal to -0.005146 and stock B & C return 0.01572 Required Calculate the Standard Deviation for stock A, B & C. which stock is risky and why? Calculate the correlation between every two stocks. What is the indication of...
Suppose we have N = 6 values from a population. These values are 4, 8, 0,...
Suppose we have N = 6 values from a population. These values are 4, 8, 0, 10, 14 and 6. Let μ and σ denote the population mean and population standard deviation of these six values, respectively. (a) What are the values of μ and σ, respectively? μ = 4.8580; σ = 7 μ = 7; σ = 4.8580 μ = 7; σ = 4.4347 μ = 7; σ = 19.6667 μ = 7; σ = 23.6 (b) What percentage...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT