slide 9 - dspace.mit.edu · slide 4 6.071 digital logic 4 digital representation 1 • one can use...
TRANSCRIPT
Slide 1
6.071 Digital Logic 1
Demultiplexer
S1 S0 input routed to:0011
0101
ABCD
A
B
C
DS1
S0
0 1
1 0
01
Einput data
data select
Disabled output are heldon HIGH
Of course the opposite action can also be implemented. A demultiplexer sends one signal to one of many lines.
Slide 2
6.071 Digital Logic 2
S1 S0 input routed to:0011
0101
ABCD
A
B
C
DS1
S0
0
0
1
1 1
1
Einput data
data select
Disabled output are heldon LOW
Demultiplexer (2-input AND gates)
Slide 3
6.071 Digital Logic 3
12
5V1413
12
7
5V1413
12
11
12
3
45
6
7
04
A
B
C
ABC≡
Slide 4
6.071 Digital Logic 4
Digital Representation 1
• One can use a number of different number system to representdigital data.
Binary: Base two numbering system; numbers composed of 1’sand 0’s, which are called bits.example: 111002 = 1·24+1·23+1·22 +0·21 +0·20 = 2810
Octal: Base eight system with 0,1,2,3,4,5,6,7 being allowable digits.example: 2478 = 2 ·82+4 ·81+7 ·80 = 16710
Hexadecimal: Base sixteen with 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,as allowable digits.example: 2D516 = 2 ·162+D(=1310) ·161+5 ·160 = 72510
In digital circuits information is stored in binary form, consisting of an ordered array of two state devices. Often for convenience three binary bits are combined to form an octal code, so although we discuss the information as though it was base eight, it is still stored and manipulated in binary form. The same is true for hexadecimal where data is represented in base 16 and stored in 4 bit binary.
Slide 5
6.071 Digital Logic 5
Digital Representation 2
Binary Coded Decimal (BCD): Each decimal of a number is represented as a 4-bit binary number. So,
00002 → 01000012 → 11000102 → 210⋅⋅⋅01112 → 71010002 → 81010012 → 910
are the only 4-bit binary sequences used.
Example: 15110
0001 0101 0001⇒15110 = 0001 0101 0001(BCD)
Since in out normal manipulations base 10 has special importance it is sometimes convenient to store and process information in binary coded decimal. Here 4 bits are used to represent the numbers 0 through 9. Of course 4 bits could store numbers 0 through 15, so there is some unused space. BCD is most often encountered when we wish to output a decimal result. Using BCD greatly simplifies the task since each decimal bit is uniquely coded by 4 binary digits. There are encoders to switch from binary to BCD and back.
Slide 6
6.071 Digital Logic 6
BCD to 7-Segment Decoder (LED)
7447
A2
A0A1
A3
1
10
0
RBO
RBI
LT
+VCC
+5V
abcdefg
0110000
dp
abcdefg
dp
Common-anodeLED display
+5V
Another complex chip, in this case designed to control an LED numeric display.
Slide 7
6.071 Digital Logic 7
7447 Data Sheet
Slide 8
6.071 Digital Logic 8
7447 Data Sheet 2
Slide 9
6.071 Digital Logic 9
7447 Data Sheet 3
Slide 10
6.071 Digital Logic 10
7447 Data Sheet 4
X’s means that the state does not matter; therefore, they are just a wa to save space in the table. L’s in the BI/RBO column suppresses all outputs; used to block leading and following zeros.
Slide 11
6.071 Digital Logic 11
Digital Representation 3
2’s Compliment: Binary numbering scheme used to represent bothpositive and negative integers. Positive integers arerepresented the same was as in the original binary scheme;but negative integers are represented as the binary numberthat when added to the binary representation of its absolutevalue, equals zero. Example: 4110 = 0010 10012’s comp; -4110 = 1101 01112’s compOne can verify adding both binary number equals zero.
To obtain a 2’s compliment representation from a negative integer, take the true binary representation of the absolute value of that integer, reverse the bits, and add 1.
The addition of two binary numbers is quite simple, but the subtraction is a drag due to the borrowing needed. By storing information in 2’s complement and then adding the result we achieve the same effect as if we had subtracted the numbers.
Slide 12
6.071 Digital Logic 12
Binary Arithmetic
Adding: Adding binary numbers is just like adding decimal numbers;whenever the result of adding one column of numbers is greater than one digit, a 1 is carried over to the next columnto be added.
2010 = 0 0 0 1 0 1 0 08710 = 0 1 0 1 0 1 1 1
0 1 1 0 1 0 1 1
11
Example:
Subtraction: This operation is similar to decimal subtraction. Theonly potential point of confusion is that when “borrowing”from one column a 102 (=210) is carried over (not just a 1)to the next column. A trick to subtracting binary numbers isto add the 2’s compliment of the subtracting number to thetrue binary representation of the number from which it is subtracting.
+1910 = 0 0 0 1 0 0 1 1-710 = 1 1 1 1 1 0 0 1
Sum = 0 0 0 0 1 1 0 0Example:
Subtraction is easy for us but a drag in binary
Slide 13
6.071 Digital Logic 13
Binary AddersEarlier, it was said that adding binary numbers is analogous to addingdecimal numbers (i.e. one has to consider carry bits in multiple-bitadditions). Binary addition can be implement through the use of logicgates. First consider the half-adder circuits below.
A0B0
Σ0
Cout
A0
B0Σ0
Cout
Half-Adder: alternative representation: half-adder symbolA Cout
B Σ
These circuits add two one-bit numbers and produce one two-bit number. Notice that both of the logic gate representations are equivalent.
HA
Adders are very useful devices and are simple to explore in binary representations. The half adder is used for the least significant bit. This bit of course has no possibility of a carry from an even lower bit and so just the two binary numbers themselves are important. Of course the two can generate a carry bit. So the half adder has two inputs and two outputs (the binary sum and a carry). The half adder is most simply represented with an exclusive OR, but we rarely use such devices and so it is re-written in terms of AND and NORs. Since the half adder is widely used it is also given a special symbol. Truth Table: A B Συµ C 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1
Slide 14
6.071 Digital Logic 14
Binary Adders 2
A full-adder circuit takes in three one-bit binary numbers and produces one two-bit binary number.
Full-Adder:full-adder symbol
A Cout
B ΣFA
A C
B ΣHA
A C
B ΣHA
B1
A1
Cin Σ1
CoutCin
The full adder is used for all but the least significant bit. Here there are three inputs (the two binary numbers, and the carry from the next lower significant bit. Still there are only two outputs the sum and a carry. Of course if you can add two digits with a half adder, then two half adders can add three numbers. Notice the logic for the carry. Truth Table: A B Cin Sum Cout 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 0 0 1 0 0 1 1 0 0 1 1 0 1 1 0 1 0 1 1 1 1 1 1
Slide 15
6.071 Digital Logic 15
Binary Adders 3
A B Σout1 Cout
1 Cin ΣΣout1+Cin
1 Cout2 Cout
1+Cout2
1
00110011
01010101
01100110
00010001
00001111
01101001
00000110
00010111
Slide 16
6.071 Digital Logic 16
Demo
Full-Adder:
A0
B0Σ0
Cout
Cin
Our version of a 2 bit full adder. In the class one of the NOR gates is replaced with an OR and a NOT.
Slide 17
6.071 Digital Logic 17
Binary Adders 4
Now, with the half-adders and full-adders, a multi-bit adder can beconstructed:
4-bit Adder:A0 B0
Σ0
Cout
HAA B
ΣCout
FAA B
Σ
Cin
Cout
FAA B
Σ
Cin
Cout
FAA B
Σ
Cin
Σ1
A1 B1
Σ2
A2 B2
Σ3
A3 B3
Σ4
A3A2A1A0+ B3B2 B1B0Σ4Σ3Σ2 Σ1Σ0
A 4 bit full adder. The least significant is a half adder and the others are full adders. Also notice that when adding 2x 4 bit digits and answer spans 5 bits.
Slide 18
6.071 Digital Logic 18
Demo
A0
B0Σ0
Cout
Half-Adder:
Slide 19
6.071 Digital Logic 19
Problem (Extra Credit for Quiz #5):
Using as many of the following list of components as possible construct a circuit that performs some interesting function. Describethe function and state the output of the circuit. The circuit neednot be most efficient, but should not be trivially reducible.
4x switch1x clock4x JK flip-flops4x OR4x AND4x NOR4x NAND
Component List:
3x three-input AND3x three-input NOR3x three-input NAND4x NOT
Bring this to the quiz and hand in at the start.
Slide 20
6.071 Digital Logic 20
Binary Adder/Subtracter
A4 B4 A3 B3 A2 B2 A1 B1
Cout Cin
Σ4 Σ3 Σ2 Σ1
Cin
high addslow subtracts
when high, invert B input
Add 1∴ 2’s compliment
least significant bit(do not repeat)
Slide 21
6.071 Digital Logic 21
Logic FamiliesBIPOLAR LOGIC FAMILY
TTL (Transistor-Transistor Logic)Standard TTL (74)Low-power TTL (74L)Schottky TTL (74S)Low-power Schottky (74LS)Advanced Schottky (74AS)Advanced low-power Schottky (74ALS)Fast TTL (74L)
ECL (Emitter-Coupled Logic)ECL IIIECL 100KECL 100KHECL 10K
IIL or I2L (Integrated-Injection Logic)
MOS LOGIC FAMILYPMOS (P-Channel MOSFET) NMOS (N-Channel MOSFET) CMOS (Complementary MOSFET)
Standard CMOS (4000 (B))High-speed CMOS (74HC)High-speed CMOS TTL compatible (74HCT)Advanced CMOS logic (74AC)Advanced CMOS TTL compatible (74ACT)Low-voltage CMOS (74LV)
OTHERSBiCMOS (Combination of biolar and CMOS)GaAs (gallium arsenide) technologySOS (silicon-on-saphire) technologyJosephen junction technology
There are many versions of chips and they are not all compatible. Some of the older versions are hard to find and easily replaced with modern chips for example the HCT class. You do need to be careful about mixing types.
Slide 22
6.071 Digital Logic 22
TTL 5V
2.7V
2V
.8V
.4V
0V
outputhigh
outputlow
inputhigh
inputlow
HC 5V
3.5V
4.4V
.1V
0V
outputhigh
outputlow
inputhigh
inputlow
1V
Output of HC can drive TTL. Output of TTL does not drive HC.
Slide 23
6.071 Digital Logic 23
Open Collector NAND Gate
4K 1.6K
VCC = +5V
1K
OUTQ4
D1 D2
AB
OC
When Q4 is ON, the output is LOW. When Q4 is OFF, the outputFloats.
When both A and B are high the two BJT’s in parallel are off (the emitter diodes do not have .6 V across them) so that the base of Q3 is high and Q3 is on and so the base of Q4 is high and the output is pulled low. However in the off state the output floats. If you use this in a digital circuit you will have to pull up the output with a resistor to 5 V. The nice feature about open collector devices is that they can sink a reasonable amount of power. So you could use this to switch 15 V at 100 mA, something you could not do with a normal TTL output.
Slide 24
6.071 Digital Logic 24
Schmitt Inverter
Vin Vout
Vout
Vin
Von
Vt-Vt+Von
transfer function
Vin
Vout
Vt+Vt-
Von
Voff
We saw hystorisis with op amps, it is also often used with digital circuits especially where one expects noise (as in the bounce of a switch).
Slide 25
6.071 Digital Logic 25
Encoder Decoder driven LED display
987
654
321
0
Keypad
+5V Rpull-up
10K(0)
(1)
(1)(1)
(1)(1)
(1)(1)
(1)
(1)
0
16VCC9
87654321
Q0Q1
Q2Q3
74SL147
(0)(1)(1)(0)
(1)(0)(0)(1)
NegativeLogic(BCD)
“9”
PositiveLogic(BCD)
“9”
A0
A1
A2
A3
abcdefg
7447
+5V0110000
7x330Ω
abcdefgdp
a
b
cd
e
f g
dp8
Common-anodeLED display +5V
An example of the use of a 10 line decimal to 4 line BCD coder to drive an LED display of a numeric keypad. The 147 has 9 inputs and when any one is pulled low it outputs an inverted BCD representation of the digit. The inverters convert this to BCD which is then used to drive the 47 which is a BCD to 7 segment LED driver. The 0 state does not need to be coded and will be displayed correctly when all four BCD bits are low. Note the default output state of the 147 (all inputs high) is for all outputs to be high. One of the issues when using the 147 is that there are many other input states that due not seem to be coded for, For example what happens when two inputs are pulled down? For this you need to check the data sheets.
Slide 26
6.071 Digital Logic 26
74LS147 Data Sheet
Slide 27
6.071 Digital Logic 27
74LS147 Data Sheet 2
Notice that the highest decimal number that is pulled down is coded. The X in the table indicates that the state of that input does not matter.
Slide 28
6.071 Digital Logic 28
74LS147 Data Sheet 3
Slide 29
6.071 Digital Logic 29
74LS147 Data Sheet 4
Slide 30
6.071 Digital Logic 30
74LS147 Data Sheet 5
Slide 31
6.071 Digital Logic 31
Arithmetic/Logic Units (ALUs)ALUs are multipurpose integrated circuits capable of performingvarious arithmetic and logic operations. The 74181 shown below is a 4-bit ALU that provides 16 arithmetic and 16 logic operations.
A0A1A2A3
B0B1B2B3
CN
M
S0S1S2S3
F0F1F2F3
CN+4
A = B
G
P
74181A
B
carry-in (CN)mode control
functionselect
F
carry-out (CN+4)equalitygeneratepropagate
This one chip can perform any logic operation and many arithmetic operations on 2 4 bit words, and it does so via a programmable function selector. It is actually a rather old fashioned device by todays standards but it shows some nice capabilities of more complex chips. Today you would be more likely to use a microprocessor than an ALU. For arithmetic operations the chip is provided with a carry (from an array of lower significance ALUs) and a carry out (to an array of higher significance ALUs. The chip works on two’s complement and can add, subtract, double etc.
Slide 32
6.071 Digital Logic 32
74181 Data Sheet
Slide 33
6.071 Digital Logic 33
74181 Data Sheet 2
Note even in the arithmetic side, the + symbol stands for OR and AB means A and B. The word plus means addition.
Slide 34
6.071 Digital Logic 34
74181 Data Sheet 3
Slide 35
6.071 Digital Logic 35
74181 Data Sheet 4
Slide 36
6.071 Digital Logic 36
74181 Data Sheet 5