mini project- dual processor computation

46
Mini Project – Dual Processor Computation Author: University of Hertfordshire Date created: Date revised: 2009 Abstract The following resources come from the 2009/10 BEng in Digital Systems and Computer Engineering (course number 2ELE0065) from the University of Hertfordshire. All the mini projects are designed as level two modules of the undergraduate programmes. The objectives of this module are to demonstrate, within an embedded development environment: •Processor – to – processor communication •Multiple processors to perform one computation task using parallel processing This project requires the establishment of a communication protocol between two 68000-based microcomputer systems. Using ‘C’, students will write software to control all aspects of complex data transfer system, demonstrating knowledge of handshaking, transmission protocols, transmission overhead, bandwidth, memory addressing. Students will then demonstrate and analyse parallel processing of a mathematical problem using two processors. This project requires two students working as a team. In addition to the resources found below there are supporting documents which should be used in combination with this resource. Please see: Mini Projects - Introductory presentation. Mini Projects - E-Log. Mini Projects - Staff & Student Guide. Mini Projects - Standard Grading Criteria. Mini Projects - Reflection. You will also need the ‘Mini Project- Dual Processor Computation’ text document. © University of Hertfordshire 2009 This work is licensed under a Creative Commons Attribution 2.0 License .

DESCRIPTION

The following resources come from the 2009/10 BEng in Digital Systems and Computer Engineering (course number 2ELE0065) from the University of Hertfordshire. All the mini projects are designed as level two modules of the undergraduate programmes. The objectives of this module are to demonstrate, within an embedded development environment: Processor – to – processor communication Multiple processors to perform one computation task using parallel processing This project requires the establishment of a communication protocol between two 68000-based microcomputer systems. Using ‘C’, students will write software to control all aspects of complex data transfer system, demonstrating knowledge of handshaking, transmission protocols, transmission overhead, bandwidth, memory addressing. Students will then demonstrate and analyse parallel processing of a mathematical problem using two processors. This project requires two students working as a team.

TRANSCRIPT

Page 1: Mini Project- Dual Processor Computation

Mini Project – Dual Processor ComputationAuthor: University of HertfordshireDate created:Date revised: 2009

AbstractThe following resources come from the 2009/10 BEng in Digital Systems and Computer Engineering (course number 2ELE0065) from the University of Hertfordshire. All the mini projects are designed as level two modules of the undergraduate programmes.

The objectives of this module are to demonstrate, within an embedded development environment: •Processor – to – processor communication•Multiple processors to perform one computation task using parallel processing

This project requires the establishment of a communication protocol between two 68000-based microcomputer systems. Using ‘C’, students will write software to control all aspects of complex data transfer system, demonstrating knowledge of handshaking, transmission protocols, transmission overhead, bandwidth, memory addressing. Students will then demonstrate and analyse parallel processing of a mathematical problem using two processors. This project requires two students working as a team.

In addition to the resources found below there are supporting documents which should be used in combination with this resource. Please see:Mini Projects - Introductory presentation. Mini Projects - E-Log.Mini Projects - Staff & Student Guide.Mini Projects - Standard Grading Criteria.Mini Projects - Reflection.

You will also need the ‘Mini Project- Dual Processor Computation’ text document.

© University of Hertfordshire 2009 This work is licensed under a Creative Commons Attribution 2.0 License.

Page 2: Mini Project- Dual Processor Computation

Contents• Lecture Overview………………………………………………………………………….3

• Day 1- Communication Between Two Processors…………………………………….4– The Problem– Resources– Asynchronous Communication– Asynchronous Communication with Only Two Handshaking Signals– Definition of Master/Slave– The handshaking signals ACK and STROBE– Preparation

• Day 2- Dual Processor Computation…………………………………………………..17– The Problem– Resources– Bandwidth Calculation– Unit of transfer– Asynchronous Communication with Only Two Handshaking Signals– Handshake Cycle Time– Bandwidth Measurement for this system– An example calculation– If one processor does the calculation– Two processors sharing the calculation– Time saving in first computation– Repeated Computation – see improved time saving during 1s...– Simpler notation: Normalise using tc– Normalised values for example– Method for timing each part of the calculation– Preparation

• Background Reading……………………………………………………………………42

• Reflection…………………………………………………………………………………43

• Remember ………………………………………………………………………………..45

• Credits…………………………………………………………………………………….46

Page 3: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Today’s Lecture

• The problem– Breakdown to each day

• Resources– List for each day

• Preparatory work– Remind you for each day

