Home
Concepts
Classifications
Glossary Terms
References
Authors
Instruction Execution I-Unit Pipelining I-Unit Bypassing Die Size Technology Prediction
I-Unit Pipelining Overview I-Unit Pipelining Examples
Overview Non-Pipelining Example Pipelining Example I-Unit Pipelining Summary

I-Unit Pipelining - Overview

As an example of the benefits of pipelining, this section will demonstrate the execution of a real program sequence, with and without pipelining. The purpose of this sequence will be to calculate the value of "x" in the equation:
x = 2 ( a + b + 4 ) + 3 ( a + b + 6 )
Instructions from the S/370 instruction set will be used. An overview of the instructions used in this sample is available in the Instruction Execution section. For this example, the following are assumed:
  • The value of "a" is available as a 4 byte value starting at memory location 3000.
  • The value of "a" is 23 Hex.
  • The value of "b" is available as a 4 byte value starting at memory location 3004.
  • The value of "b" is 1C Hex.
  • The result of executing this sequence is to be stored as a 4 byte value starting at memory location 2000.
  • That the CPU obtains data from memory, a line at a time. For this example, a line is considered to be 32 consecutive bytes of memory, starting at an address that is evenly divisible by 32.
  • It takes 8 cycles to fetch a line from memory.
  • A multiplication takes 1 cycle per bit set in the multiplier to calculate the product. The source operands of a multiplication may be swapped.
The following machine code sequence will be used for the examples:
# Setup Base Registers
# Have operands located at 2000, 2004, and 3000. Need base registers with
# addresses within 4K of each of these addresses. Will setup GPR6 with a 
# base address of 2000 and GPR7 with a base address of 3000.
1000 41100FFF  # GPR1 <- FFF
1004 41101001  # GPR1 <- GPR1 + 1 (GPR1 <- 1000)
1008 41611000  # GPR6 <- GPR1 + GPR1 (GPR8 + 2000)
100C 41761000  # GPR7 <- GPR6 + GPR1 (GPR7 <- 3000)
# Calculate Value of a + b + 4
# Place Result in GPR1
1010 58107000  # GPR1 <- a
1014 58207004  # GPR2 <- b
1018 41300004  # GPR3 <- 4
101C 1A12      # GPR1 <- a + b (GPR1 = GPR1 + GPR2)
101E 1A13      # GPR1 <- a + b + 4 (GPR1 = GPR1 + GPR3)
# Calculate Value of 2(a + b + 4)
# Place Result in GPR3. Actually store the result of the multiply
# in the register pair starting in GPR2. This will cause the least 
# significant 4 bytes of the product to be stored in GPR3.
1020 41200002  # GPR3   <- 2
1024 1C21      # GPR2, 3 <- GPR2 * GPR1
# Calculate Value of a + b + 6
# Will calculate this value by adding 2 to the previously calculated
# value of a + b + 4
1026 41101002  # GPR1 <- (a + b + 4) + 2 (GPR1 = GPR1 + 2)
# Calculate Value of 3(a + b + 6)
# Write Result In R5
102A 41400003  # GPR4   <- 3
102E 1C41      # GPR4, 5 <- GPR4 * GPR1
# Add 2(a + b + 4) and 3(a + b + c) and store the answer at x
1030 1A35      # GPR3 <- GPR3 + GPR5
1032 50306000  # GPR3 -> x
Previous Home Next