Xor – Nand – Nor

Xor – Nand – Nor

QUIZ What do these bits represent? 1001 0110 1 Solution It depends on what is being represented! Unsigned integer: … Signed integer (2’s complement): … 1001 0110 Fraction: … IBM 437 character: … Latin-1 character: … Huffman-compressed text: … R/G/B level of pixel in image: … 2 Audio sample: … Video sample: … QUIZ What do these bits represent as Huffman- compressed text? 1001 0110 3 Solution What do these bits represent as Huffman- compressed text? 1001 0110 … L D ? Bits from the next byte 4 All hail the HARDWARE! Chapter 4 Gates and Circuits (with some transistors thrown in for good measure) Abstractions and more abstractions … We are here 6 Abstractions and more abstractions … Computers Made of lots of different circuits (CPU, memory, controllers, etc.) Circuits Made from gates combined to perform more complicated tasks Gates Devices that perform basic logical operations on electrical signals. They’re built out of transistors Transistors Very small electronic switches 7 There are 3 layers of computer abstraction that we examine in this chapter: Circuits Gates Transistors 8 4.2 Gates There are six basic gates: – NOT – AND – OR – XOR – NAND – NOR Real-life logic diagrams are black and white with gates distinguished only by their shape We use color for emphasis (and fun) in this text 9 How do we describe the behavior of gates and circuits? 1. Boolean expressions Uses Boolean algebra, a mathematical notation for expressing two-valued logic 2. Logic diagrams A graphical representation of a circuit; each gate has its own symbol 3. Truth tables A table showing all possible input value and the associated output values 10 NOT Gate (a.k.a. inverter) A NOT gate accepts one input signal (0 or 1) and returns the opposite signal as output Figure 4.1 Various representations of a NOT gate 11 AND Gate An AND gate accepts two input signals If both are 1, the output is 1; otherwise, the output is 0 Figure 4.2 Various representations of an AND gate 12 AND gate quiz #1 The inputs to an AND gate have the values A = 1 and B = 0. What is the output? 13 AND gate quiz #2 The input B to an AND gate has the value B = 0. What is the output? 14 AND gate quiz #3 The input B to an AND gate has the value B = 1. What is the output? 15 Conclusion: the AND gate has the following interesting properties A AND 0 = 0, irrespective of B A AND 1 = A 16 OR Gate An OR gate accepts two input signals If both are 0, the output is 0; otherwise, the output is 1 Figure 4.3 Various representations of a OR gate 17 XOR Gate If both inputs are the same, the output is 0; otherwise, the output is 1 XOR is called the exclusive OR Pronunciations: zor, ex-or 18 QUIZ: recognize the gate and draw its symbol! 19 Source: AP CS Principles – Course and Exam Descriptions QUIZ: elementary properties A AND 0 = ? A AND 1 = ? 1 AND B = ? A OR 1 = ? A XOR 0 = ? A XOR 1 = ? 21 XOR Quiz For the following circuit diagram: • Find the Boolean expression NOT • Find the truth table X X = 22 NAND Gate If both inputs are 1, the output is 0; otherwise, the output is 1 Compare to AND: We can build an AND gate out of a NAND and an INVERTER! (A⋅B)’ (A⋅B)’’ = A⋅B Rule: Two “bubbles” next to each other cancel out! 24 QUIZ Can we build an inverter (NOT) from a NAND gate? 25 Solution Can we build an inverter (NOT) from a NAND gate? 26 NOR Gate If both inputs are 0, the output is 1; otherwise the output is 0 Compare to OR: 27 Quiz Can we make an OR gate out of a NOR and an INVERTER? 28 Not in text Whatever happened with the inverted XOR? It’s called XNOR, pronounced [ex-nor] 29 Review of Gates A NOT gate inverts its single input An AND gate produces 1 iff both input values are 1 An OR gate produces 0 iff both input values are 0 A XOR gate produces 0 iff input values are the same If and only if All inverted gates have the opposite outputs It’s OK to put the gate representations on your memory-sheet, but you should be able to remember the word descriptions above! 30 Gates with More Inputs A three-input AND gate produces an output of 1 iff all input values are 1 31 Remember: There are 3 layers of computer abstraction that we examine in this chapter: Circuits Gates √ Transistors 32 4.3 Constructing Gates Transistor = device that acts either as a wire that conducts electricity or as a resistor that blocks the flow of electricity, depending on the voltage level of an input signal Made of a semiconductor material • Neither good conductor of electricity nor a good insulator … • …but with a little help can be either! Acts like a switch, but w/o moving parts: • Switch open • Switch closed 33 How transistors operate as switches High voltage, a.k.a. + Base or gate Low voltage, a.k.a. - When 1 is applied When 0 is applied on the base/gate, on the base/gate, the switch closes the switch opens 34 Transistors A transistor has three terminals: – A collector/source, typically connected to the positive terminal of a power source (5 volts, 3.5 volts, etc.) – An emitter/drain, typically connected to the “ground” (0 volts) – A base/gate, which controls the flow of current between source and emitter Figure 4.8 The connections of a transistor 35 The names of transistor terminals -setting the record straight FYI- Bipolar Junction Transistor (BJT) Field-Effect Transistor (FET) Collector, Base, Emmiter Drain, Gate, Source “Mongrel” transistor (our text) 36 The easiest gates to create are NOT, NAND, and NOR We can explain their operation for any combination of inputs! We do this by replacing the transistors with switches! 37 If there is no path from output to Ground, Vout = 1 If there is a path from output to Ground, Vout = 0 38 Non-inverted gates: The AND gate is obtained as a NAND followed by an inverter. Draw its transistor diagram! 39 QUIZ What gate do we have below? 40 QUIZ What gate do we have below? 41 Quick work for next time: Read pp.93-104 of text Answer in notebook the end-of-chapter questions: 1 – 11, 18 – 29, 59 EOL 1/2 42 QUIZ: Review of gates’ operation A NOT gate … An AND gate … An OR gate … A XOR gate … All inverted gates … 43 Quiz For the following circuit diagram: • Find the Boolean expression • Find the truth table X X = 44 Quiz For the following circuit diagram: • Find the Boolean expression • Find the truth table X X = 45 QUIZ: What gate is implemented below? 46 QUIZ: Based on the switching behavior of transistors, verify the behavior of the OR gate when A=V1=1 and B=V2=0. Remember: connection to Ground means logical zero! 47 4.4 Intro: From gates to circuits We can go either way between gates and circuits: Analysis Find the truth table for the circuit: X 48 From gates to circuits Design Find the logic diagram of the circuit described by the following truth table: 1 0 ? Hint: The table is similar to which of the fundamental gates? 49 SOLUTION Having only one 0 in the output column, the circuit most resembles the OR gate! It is different from the OR gate only in this respect: … Write the Boolean expression: 50 SOLUTION Write the Boolean expression: X = A’ + B Draw the circuit diagram: 51 SOLUTION Write the Boolean expression: X = A’ + B Draw the diagram: 52 4.4 Circuits Combinational circuit The input values explicitly determine the output Remember: We describe the circuit operations using Boolean expressions Logic diagrams Truth tables 53 Combinational Circuit AB+AC Three inputs require 23 = 8 rows to describe all possible input combinations Boolean expression is: 54 Another Combinational Circuit Boolean expression A(B + C) Does this truth table look familiar? 55 Circuit equivalence: Two circuits that produce the same output for identical input are called equivalent Boolean algebra allows us to apply provable mathematical principles to help design circuits: A(B + C) = AB + AC (distributive law) so circuits must be equivalent 56 Each property (law) of Boolean Algebra translates directly into a property of equivalent circuits! Null elements A · 0 = 0 A + 1 = 1 Idempotency A · A = A A + A = A Double complement (A’)’ = A 57 De Morgan’s Laws Null elements A · 0 = 0 A + 1 = 1 Idempotency A · A = A A + A = A Double complement (A’)’ = A 58 DeMorgan’s law applied directly to gates 59 DeMorgan’s law QUIZ Apply DeMorgan’s Law directly on the gate diagram below to obtain equivalent circuits: 60 DeMorgan’s law QUIZ Apply DeMorgan’s Law directly on the gate diagram below to obtain equivalent circuits: 61 Individual work (in notebook): Write the circuit forms for all Boolean properties in this table! (left and right) Null elements A · 0 = 0 A + 1 = 1 Idempotency A · A = A A + A = A Double complement (A’)’ = A 62 Very Useful Combinational Circuit: the Adder At the digital logic level, addition is performed in binary Addition operations are carried out by special circuits called adders 63 Half-Adder truth table The result of adding two binary digits could produce a carry value Recall that 1 + 1 = 10 in base two Half adder A circuit that computes the sum of two bits and produces the correct Truth table carry bit Do you recognize these outputs? 64 Half Adder Circuit diagram Boolean expressions Sum = A ⊕ B Carry = A·B How many transistors are in this circuit? 65 Full Adder This adder takes the Carry-in value into account! Do you recognize these circuits? 66 Adding multiple bits - “Ripple Carry” Adder - 67 SKIP Multiplexers 68 There are 2 basic types of circuits Combinational circuit The input values explicitly determine the output Sequential circuit The output is a function of the input values and the existing state of the circuit 69 4.5 Circuits for Memory a.k.a.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    90 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us