Proof of Correctness By induction. Base: n 1 = y [ 0 : 0 - - PDF document

proof of correctness
SMART_READER_LITE
LIVE PREVIEW

Proof of Correctness By induction. Base: n 1 = y [ 0 : 0 - - PDF document

Encoders, Decoders & Shifters Encoder F Specification: input : x , weight ( x ) 1 =


slide-1
SLIDE 1

1

  • Encoders, Decoders & Shifters
  • EncoderF
  • Specification:

F y x weight x , :

  • utput

1 ) ( , : input =

n n

x F x x n y i i x i n y

2 2

1

  • r

1 ] [ ] : 1 [ ,.... 2 , 1 , 1 ] [ ] : 1 [ = ⇔ = = = ⇔ = > − < = = ⇔ = > − <

Functionality:

slide-2
SLIDE 2

2

Proof of Correctness

  • By induction.
  • Base:

] [ ] 1 [ ]) 1 [ ], [ ( ] [ ] 1 [

  • r

1 ] [ ] : [ 1 ] 1 [ 1 ] [ 1 ] : [ 1 = = ⇔ = = = = = ⇔ >= < = ⇔ = ⇔ >= < = x x x x NOR F x x x y x y y n

Proof of Correctness

  • Induction assumption:

EncoderF(n-1) is correct

  • Induction step:

Prove that if the design is correct for k-1, it is also correct for k.

slide-3
SLIDE 3

3

Proof of Correctness

  • Induction step:
  • We need to examine the output closer

) ]) : 1 2 [ ( , ]) 2 : 1 2 [ ( ( ] : 2 [

1 1

− − = −

− − n F n n F

x Encoder x Encoder OR n y

Since weight(x)=1, one of the components must be all zeros.

Induction step - continued

  • There is at most one i for which x[i] = 1
  • First case:

1

2 − <

n

i

i n y ] : 2 [ = > − <

i n y NOT x F NOT n y

n n

] : 1 [ ) 1 ( ])) 2 : 1 2 [ ( ( ] 1 [

1

= > − <

  • =

= − = −

slide-4
SLIDE 4

4

Induction step continued

  • Second case:

1

2 − ≥

n

i

1

2 ] : 2 [

− = > − <

n

i n y

i n y n y n y NOT x F NOT n y

n n n

] : 1 [ 2 ] : 2 [ ] : 1 [ ) ( ) ] 2 : 1 2 [ ( ( ] 1 [

1 1

= > − <

  • +

> − < = > − <

  • =

− = −

− −

Induction Step continued

  • Third case:

n

x

2

=

) 1 ( ]) 2 : 1 2 [ ( ( ] 1 [ ) , ( ] : 2 [

1 1 1 1

= = − = − = = −

− − − −

NOT x F NOT n y OR n y

n n n n n

slide-5
SLIDE 5

5

Induction Step continued

  • Calculating F

n n n

x x and x x F x F AND x F

n n n n n n 2 2 1 2 1 1 1

] : 1 2 [ ] 2 : 1 2 [ 1 ) ]) : 1 2 [ ( , ]) 2 : 1 2 [ ( ( ) (

1 1

= ⇔ = − = − ⇔ = − − =

− −

− − − −

Induction Conclusion

  • If EncoderF(k-1) is correct then

EncoderF(k) is correct.

  • Since EncoderF(1) is correct (base), it

follows that EncoderF(n) is correct for all n.

slide-6
SLIDE 6

6

Cost of EncoderF

) ( ) 1 ( NOR C C = ) 2 ( ) ( ) 1 ( 2 ) ( ) 1 ( ) ( ) ( ) 1 ( 2 ) (

n

O n O n C OR C n NOT C AND C n C n C = + − ⋅ = ⋅ − + + + − ⋅ =

size input

  • f

in terms ) ( n O =

Delay of EncoderF

) ( ) 1 ( NOR D D =

) ( ) 1 ( )} ( ), ( ), ( max{ ) 1 ( ) ( n O const n D OR D NOT D AND D n D n D = + − = + − =

size input

  • f

in terms ) (logn O =

slide-7
SLIDE 7

7

Cost of Decoder

  • Each of the 2n output gates is fed by a

different non-trivial gate, therefore the cost must be at least that much.

Cost of Encoder*

  • There are 2n inputs which are fed into non-

trivial gates. If the fan-in is bounded, then there must be an order of that size of input gates

  • Another way to view it: each output bit has

a cone of exactly 2n-1. Why?

slide-8
SLIDE 8

8

Delay of Decoder & Encoder*

Decoder - Using the theorem shown in class: ) (log | ) ( | log n O f cone Delay

c

= ≥ Encoder - Using the same method:

) ( 2 log | ) ( | log n O f cone Delay

n c c

= = ≥

cls(n, 0) sa[0] cls(n, 1) sa[1] cls(n, k − 1) sa[k − 1] x[n − 1 : 0] y[n − 1 : 0]

Barrel Shifter

slide-9
SLIDE 9

9

Functionality Preservation

  • If we swap the order of the blocks with

their inputs will the functionality be preserved?

  • If we swap the order of the blocks without

swapping their inputs will the functionality be preserved?

Asymptotic Optimality of Delay

  • The delay of the circuit is log(n)
  • How can we prove optimality?
  • We can view the circuit as having n+log(n)

inputs.

  • Each output bit is in a certain situation

affected by every input bit. Therefore the cone of every output bit is n+log(n)

  • This results in a delay that is O(log(n)).