• Reflection process– Reflect on each day

Page 4: Mini Project- Dual Processor Computation

Day 1

Communication between Two Processors

Page 5: Mini Project- Dual Processor Computation

BH Dual Processor Computation

The Problem

To establish Master-to-Slave asynchronous data transfer between two 68000 processors, using one 8-bit port and two additional control lines only.

• between two 68000 processors

• Master-to-Slave

• asynchronous

• using one 8-bit port

• two additional control only

Page 6: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Resources

• I/O Expansion board

• Coloured wires

Page 7: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Asynchronous Communication

Addr

AS

Data

DTACK

1. AS signals valid address available on address bus – start of transfer

2. DTACK is asserted to signal that the data has been stored

4. ACK is negated to signal ready for next transfer

3. AS is negated to signal transfer complete

Addr

AS

Data

DTACK

Master Slave

Page 8: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Asynchronous Communication with Only Two Handshaking Signals

Master

Strobe

Slave

ACK

I have data for you!

Thanks, I’ve stored it!

I might send some more

Ok, I’m ready

Page 9: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Definition of Master/Slave

• Only the Master can initiate a data transfer

• The Slave can only respond

Page 10: Mini Project- Dual Processor Computation

BH Dual Processor Computation

The handshaking signals ACK and STROBE

• MasterControls STROBE

• Slave Controls ACK

Page 11: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Preparation – Order of attack

• Plan your day (Friday)

• Break down the problem into steps and decide:

• How to start, • what to do next… • etc…

Page 12: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Preparation – Resource map

Variable name

Possible states

Input or Output

Allocated port pin

Page 13: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Preparation - Algorithms

• To transmit a single byte to the Slave

• To receive a single byte from the Master

Page 14: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Modular Structure

main

function 1 function 2 function 3

function 4

function 5

function 6

This is only an example !

Page 15: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Preparation – message format

You must define a message format for data block transfer.

• Define a message header which contains:

– An address where the first byte will be stored in the slave’s memory (subsequent bytes will be stored contiguously)

– The number of bytes in the data block (max 256)

Page 16: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Preparation Summary

• Create Resource Map:• Define & allocate handshaking signals• Define i/o port

• Write Algorithms:• To transfer a single byte from Master to Slave

• Define message format

Page 17: Mini Project- Dual Processor Computation

Day 2

Dual Processor Computation

Page 18: Mini Project- Dual Processor Computation

BH Dual Processor Computation

The Problem

To establish the basic requirements for engaging a number of processors in solving a common problem.

A simultaneous equation with obvious parallelism will be used to develop the necessary functions in ‘C’.

A state-time diagram will be developed to summarise the efficiency of the proposed solution.

Page 19: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Resources

• I/O Expansion board

• Coloured wires

Page 20: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Bandwidth Calculation

This is the maximum number of bits that can be transferred in a second.

Units: Mbits/second

How much data is transferred each during one complete handshaking cycle?

Page 21: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Unit of transfer

In our system, how much data is transferred during one handshaking cycle?

1 byte

If we continuously transmit bytes, we can measure the time taken to transfer a byte…..

Page 22: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Asynchronous Communication with Only Two Handshaking Signals

Master

Strobe

Slave

ACK

I have data for you!

Thanks, I’ve stored it!

I might send some more

Ok, I’m ready

Page 23: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Handshake Cycle Time

Strobe

ack

time

Unit transfer time

1st cycle 2nd cycle

(µs)

Page 24: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Bandwidth Measurement for this system

Bandwidth = 8bits/ 20µs

= 0.4Mbits/sec

Page 25: Mini Project- Dual Processor Computation

BH Dual Processor Computation

An example calculation

• Calculation of ‘z’

z = x / y

x = (a * b) / e

y = c + d

Page 26: Mini Project- Dual Processor Computation

BH Dual Processor Computation

If one processor does the calculation

x = a*b/e y = c+d z = x/y

This is how long it would take a single processor to calculate z

Processor 1

time

Page 27: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Two processors sharing the calculation

Processor 1

Processor 2

x = a*b/e y = c+d z = x/y

time

Page 28: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Two processors sharing the calculation

Processor 1 x = a*b/e

y = c+d

z = x/y

time to transfer data to processor 1

time

Processor 2

tc

Page 29: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Two processors sharing the calculation

Processor 1

y = c+d

z = x/y

time

Processor 2

tcx = a*b/e

Page 30: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Two processors sharing a calculation

time

