cosc 3330/6308 solutions to first problem set

46
COSC 3330/6308 Solutions to First Problem Set Jehan-François Pâris September 2012

Upload: devlin

Post on 06-Feb-2016

25 views

Category:

Documents


0 download

DESCRIPTION

COSC 3330/6308 Solutions to First Problem Set. Jehan-François Pâris September 2012. First problem (I). A program consists of two parts, namely One part is purely sequential and takes 64 s to complete Another part takes 1,024 s when run on a uniprocessor architecture - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: COSC 3330/6308 Solutions to First Problem Set

COSC 3330/6308Solutions to

First Problem Set

Jehan-François PârisSeptember 2012

Page 2: COSC 3330/6308 Solutions to First Problem Set

First problem (I)

A program consists of two parts, namely– One part is purely sequential and takes 64 s to

complete – Another part takes 1,024 s when run on a

uniprocessor architectureCan be easily decomposed into two or more

parallel tasksSpeedup would be proportional to the number

of tasks executing in parallel.

Page 3: COSC 3330/6308 Solutions to First Problem Set

First problem (II)

What would be the speedups that the program would achieve if it was to run on computers with 2, 4, 8, 16, and 32 processors?

What would be the maximum speedup that the program would achieve if it was to run on a computer with an unlimited number of processors?

Page 4: COSC 3330/6308 Solutions to First Problem Set

Answer (I)

Will use Amdahl's law

in

on

TTTT

Speedup

Page 5: COSC 3330/6308 Solutions to First Problem Set

Answer (II)

Sequential Part (s)

Number of Proc.

Other Part (s)

Total (s)

Speedup

64 1 1,024 1,088 NA

64 2 512 576 1.889

64 4 256 320 3.400

64 8 128 192 5.667

64 16 64 128 8.500

64 32 32 96 11.333

64 infinity 0 64 17.000

Page 6: COSC 3330/6308 Solutions to First Problem Set

Second problem

Simplify the two following logical expressions:

– ABC'D' + AB'D' + ACD + CD

– (A BC) (B + A)

using both algebra and Karnaugh maps.

Page 7: COSC 3330/6308 Solutions to First Problem Set

First expression (I)

ABC'D' + AB'D' + ACD + CD =

ABC'D' + AB'D' + CD =

ABC'D' + AB'D' + AB'C'D' + CD =

AC'D' + AB'D' + CD

Page 8: COSC 3330/6308 Solutions to First Problem Set

First expression (II)

C'D' C'D CD CD'

A’B’ 0 0 1 0

A’B 0 0 1 0

AB 1 0 1 0

AB’ 1 0 1 1

AC'D' + AB'D' +CD

Page 9: COSC 3330/6308 Solutions to First Problem Set

Second expression (I)

(A BC) (B + A) =

(A(BC)' + A'BC) (A + B) =

