270 likes | 423 Views
Computer Organization and Design Transistors & Logic - II. Montek Singh Mon, Mar 14, 2011 Lecture 9. Outline. A. B. Comp 411 Box-o-Tricks. F = A xor B. The digital contract Encoding bits with voltages Processing bits with transistors Gates Truth-table SOP Realizations
E N D
Computer Organization and DesignTransistors & Logic - II Montek Singh Mon, Mar 14, 2011 Lecture 9
Outline A B Comp 411 Box-o-Tricks F = A xor B • The digital contract • Encoding bits with voltages • Processing bits with transistors • Gates • Truth-table SOP Realizations • Multiplexer Logic
From What Do We Make Digital Devices? • Recall our common thread from Lecture 2… • A controllable switch is a common link of all computing technologies • How do you control voltages with a switch? • By creating and opening paths between higher and lower potentials (voltages) This symbol indicates a “high” potential, or the voltage of the power supply (e.g., 2V, 5V etc.) Load This symbol indicates a “low” or ground potential or 0V.
N-Channel Field-Effect Transistors (NFETs) S D “ “ S D S D When the gate voltage is high, the switch connects. Good at pulling things “low”. + D D G G VDS³ 0 + S S VGS - Operating regions: cut-off: VGS < VTH linear: VGS³ VTH VDS < VDsat saturation: VGS³ VTH VDS³ VDsat - 0.5V IDS linear saturation VGS VGS - VTH VDS
P-Channel Field-Effect Transistors (PFETs) S D “ “ S D S D When the gate voltage is low, the switch connects. Good at pulling things “high”. S - S VGS - + G G VDS 0 + D D Operating regions: cut-off: VGS > VTH linear: VGSVTH VDS > VDsat saturation: VGSVTH VDSVDsat –0.5V -VDS -VGS VGS - VTH saturation linear -IDS
Finally… From Transistors to Gates! We’ll usePFETs here and, NFETshere • Logic Gate recipe: • use complementary arrangements of PFETs and NFETs • called CMOS (“complementary metal-oxide semiconductor”) • at any time: either “pullup” active, or “pulldown”, never both! VDD pullup: make this connectionwhen VIN is near 0 so that VOUT = VDD VIN VOUT pulldown: make this connectionwhen VIN is near VDD so that VOUT = 0 Gnd
CMOS Inverter Valid “1” Invalid Valid “0” “1” “0” Only a narrow range of input voltages result in “invalid” output values. (This diagram is greatly exaggerated) “0” “1” A Y inverter Vout Vin Vout Vin
CMOS Complements A A B B conducts when A is highand B is high: A.B conducts when A is lowor B is low: A+B = A.B conducts when A is highor B is high: A+B conducts when A is lowand B is low: A.B = A+B A A B B A A conducts when A is high conducts when A is low Series N connections: Parallel P connections: Parallel N connections: Series P connections:
A Two Input Logic Gate A B What function does this gate compute? A B C 0 0 0 1 1 0 1 1
Here’s Another… B A What function does this gate compute? A B C 0 0 0 1 1 0 1 1
CMOS Gates Like to Invert B A Observation: CMOS gates tend to be inverting! • One or more “0” inputs are necessary to generate a “1” output • One or more “1” inputs are necessary to generate a “0” output • Why?
General CMOS Gate Recipe A B C B A C B A C A B C Step 1. Figure out pulldown network that does what you want (i.e the set of conditions where the output is ‘0’)e.g., F = A*(B+C) Step 2. Walk the hierarchy replacing nfets with pfets, series subnets with parallel subnets, and parallel subnets with series subnets Step 3. Combine pfet pullup network from Step 2 with nfet pulldown network from Step 1 to form fully-complementary CMOS gate.
One Last Exercise Vdd A B C F A B C • Lets construct a gate to compute: • F = A+BC = NOT(OR(A,AND(B,C))) • Step 1: Draw the pull-down network • Step 2: The complementary pull-up network
One Last Exercise Vdd A B C F A B C • Lets construct a gate to compute: • F = A+BC = NOT(OR(A,AND(B,C))) • Step 1: Draw the pull-down network • Step 2: The complementary pull-up network • Step 3: Combine and Verify 1 1 1 0 0 0 0 0
Now We’re Ready to Design Stuff! Argh… I’m tired of word games A Truth Table Y B C If C is 1 thencopy B to Y,otherwise copyA to Y • We need to start somewhere • usually it’s the functional specification If you are like most engineers you’d rather see a table, or formula than parse a logic puzzle. The fact is, any combinational function can be expressed as a table. These “truth tables” are a concise description of the combinational system’s function. Conversely, any computation performed by a combinational system can expressed as a truth table.
A Slight Diversion SURGE • Are we sure we have all the gates we need? • How many two-input gates are there? • All of these have 2-inputs (no surprise) • … 2 inputs have 4 possible values • How many possible patterns for 4 outputs are there? ___ • Generalizing, for N inputs, there are 2(2^N) gates AND OR NAND NOR 24
There Are Only So Many Gates How many of these gates can actually be implemented using a single CMOS gate? • There are only 16 possible 2-input gates • … some we know already, others are just silly • Do we need all of these gates? • Nope. We describe them all using AND, OR, and NOT.
We Can Make Most Gates Out of Others B>A XOR A B Y A A y Y B B • How many different gates do we really need?
One Will Do! = = = = = = • NANDs and NORs are universal • Ah!, but what if we want more than 2-inputs
Gate Trees A 0 0 1 1 B 0 1 0 1 C 0 1 1 0 Suppose we have some 2-input XOR gates: tpd = 1 And we want an N-input XOR: output = 1 iff number of 1s input is ODD (“ODD PARITY”) N tpd = O( ___ ) -- WORST CASE. Can we compute N-input XOR faster?
Gate Trees 22 21 log2N 2 log N N-input TREE has O( ______ ) levels... Signal propagation takes O( _______ ) gate delays. log N
Here’s a Design Approach Truth Table Three steps: • Write functional spec as a truth table • Write down a Boolean expression for every ‘1’ in the output • Wire up the gates! • This approach will always give us logic expressions in a particular form: • SUM-OF-PRODUCTS
Straightforward Synthesis A B C A B C Y A B C A B C • We can implement SUM-OF-PRODUCTS… • …with just three levels of logic • INVERTERS/AND/OR
C Useful Gate Structures A C Y B A Y B C A Y B DeMorgan’s Laws AB=A+B AB=A+B C A Y B • NAND-NAND • NOR-NOR “Pushing Bubbles” C A Y B C A Y B
An Interesting 3-Input Gate Truth Table A Y B C If C is 1 thencopy B to Y,otherwise copyA to Y B C Y A • Based on C, select the A or B input to be copied to the output Y. 2-input Multiplexer A 0 B 1 Gate symbol C schematic
MUX Shortcuts A0 B0 A1 B1 Y0 0 1S A B C D S 0 1 2 3 0 1S Y Y1 I0 I1 I2 I3 A0-3 B0-3 S A2 B2 A3 B3 Y0-3 0 1S Y2 Y 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1S 0 1S Y3 0 1S 0 1S S0 S1 S A 4-bit wide Mux A 4-input Mux(implemented as a tree)
Mux Logic Synthesis 0 0 0 1 0 1 1 1 0 1 2 3 4 5 6 7 Cout A,B,Cin Consider implementation of some arbitrary Boolean function, F(A,B) ... using a MULTIPLEXERas the only circuit element: Full-AdderCarry Out Logic