x = a*b/e y = c+d z = x/y

Processor 1 x = a*b/e

y = c+d

z = x/y

Processor 2

tc

time saving over single processor

Page 31: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Two processors sharing a calculation

Processor 1 x = a*b/e

y = c+d

z = x/y

time

Processor 2

tc

Processor 1

x = a*b/e

y = c+d z = x/y

Processor 2

tc

time saving over single processor

Single processor

x = a*b/e y = c+d z = x/y

Page 32: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Time saving in first computation

Processor 1 tx

y = c+d

tz

time

Processor 2

tc

Processor 1

tx

y = c+d tz

Processor 2

tc

Single processor

ty

ty

time saving over single processor

tx ty tz

Page 33: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Repeated Computation – see improved time saving during 1st repetition of calculation

tx tc

tx

tztc

tx

tc

ty

tx tc

tz

tz tz

ty

ty ty

End of 1st calculation

tx tzSingle processor

ty

time saving over single processor

P1P2

P1P2

Page 34: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Simpler notation: Normalise using tc

To simplify the diagram, the calculation times can be described in units of tc.

To do this, just divide each time by the time for tc

eg:

if tx takes 7 times as long as tc then it will become:

tx/tc = 7

Page 35: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Normalised values for example

Assume, just for the sake of argument, that:

tc = 1

tx = 7

ty = 3

tz = 4

Page 36: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Repeated Computation – see improved time saving during 1st repetition of calculation

tx tc

tx

tztc

tx

tc

ty

tx tc

tz

tz tz

ty

ty ty

tx tzSingle processor

ty

P1P2

12

12

14

8

P1P2

Page 37: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Method for timing each part of the calculation

Write a probe function – just an output pin which is asserted by the processor when it starts a calculation and negated at the end.

This “probe” pin should be included in the resource map.

Calls to the probe function should be added to the code at the beginning and the end of the calculation (the probe function itself will of course increase the measured time)

Page 38: Mini Project- Dual Processor Computation

BH Dual Processor Computation

For this project, your level of preparationwill be assessed.

We will look at your logbook and the materials you have chosen to bring with you

Page 39: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Preparation – Resource map

Variable name

Possible states

Input or Output

Allocated port pin

Page 40: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Preparation - Algorithms

• Probe function

• Review receive/transmit single byte function and handshaking

Page 41: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Preparation Summary

• Create Resource Map:• Define & allocate handshaking signals• Define i/o port

• Write Algorithm:• Probe

• Review transmit/receive byte algorithms

Page 42: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Background Reading

• From previous modules:• 68000 architecture and C language programming• Useful C program template• Review related module lecture notes

• A general book on ‘C’ ( bring this to the lab too!!)

Page 43: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Reflection Cycle

Reflection

ObservationAction

Page 44: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Reflection• Would you break the problem down in the same way now?

• Did you spend enough time planning what you were going to do?

• What did you waste time on – what could you do to reduce the amount of time spent

• Do you think that you asked for too much help, or should you have asked for help sooner

• With hindsight, what preparation could you have done to help you make faster progress?

• Did you find the notes that you had made during preparation useful? – how could they be improved?

• Do you think that you could repeat the project in six months using only your logbook record as a reference.

Page 45: Mini Project- Dual Processor Computation

BH Dual Processor Computation

Remember

• Be methodical:

– Make progress in SMALL steps

– Document as you go (comments in code and diagrams, notes in logbook)

– Don’t go onto the next step until this one works FULLY and has been archived!!

Page 46: Mini Project- Dual Processor Computation

This resource was created by the University of Hertfordshire and released as an open educational resource through the Open Engineering Resources project of the HE Academy Engineering Subject Centre. The Open Engineering Resources project was funded by HEFCE and part of the JISC/HE Academy UKOER programme.

© University of Hertfordshire 2009

                

This work is licensed under a Creative Commons Attribution 2.0 License.

The name of the University of Hertfordshire, UH and the UH logo are the name and registered marks of the University of Hertfordshire. To the fullest extent permitted by law the University of Hertfordshire reserves all its rights in its name and marks which may not be used except with its written permission.

The JISC logo is licensed under the terms of the Creative Commons Attribution-Non-Commercial-No Derivative Works 2.0 UK: England & Wales Licence.  All reproductions must comply with the terms of that licence.

The HEA logo is owned by the Higher Education Academy Limited may be freely distributed and copied for educational purposes only, provided that appropriate acknowledgement is given to the Higher Education Academy as the copyright holder and original publisher.