180 likes | 195 Views
מבנה מחשב – מבוא למחשבים ספרתיים. תרגול מספר 5. Encoders, Decoders & Shifters. Encoder F. Specification:. Functionality:. Proof of Correctness. By induction. Base:. Proof of Correctness. Induction assumption: Encoder F (n-1) is correct Induction step:
E N D
מבנה מחשב – מבוא למחשבים ספרתיים תרגול מספר 5 Encoders, Decoders & Shifters
EncoderF • Specification: Functionality:
Proof of Correctness • By induction. • Base:
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.
Proof of Correctness • Induction step: • We need to examine the output closer 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:
Induction step continued • Second case:
Induction Step continued • Third case:
Induction Step continued • Calculating F
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.
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?
Delay of Decoder & Encoder* Decoder - Using the theorem shown in class: Encoder - Using the same method:
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)).