1 of 35

2 of 35

Quantitative Analysis and Digital Logic

3 of 35

What is Performance?

  • How fast can the computer run my program? (latency)
  • How many requests can my server respond to per hour? (throughput)
  • How long will my phone’s battery last? (energy)
  • Is my gaming laptop going to double as a space heater? (thermal)

For now, when we say performance, we mean response time or execution time.

4 of 35

Important Factors

CPU Execution Time

Seconds CPU spent executing a sequence of instructions

Instruction Count

Number of instructions executed

Cycles Per Instruction (CPI)

Average number of clock cycles required per instruction

Clock Cycle Time

Seconds per clock cycle (reciprocal of clock frequency)

5 of 35

How Are These Factors Related?

6 of 35

How Are These Factors Related?

7 of 35

Sanity Check

# instructions

(cycles/instruction)

(seconds/cycle)

8 of 35

Processor

Clock Rate

CPI

P1

3.0 GHz

1.5

P2

2.5 GHz

1.0

P3

4.0 GHz

2.2

9 of 35

Note that the reciprocal of cycles per instruction is instructions per cycle.

(cycles / second)*(instructions / cycle) = instructions / second

(clock rate) / (CPI) = instructions / second

P1:

3.0

GHz

/

1.5

=

2

billion

instructions

/

second

P2:

2.5

GHz

/

1.0

=

2.5

billion

instructions

/

second

P3:

4.0

GHz

/

2.2

=

1.82

billion

instructions

/

second

10 of 35

Processor

Clock Rate

CPI

P1

3.0 GHz

1.5

P2

2.5 GHz

1.0

P3

4.0 GHz

2.2

11 of 35

(clock rate) * (cpu time) = number of cycles

P1:

3.0

GHz

*

10

seconds

=

30

billion

cycles

P2:

2.5

GHz

*

10

seconds

=

25

billion

cycles

P3:

4.0

GHz

*

10

seconds

=

40

billion

cycles

12 of 35

(number of cycles) / (cycles per instruction) = number of instructions

P1:

30

billion

cycles

/

1.5

=

20

billion

instructions

P2:

25

billion

cycles

/

1.0

=

25

billion

instructions

P3:

40

billion

cycles

/

2.2

=

18.18

billion

instructions

13 of 35

Processor

Clock Rate

CPI

P1

3.0 GHz

1.5

P2

2.5 GHz

1.0

P3

4.0 GHz

2.2

14 of 35

old cpu time = (instruction count * CPI) / clock rate

new cpu time = (instruction count * 1.2 * CPI) / (x * clock rate)

new cpu time / old cpu time = 0.7 (1.2/x)/1 = 1.2/x = 0.7

0.7x = 1.2

x = 1.2/0.7 = 1.714

P1: 5.14 GHz

P2: 4.29 GHz

P3: 6.86 GHz

15 of 35

Amdahl’s Law

A

B

Total Execution Time E

A/s

B

New Total Execution Time E’

16 of 35

Amdahl’s Law

f*E

(1-f)*E

Total Execution Time E

(f*E)/s

(1-f)*E

New Total Execution Time E’

17 of 35

Amdahl’s Law

f*E

(1-f)*E

Total Execution Time E

(f*E)/s

(1-f)*E

New Total Execution Time E’

18 of 35

Amdahl’s Law

f*E

(1-f)*E

Total Execution Time E

(f*E)/s

(1-f)*E

New Total Execution Time E’

19 of 35

20 of 35

The new execution time is 94.4% of the old execution time. The execution time has reduced by 5.6%.

The execution time has improved by a factor of 1.06x.

21 of 35

22 of 35

The new execution time is 84% of the old execution time. The execution time has reduced by 16%.

The execution time has improved by a factor of 1.19x.

23 of 35

Digital Logic

24 of 35

Binary Addition Review

0101

+ 0111

????

1101

+ 1111

????

25 of 35

Binary Addition Review

0101

1101

+

0111

+

1111

1100

1|1100

Cannot be expressed using four bits (overflow)

26 of 35

Making an Adder

Add

A

B

A+B

27 of 35

Making an Adder

Add

A

B

A+B

A

B

A+B

0

0

?

0

1

?

1

0

?

1

1

?

28 of 35

Making an Adder

Add

A

B

A+B

A

B

A+B

0

0

0

0

1

1

1

0

1

1

1

10

29 of 35

Making an Adder

Add

A

B

A+B

A

B

C

S

0

0

0

0

0

1

0

1

1

0

0

1

1

1

1

0

30 of 35

Making an Adder

Add

A

B

A+B

A

B

C

S

0

0

0

0

0

1

0

1

1

0

0

1

1

1

1

0

31 of 35

Making an Adder

Add

A

B

A+B

A

B

C

S

0

0

0

0

0

1

0

1

1

0

0

1

1

1

1

0

32 of 35

Half Adder

A

B

A+B

A

B

C

S

0

0

0

0

0

1

0

1

1

0

0

1

1

1

1

0

33 of 35

Adding with a Carry

A

B

Cin

Cout

S

0

0

0

0

0

0

0

1

0

1

0

1

0

0

1

0

1

1

1

0

1

0

0

0

1

1

0

1

1

0

1

1

0

1

0

1

1

1

1

1

34 of 35

Full Adder

https://microcontrollerslab.com/cd4008-4-bit-full-adder-ic-pinout-features-example-datas heet/

35 of 35

4-bit Ripple Carry Adder