EGR 2131 Unit 6 Combinational Building Blocks Read Mano & Ciletti, Sections 4.9 to 4.15. Midterm Exam next week. Homework #6 and Lab #6 due next week. Enable Pins Many of the chips we’ll study have enable inputs. Depending on the logic level at this pin, the chip is either enabled or disabled. When the chip is enabled, it performs its intended function and the outputs behave as you would expect. When the chip is disabled, then (usually) all outputs are forced to their inactive state, regardless of the other inputs to the chip. Common names for enable pins include EN, G (for “gate”), and CS (for “chip select”). Active-High versus Active-Low Pins Each input pin and output pin on a chip is either active-high or active-low. In a logic symbol: Active-low pins are marked with a bubble or triangle. Active-high pins have no bubble or triangle. Active-high pins: the pin is active when there’s a HIGH on that pin. Many chips have active-low pins: the pin is active when there’s a LOW on that pin. Example of a Chip With Enable Inputs and Some Active-Low Pins: 74154 Decoder From Floyd, p. 306 From Texas Instrument datasheet Review: Useful Building-Block Circuits Here are some kinds of digital circuits we’ve studied or will study in the weeks ahead: Adders Comparators Decoders Encoders Code converters Multiplexers Latches & Flip-flops Shift registers Counters Memory Chapter 4 Combinational Chapter 5 Chapter 6 Sequential Chapter 7 Decoders, Encoders, & Code Converters Decoders convert a binary code into a single active output representing the code’s value. Encoders generate a coded output from a single active input line. Code converters take one input code (such as BCD) and convert it to another code (such as binary). Decoders A decoder is a logic circuit that detects the presence of a specific combination of bits at its input. Two simple decoders that detect the presence of the binary code 0011 are shown. The first has an active HIGH output; the second has an active LOW output. A0 A1 A0 X A1 X A2 A2 A3 A3 Active HIGH decoder for 0011 Active LOW decoder for 0011 © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved Decoders Assume the output of the decoder shown is a logic 1. What are the inputs to the decoder? A0 = 0 A1 = 1 1 A2 = 0 A3 = 1 © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved Decoders IC decoders have multiple outputs to decode any combination of inputs. For example the hex decoder shown here has 16 outputs – one for each combination of binary inputs. Bin/Dec For the input shown, what is the output? 1 4-bit binary input 1 0 1 A0 A1 A2 A3 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 Decimal outputs © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved Decoders X/Y A specific integrated circuit decoder is the 74154, a 4-to-16 decoder. It includes two active LOW chip select lines which must be at the active level to enable the outputs. These lines can be used to expand the decoder to larger inputs. A0 A1 A2 A3 CS1 CS2 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 2 4 8 & 15 EN 74154 © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved Octal Decoder 3 data input pins for input code. 8 output pins. Also called 1-of-8 decoder or 3-line-to-8-line decoder. May have other inputs and outputs too, such as enable inputs. Example chip: 74138 Hex Decoder 4 data input pins for input code. 16 output pins. Also called 1-of-16 decoder or 4-line-to-16-line decoder. May have other inputs and outputs too, such as enable inputs. Example chip: 74154 BCD Decoder 4 data input pins for input code. 10 output pins. Also called 1-of-10 decoder or 4-line-to-10-line decoder. May have other inputs and outputs too, such as enable inputs. Example chip: 7442 Encoders An encoder accepts an active logic level on one of its inputs and converts it to a coded output, such as BCD or binary. The basic logic diagram is shown. This encoder has an input for each decimal digit, and four outputs that represent the binary code for the active input digit. There is no zero input because the outputs are all LOW when the input is zero. 1 A0 2 3 4 5 6 7 8 A1 A2 A3 9 © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved Encoders Show how the BCD encoder converts the decimal number 3 into a BCD 0011. The top two OR gates have ones as indicated with the red lines. Thus the output is 0011. 1 0 1 2 0 1 3 1 4 5 6 7 8 9 0 0 0 0 0 0 0 0 A0 A1 A2 A3 © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved Encoders The 74147 is an example of an IC encoder. It is has ten active-LOW inputs and converts the active input to an V active-LOW BCD output. CC (16) This device offers additional flexibility in that it is a priority encoder. This means that if more than one input is active, the one with the highest order decimal digit will be active. Decimal input (11) (12) (13) (1) (2) (3) (4) (5) (10) HPRI/BCD 1 2 3 4 5 6 7 8 9 74HC147 The next slide shows an application … 1 2 4 8 (9) (7) (6) (14) BCD output (8) GND © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved VCC Encoders Keyboard encoder R7 7 R8 8 R9 9 HPRI/BCD R4 4 R5 5 R1 1 0 6 R2 2 R0 R6 R3 1 2 3 4 5 6 7 8 9 1 2 4 8 BCD complement of key press 74HC147 3 The zero line is not needed by the encoder, but may be used by other circuits to detect a key press. © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved BCD Encoder 10 input pins. 4 output pins for output code. Also called 10-line-to-4-line encoder. May have other inputs and outputs too, such as enable inputs. Example chip: 74147 Octal Encoder 8 input pins. 3 output pins for output code. Also called 8-line-to-3-line encoder. May have other inputs and outputs too, such as enable inputs. Example chip: 74148 Different Numeric Codes Several different codes exist for using 1s and 0s to represent positive integers. Standard binary code Binary-coded decimal (BCD) Example: In standard binary, 15 is 1111. Example: In BCD, 15 is 0001 0101. Gray code Example: In Gray code, 15 is 1000. Four-Bit Gray Code The key feature of Gray code is that only one bit changes when we increase a number by one. This is not true of standard binary. Why is Gray Code Useful? Gray code is used for rotary encoders that sense the angular position of a shaft or axle. From Wikipedia article on rotary encoders: Standard 3-bit binary code: no good! 3-bit Gray code: better! Code Converters If a digital system needs to handle numbers using two different codes, it needs circuitry to convert between the two codes. Examples of code converters: 74184 BCD-to-binary and binary-to-BCD converter Binary-to-Gray code or Gray-code-tobinary converters (see next slide) Gray Code/Binary Converters Figure 8-40. Binary-to-Gray-code converter Figure 8-41. Gray-code-to-binary converter Multiplexers A multiplexer (MUX) selects one data line from two or more input lines and routes data from the selected line to the output. The particular data line that is selected is determined by the select inputs. Two select lines are shown here to choose any of the four data inputs. Select inputs Which data line is selected if S1S0 = 10? D2 S0 S1 D0 Data D1 inputs D2 D3 0 1 MUX 0 1 0 1 2 3 Data output © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved Some Multiplexer Chips 74150 74151 74153 74157 (16-input MUX) (8-input MUX) (dual 4-input MUX) (quad 2-input MUX) Demultiplexers A demultiplexer (DEMUX) performs the opposite function from a MUX. It switches data from one input line to two or more data lines depending on the select inputs. The 74LS138 was introduced previously as a decoder but can also serve as a DEMUX. When connected as a DEMUX, data is applied to one of the enable inputs, and routed to the selected output line depending on the select variables. Note that the outputs are active-LOW as illustrated in the following example… DEMUX Data select lines Enable inputs A0 A1 A2 G1 G2A G2B Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 Data outputs 74LS138 © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved Demultiplexers Determine the outputs, given the inputs shown. The output logic is opposite to the input because of the active-LOW convention. (Red shows the selected line). DEMUX Data select lines Enable inputs A0 A1 A2 G1 G2A G2B 74LS138 Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 Data outputs A0 A1 A2 G1 G2A LOW G2B LOW Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved Some Demultiplexer Chips 74138 (3-line to 8-line Decoder/DEMUX) 74154 (4-line to 16-line Decoder/DEMUX) 74139 (dual 2-line to 4-line Decoder/DEMUX) Choices in Quartus II In Quartus II you have your choice of generic muxes, decoders, adders, and so on, or ones having the same features as the ones in 74XX-series chips. Type Sample To use the latter, you must Chips know the 74XX number 3-to-8 74138 for the chip you want. decoder Some examples are listed Dual 4-input 74153 here. MUX Recall that Wikipedia has 4-bit full 7483 adder a complete list of 74XX chips (not all of which are available in Quartus.) Choices in Quartus II (Cont’d.) Generic: 74XX: A 74153 chip contains two 4-input muxes, each of which has its own inputs named GN, C0, C1, C2, C3, and its own output named Y. (The A and B inputs are shared between the two muxes.) Choices in Quartus II (Cont’d.) The choices on the previous slide assumed that you’re using schematic entry to draw a diagram of your design. Another alternative is to use text entry with VHDL. Later we’ll see examples of VHDL code for decoders, encoders, multiplexers, and so on.
© Copyright 2026 Paperzz