Basic Experiment and Design of Electronics LOGIC CIRCUITS Ho Kyung Kim, Ph.D. hokyung@pusan.ac.kr School of Mechanical Engineering Pusan National University
Outline Combinational logic circuits Output depends on only the present inputs; not on the past inputs Multiplex ROM Decoder RAM PLD Sequential logic circuits Output depends on both the present and past inputs; hence having memory function Flip-flops Counters 2
Combinational logic circuits (modules) Multiplex ROM Decoder RAM PLD 3
Calculator Input Output Decimal 4 bits Encoder CPU Decoder BCD 4 bits BCD 7 bits Key pad 7-sement display 4
Half adder (HA) 2 inputs: and 3 outputs: (sum, LSB) and (carry, MSB) C OUT Y S Y Y Y Y C OUT S Y HA S C OUT Y S C OUT 5
Full adder (FA) 3 inputs:,, and 2 outputs: and C Y Y C C OUT S FA S C OUT Y S YC C ( YC ( Y C YC YC Y C YC ) ( Y C Z Z Z OUT YC YC YC Y C Y C Y C Y ( C Y C YC YC ) ( YC ( ) C YC ( Y ) ) C ( Y ) YC ) YC YC ( Y ( Y YC [ ( Y Y ) Y ( )] Y ) ) YC YC Y ) Y ( C YC C YC HA HA Y S ) C Y C OUT 6
For the output : YC S YC YC Y C For the output : YC YC Y C S YC C OUT C OUT Y C Y C Y C Y ( C Y C ( [ ( Y Y ) Y ( ) C ( YC Y ) Y ) ( Y Y ) )] 7
Multiplexers Selecting one of many inputs (also called data selectors) Consisting of 2 data lines, address lines, output, enable control input Ex) 4-to- MU 8
ROM Read-only memory Holding information in storage ( memory ) that cannot be altered but can be read by a logic circuit Consisting 2 cells = # of address lines = # of bits in each word stored in ROM When an address line is selected, the binary word corresponding to the address selected appears at the output c.f., EPROM (erasable programmable ROM) Ex) 2 4 ROM 9
Ex) 8-word 4-bit (or 2 4)ROM A B C F F F 2 F 3 typical data stored in ROM (2 3 words of 4bits each)
Decoder Identifying, recognizing, and detecting a particular code decoder inputs 2 input codes Representing a binary number Activating only the output that corresponds to that input number outputs Activated (HIGH) with only one of the outputs for each input code LOW for the other outputs Ex) 3 8 decoder, 4 (BCD-to-decimal) decoder, BCD-to-7 segment decoder N inputs 2 Decoder Y Y Y 2 M outputs N- Y M- 2 N input codes Only one output is HIGH for each input code
Ex) 2 4 decoder A B A B 2 4 decoder Y Y Y 2 Y 3 Y Y Y 2 Y 3 2
Ex) 3 8 decoder a b c y y y 2 y 3 y 4 y 5 y 6 y 7 3
Ex) BCD-to-decimal decoder 74LS42, 74HC42 BCD Input Decimal Output A B C D 2 3 4 5 6 7 8 9 active-low outputs 4
Decoder and RAM Commonly used for address decoding or memory expansion Ex) 2-to-4 decoder SRAM (static random access, or read and write, memory) 5
Encoder Opposite to the decoding process Only one of input lines is activated at a given time Producing an -bit output code M inputs only one HIGH at a time 2 Encoder Y Y Y 2 N-bit output code M- Y N- 6
Ex) 8 3 decoder y y y 2 y 3 y 4 y 5 y 6 y 7 a b c d 7
Ex) Decimal-to-BCD encoder +5 V 2 3 4 5 6 7 8 9 Switch on 3: ABCD = Switch on 7: ABCD = A B C D 8
PLD Programmable logic device PROM (programmable read-only memory) PLA (programmable logic array) PAL/GAL (programmable array logic/generic array logic) Arrays of gates (e.g., AND and OR gates) having interconnections that can be programmed to perform a specific logical function Programming language: hardware description languages (HDLs) Used for various digital logic designs 9
Timing diagram 2
Sequential logic circuits Combinational logic circuits provide outputs that are based on a combination of present inputs only Sequential logic circuits depend on present and past input values (it memorizes!) Being able to store information 2
Flip-flops Basic information storage device in a digital circuit Many different varieties of flip-flops RS FF D FF JK FF T FF Common characteristics Bistable device Remaining in one of two stable states ( and ) until appropriate conditions cause FF to change state Memory element Two outputs; complement ( ) and uncomplement ( ) outputs Synchronous operation by a clock signal Asynchronous operation Independent of the clock Level sensitive ( Latch ) 22
RS filp-flop Two inputs ( set and reset ), two outputs ( and, called the state of FF) Requiring the FF to set and reset at the same time! Time delays! 23
24
Ex) Initial state (then, ; apply SET becomes ; still SET Cross-coupled feedback from outputs and to the input of the NAND gates is such that the set condition sustains itself 25
RS FF with enable ( ), preset ( ), and clear ( ) inputs or is effective only when Synchronizing signal Direct inputs and allow the user to preset or clear the FF at any time (asynchronous operation) (preset) when (cleared) when 26
Delay latch (or delay element) An extension of RS FF Always SET whenever Prohibiting ; eliminating input Once, FF is latched to the previous value of the input ( memory ) and delays the output by one clock count w.r.t. the input No change 27
D flip-flop An extension of data latch with two RS FFs Changing state only on the positive edge of the clock (leading or positive edgetriggered) Similarly, trailing or negative edge-triggered D FF indicating leading edge-trigger 28
D Q D C Q CLK D Q Q D CLK Q Q Q CLK Q Q 29
JK flip-flop J Q CLK K Q J K Q No change Reset Set Toggle J Q CLK K Q J K CLK Q 3
indicating trailing edge-trigger (no change) 3
Master/slave FF Master Slave J K Q n+ J Q CLK K Q J Q CLK K Q Q n (no change) Reset Set Q n (toggle) CLK t n master t n+ slave J K Q 32
33
T flip-flop JK FF with its inputs tied together 34
+ V CC Q D Q J Q T T CLK Q T CLK Q K Q T Q EN T J CLK Q EN K Q Q 35
3-bit binary up counter Force a RESET 36
Decade counter Count from to 9 and then RESET Impractical due to propagation delays 37
Ripple counter Consists of a cascade of 3 JK FFs 38
Ripple-up counter Asynchronous counter CLK Q (LSB) Q Q 2 Q Q T Q T Q 2 T 2 Q Q 2 Q Q Q 2 2 3 4 5 6 7 Q T Q T Q 2 T 2 Q Q 39
Ripple-down counter Asynchronous counter CLK Q (LSB) Q Q 2 Q Q T Q T Q 2 T 2 Q Q 2 7 6 5 4 3 2 4
Synchronous counter Q Q Q 2 Q 3 J Q J Q J 2 Q 2 J 3 Q 3 CLK CLK CLK CLK K K K 2 K 3 F F F 2 F 3 + V CC 4
2 3 4 5 6 7 8 9 2 3 4 5 42
Divider circuit 43
Synchronous counter 44
Ring counter 45
Parallel register The load input (clock) simultaneously transfers the parallel input binary word (store!) 46
Shift register 47