(AB' + AC' + A'BC) (A + B) =

AB' + AC' + A'BC + ABC' =

AB' +AC' +A'BC

Page 10: COSC 3330/6308 Solutions to First Problem Set

Second expression (II)

A B C BC A BC A+ B PRODUCT

F F F F F F F

F F T F F F F

F T F F F T F

F T T T T T T A'BC

T F F F T T T AB'C'

T F T F T T T AB'C

T T F F T T T ABC'

T T T T F T F

Page 11: COSC 3330/6308 Solutions to First Problem Set

Second expression (III)

B'C' B'C BC BC'

A’ 0 0 1 0

A 1 1 0 1

AB' + AC' +A'BC

Page 12: COSC 3330/6308 Solutions to First Problem Set

Second expression (IV)

A'B' A'B AB AB'

C’ 0 0 1 1

C 0 1 0 1

AB' + AC' +A'BC

Page 13: COSC 3330/6308 Solutions to First Problem Set

Third problem

Simplify the expression

– (ABC)' (A + DE)' (A BC) (B + E)

and convert it to a form that can be represented using a programmable logic array.

Page 14: COSC 3330/6308 Solutions to First Problem Set

Answer (I)

(ABC)' (A + DE)' (A BC) (B + E) Let us do it in two parts

– (ABC)' (A + DE)' =(A' + B' + C')(A'(DE)') =(A' + B' + C')(A'(D' +E') =A'(D' +E') + A'B'(D' +E') +A’C’(D’ +E’) =A'D' +A'E'

Page 15: COSC 3330/6308 Solutions to First Problem Set

Answer (II)

The second part is – (A BC) (B + E) =

(A(BC)' + A'BC)(B + E) =(AB' + AC' + A'BC)(B + E) =ABC' + A'BC + AB'E + AC'E + A'BCE

Page 16: COSC 3330/6308 Solutions to First Problem Set

Answer (III)

The product is– (A'D' +A'E')

(ABC' + A'BC + AB'E + AC'E + A'BCE) =A'BCD' + A'BCE' + A'BCD'E = A'BCD' + A'BCE'

Sum of products can be represented by a PLA

I checked the answer on a spreadsheetwith 25 rows and 14 columns

Page 17: COSC 3330/6308 Solutions to First Problem Set

Fourth problem

Implement the double implication operation:– A B = AB +A’B’

using only NAND gates.

Page 18: COSC 3330/6308 Solutions to First Problem Set

NAND gates

A nand B = (AB)' = A' + B'

nand (A) nand nand(B) = (A'B')' = A + B

nand(A nand B) = (AB)'' = AB

nand(nand(A) nand nand(B)) =(A' B')'' = A'B'

Page 19: COSC 3330/6308 Solutions to First Problem Set

Answer

AB

A'+B'

A

B

A+B((A + B)(A' + B')' =(A + B)' + (A' + B')' =A'B' +AB

I started with a solution havingmore NANDs and simplified it

Page 20: COSC 3330/6308 Solutions to First Problem Set

Fifth problem

Build a regular D flip-flop using an R’S’ latch, that is, an RS latch with inverted values for R and S, and as few NOR gates as possible.

Page 21: COSC 3330/6308 Solutions to First Problem Set

NOR gates

A nor B = (A + B)' = A' B'

nor (A) nor nor(B) = (A' + B')' = AB

nor(A nor B) = (A+B)'' = A + B

nor(nor(A) nor nor(B)) =(A' + B')'' = A' + B'

Page 22: COSC 3330/6308 Solutions to First Problem Set

From S'R' latch to D flip-flop

S'R' has three inputs– S' sets latch when S' = 0

and clock = 1– R' resets latch when R' = 0

and clock = 1 D flip-flop

– Stores a 1 at clock transition when input is 1– Stores a 0 at clock transition when input is 0

S'

R'

Q'

Q

Clock

Page 23: COSC 3330/6308 Solutions to First Problem Set

D flip-flop using an S-R latch

X

Clock

S

R

Q

Q'

Clock

Page 24: COSC 3330/6308 Solutions to First Problem Set

D flip-flop using an S'-R' latch

X

Clock

S'

R'

Q

Q'

Clock

Page 25: COSC 3330/6308 Solutions to First Problem Set

Introducing NORs

X

Clock

S'

R'

Q

Q'

Clock

(Clock+Clock')'=ClockClock'

Page 26: COSC 3330/6308 Solutions to First Problem Set

Note

The solution is fairly simple because we assumed that the R'S' latch had a clock entry

Solution for R'S' latch without clock input is more complex

Q

Q’R’

S’

Page 27: COSC 3330/6308 Solutions to First Problem Set

Sixth problem (I)

Build a synchronous sequential circuit with– Two inputs, respectively named P—for

plus—and M—for minus– Two outputs respectively named O—for

overflow—and U—for underflow

Page 28: COSC 3330/6308 Solutions to First Problem Set

Sixth problem (II)

The transitions are:

Page 29: COSC 3330/6308 Solutions to First Problem Set

Answer

Eight states– Three flip-flops X Y Z

Will consider separately– How P inputs affect X, Y, Z– How M inputs affect X, Y, Z– When counters outputs O and U

Page 30: COSC 3330/6308 Solutions to First Problem Set

How P inputs affect Z

Y'Z' Y'Z YZ YZ'

P'X' 0 1 1 0

P'X 0 1 1 0

PX 1 0 0 1

PX’ 1 0 0 1

Page 31: COSC 3330/6308 Solutions to First Problem Set

Solution

Z = P'Z + PZ' – Will use a T flip-flop triggered by P

Page 32: COSC 3330/6308 Solutions to First Problem Set

How P inputs affect Y

Y'Z' Y'Z YZ YZ'

P'X' 0 0 1 1

P'X 0 0 1 1

PX 0 1 0 1

PX’ 0 1 0 1

Page 33: COSC 3330/6308 Solutions to First Problem Set

Solution

Y = P'Y + PYZ' + PY'Z – Will use a T flip-flop triggered by PZ

Page 34: COSC 3330/6308 Solutions to First Problem Set

How P inputs affect X

Y'Z' Y'Z YZ YZ'

P'X' 0 0 0 0

P'X 1 1 1 1

PX 1 1 0 1

PX’ 0 0 1 0

Page 35: COSC 3330/6308 Solutions to First Problem Set

Solution

X = P'X + PXY' + PXZ' + PX'YZ – Will use a T flip-flop triggered by PYZ

Page 36: COSC 3330/6308 Solutions to First Problem Set

How M inputs affect Z

Y'Z' Y'Z YZ YZ'

M'X' 0 1 1 0

M'X 0 1 1 0

MX 1 0 0 1

MX’ 1 0 0 1

Page 37: COSC 3330/6308 Solutions to First Problem Set

Solution

Z = M'Z + MZ' – Will use a T flip-flop triggered by M

Page 38: COSC 3330/6308 Solutions to First Problem Set

How M inputs affect Y

Y'Z' Y'Z YZ YZ'

M'X' 0 0 1 1

M'X 0 0 1 1

MX 1 0 1 0

MX’ 1 0 1 0

Page 39: COSC 3330/6308 Solutions to First Problem Set

Solution

Y = M'Y + MYZ + M Y'Z' – Will use a T flip-flop triggered by MZ'

Page 40: COSC 3330/6308 Solutions to First Problem Set

How M inputs affect X

Y'Z' Y'Z YZ YZ'

M'X' 0 0 0 0

M'X 1 1 1 1

MX 0 1 1 1

MX’ 1 0 0 0

Page 41: COSC 3330/6308 Solutions to First Problem Set

Solution

X = M'X + MXY + MXZ +MX'Y'Z' – Will use a T flip-flop triggered by MY'Z'

Page 42: COSC 3330/6308 Solutions to First Problem Set

How P inputs affect O

Y'Z' Y'Z YZ YZ'

P'X' 0 0 0 0

P'X 0 0 0 0

PX 0 0 1 0

PX’ 1 0 0 0

Page 43: COSC 3330/6308 Solutions to First Problem Set

Solution

O = PXYZ

Page 44: COSC 3330/6308 Solutions to First Problem Set

How M inputs affect U

Y'Z' Y'Z YZ YZ'

M'X' 0 0 0 0

M'X 0 0 0 0

MX 0 0 0 0

MX’ 1 0 0 0

Page 45: COSC 3330/6308 Solutions to First Problem Set

Solution

U = MX'Y'Z' – Will use a T flip-flop triggered by MY'Z'

Page 46: COSC 3330/6308 Solutions to First Problem Set

Summary

Flip-flops– Z: T flip-flop triggered by P + M– Y: T flip-flop triggered by PZ + MZ'– X: T flip-flop triggered by PYZ + MY'Z'

Outputs– O = PXYZ– U = MX'Y'Z'