Wednesday, March 6, 2013

Computer Architecture Application: Pipelining and Memory Location


By Stephen Flynn
QHCusa.org-2013



Pipelining
 With computer technology many techniques are employed to speedup processes.  One such method is called pipelining.  As Brookshear (2012) observes, “…pipelining, which is the technique of allowing the steps in the machine cycle to overlap.  In particular, while one instruction is being executed, the next instruction can be fetched, which means that more than one instruction can be in ‘the pipe’ at any one time, each at a different stage of being processed” (p. 100).  What this form of parallelism does is increase throughput, or the total amount of operations that can be done in a given time period or exiting the pipeline; even though the execution time per instruction remains the same.  In many ways pipelining is like an automobile assembly line with many different stages of fabrication being carried out sequentially and overlapping with the goal of increasing production throughput. 

 Application Problem Variables Examples:
·       Wash time= 30 minutes

·       Dry time= 40 minutes

·       Iron time= 20 minutes

·       Task= 30 loads


With this information it will take (30 + 40 + 20) 90 minutes for one load and (90 minutes/load * 30 loads) 2700 minutes or (2700 minutes/60 minutes) 45 hours to complete all 30 loads. Figure-1 below represents the non-pipelined sequence.
Computer Architecture Application: Pipelining and Memory Location


With the same information above and using the Computer Architecture Tutorial provided by Prabhu (n.d.) at Iowa State University addressing basic issues in pipelining, I used the longest time period stage (drying) which is the slowest stage to calculate the time period  for pipelining as outlined in Figure-2.                             

Following the simple example provided in Prabhu’s (n.d.) tutorial, the time to execute 30 loads was equal to the number of un-pipelined stages multiplied by the slowest stage plus the slowest stage multiplied by the remaining pipelines which yielded (40 minutes * 3 stages) + (40 minutes * 29 pipelines).  The result is 1280 minutes or (1280 minutes/60 minutes) 21.33 hours.



Memory Location

With this section of the assignment I wrote a simple machine language program to compute the contents of memory locations X, Y, and Z.  The expression is A=X+Y-Z and the computer has two registers R1 and R2 for calculations.  In addition, the only command operations allowed are LOAD R, STORE R, ADD, SUB, SWAP and HALT.


Program Sequence:

LOAD R1, X (copy into R1 the value stored in memory location X)

LOAD R2, Y (copy into R2 the value stored in memory location Y)

ADD              (add the values of R1 and R2 and store result in R1)

LOAD R2, Z (copy into R2 the value stored in memory location Z)

SUB               (subtract the value of R2 from R1 and store result in R1)

STORE R1, A (copy value of R1 into memory location A)

HALT            (stop program execution)


In the following program two numbers are loaded into both registers from memory location X and Y respectively and in sequence. The two numbers are then added together with the result being stored in register one.  The next number from memory location Z is loaded into register two and is subtracted from register one with the result stored back into register one. Finally, the value of register one is copied into memory location A and the program is halted.  

With this program the expression A=X+Y-Z can be computed.  I did not use the SWAP command because I did not see any need for it and there were no conditions of R1 having to be loaded first with respect to the problem. 


Conclusion
The first section on pipelining with the Laundromat example yielded a savings in time with more throughput or work being accomplished in a shorter period compared to the non-pipeline sequence.  Referencing an example provided by Prabhu’s (n.d.) tutorial on pipelining, I calculated an execution time of 21.33 hours for all 30 loads.  This is a significant savings when compared to the 45 hours it takes to do all 30 loads without the use of pipelining.  When applied to the machine cycle of modern central processing units, execution of instruction sets or programs are considerably speed up. 

The second part of the application dealt with writing a small program with the use of a finite set of commands.  Using all the commands but one I believe I accomplished the goal of using a machine language program that would correctly represent the expression A=X+Y-Z.  My reason for not using the SWAP command was there was no qualifications in the problem about the order in which the registers must be filled.  In addition, I did not find any other information in Brookshear (2012) that would indicate I needed such a command to perform the operations in machine language that would correctly express the statement A=X+Y-Z.

References:

Brookshear, J.G. (2012). Introduction to Computer Science. (11th ed.). New York: Addison-Wesley

          



No comments:

Post a Comment