Understanding Decoders: Building Blocks for Digital Circuits, Papers of Computer Architecture and Organization

An introduction to decoders, explaining what they are, how they work, and their applications in digital circuits. Decoders are essential components used to decode binary numbers into a 'one-of-four' or 'one-of-eight' code. The concept of decoders, their functionality, and the design process of building a 2-to-4 decoder. It also discusses enable inputs and their role in decoders.

Typology: Papers

Pre 2010

Uploaded on 03/16/2009

koofers-user-xdk-1
koofers-user-xdk-1 🇺🇸

10 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
September 22, 2003 Decoders 1
Decoders
Next, we’ll look at some commonly used circuits: decoders and
multiplexers.
These serve as examples of the circuit analysis and design
techniques from last lecture.
They can be used to implement arbitrary functi ons.
We are introduced to abstraction and modularity as hardware
design principles.
Throughout the semester, we’ll often use decoders and multiplexers as
building blocks in designing more complex hardware.
September 22, 2003 Decoders 2
What is a decoder
In older days, the (good) printers used be like typewriters:
To print “A”, a wheel turned, brought the “A” k ey up, which then was
struck on the paper.
Letters are encoded as 8 bit codes inside the co mputer.
When the particular combination of bits that encodes “A” is
detected, we want to activate the output line corresponding to A
(Not actually how the wheels worked)
How to do this “detection” :
decoder
General idea: given a k bit input,
Detect which of the 2^k combinations is represented
Produce 2^k outputs, only one of which is “1”.
September 22, 2003 Decoders 3
What a decoder does
A n-to-2ndecoder takes an n-bit input and produces 2noutpu ts. The n
inputs represent a binary number that deter mines which of the 2n
outputs is
uniquely
true.
A 2-to-4 decoder operates according t o the following truth table.
The 2-bit input is called S1S0, and the four outputs are Q0-Q3.
If the input is the binary number i, then output Q i is uniquely true.
For instance, if the input S1 S0 = 10 (decimal 2), then output Q2 is
true, and Q0, Q1, Q3 are all false.
This circuit “decodes” a binary number into a “ one-of-four” code.
S1 S0 Q0 Q1 Q2 Q3
00 1 0 0 0
010 10 0
100 0 1 0
11000 1
September 22, 2003 Decoders 4
How can you build a 2-to-4 decoder?
Follow the design procedures from last tim e! We have a truth table, so
we can write equations for each of the four ou tputs (Q0-Q3), based on
the two inputs (S0-S1).
In this case there’s not much to be simplified. Here are the equations:
S1 S0 Q0 Q1 Q2 Q3
00 1 0 0 0
010 10 0
100 0 1 0
11000 1
Q0 = S1’ S0’
Q1 = S1’ S0
Q2 = S1 S0’
Q3 = S1 S0
September 22, 2003 Decoders 5
A picture of a 2-to-4 decoder
S1 S0 Q0 Q1 Q2 Q3
00 1 0 0 0
010100
1000 1 0
11000 1
September 22, 2003 Decoders 6
Enable inputs
Many devices have an additional enable input, which is used to “activate”
or “deactivate” the device.
For a decoder,
EN=1 activates the decoder, so it behaves as specified earlier.
Exactly one of the outputs will be 1.
EN=0 “deactivates” the decoder. By conven tion, that means
all
of
the decoder’s outputs are 0.
We can include this additional input in the decoder’s truth table:
EN S1 S0 Q0 Q1 Q2 Q3
0000 000
001 0 000
0100000
0110 000
1001000
1010100
1100010
1110001
pf3
pf4

Partial preview of the text

Download Understanding Decoders: Building Blocks for Digital Circuits and more Papers Computer Architecture and Organization in PDF only on Docsity!

September 22, 2003 Decoders 1

Decoders

• Next, we’ll look at some commonly used circuits: decoders and

multiplexers.

– These serve as examples of the circuit analysis and design

techniques from last lecture.

– They can be used to implement arbitrary functions.

– We are introduced to abstraction and modularity as hardware

design principles.

• Throughout the semester, we’ll often use decoders and multiplexers as

building blocks in designing more complex hardware.

September 22, 2003 Decoders 2

What is a decoder

• In older days, the (good) printers used be like typewriters:

– To print “A”, a wheel turned, brought the “A” key up, which then was

struck on the paper.

• Letters are encoded as 8 bit codes inside the computer.

– When the particular combination of bits that encodes “A” is

detected, we want to activate the output line corresponding to A

– (Not actually how the wheels worked)

• How to do this “detection” :decoder

• General idea: given a k bit input,

– Detect which of the 2^k combinations is represented

– Produce 2^k outputs, only one of which is “1”.

September 22, 2003 Decoders 3

What a decoder does

• A n-to-2n^ decoder takes an n-bit input and produces 2 n^ outputs. The n

inputs represent a binary number that determines which of the 2n

outputs isuniquely true.

• A 2-to-4 decoder operates according to the following truth table.

– The 2-bit input is called S1S0, and the four outputs are Q0-Q3.

– If the input is the binary number i, then output Qi is uniquely true.

• For instance, if the input S1 S0 = 10 (decimal 2), then output Q2 is

true, and Q0, Q1, Q3 are all false.

• This circuit “decodes” a binary number into a “one-of-four” code.

S1 S0 Q0 Q1 Q2 Q

September 22, 2003 Decoders 4

How can you build a 2-to-4 decoder?

• Follow the design procedures from last time! We have a truth table, so

we can write equations for each of the four outputs (Q0-Q3), based on

the two inputs (S0-S1).

• In this case there’s not much to be simplified. Here are the equations:

S1 S0 Q0 Q1 Q2 Q

Q0 = S1’ S0’

Q1 = S1’ S

Q2 = S1 S0’

Q3 = S1 S

A picture of a 2-to-4 decoder

S1 S0 Q0 Q1 Q2 Q

Enable inputs

• Many devices have an additional enable input, which is used to “activate”

or “deactivate” the device.

• For a decoder,

– EN=1 activates the decoder, so it behaves as specified earlier.

Exactly one of the outputs will be 1.

– EN=0 “deactivates” the decoder. By convention, that meansall of

the decoder’s outputs are 0.

• We can include this additional input in the decoder’s truth table:

EN S1 S0 Q0 Q1 Q2 Q

September 22, 2003 Decoders 7

An aside: abbreviated truth tables

• In this table, note that whenever

EN=0, the outputs are always 0,

regardless of inputs S1 and S0.

• We can abbreviate the table by

writing x’s in the input columns

for S1 and S0.

EN S1 S0 Q0 Q1 Q2 Q

EN S1 S0 Q0 Q1 Q2 Q

0 x x 0 0 0 0 1 0 0 1 0 0 0 1 0 1 0 1 0 0 1 1 0 0 0 1 0 1 1 1 0 0 0 1

September 22, 2003 Decoders 8

• Decoders are common enough that we want to encapsulate them and

treat them as an individual entity.

• Block diagrams for 2-to-4 decoders are shown here. Thenames of the

inputs and outputs, not their order, is what matters.

• A decoder block provides abstraction:

– You can use the decoder as long as you know its truth table or

equations, without knowing exactly what’s inside.

– It makes diagrams simpler by hiding the internal circuitry.

– It simplifies hardware reuse. You don’t have to keep rebuilding the

decoder from scratch every time you need it.

• These blocks are like functions in programming!

Blocks and abstraction

Q0 = S1’ S0’

Q1 = S1’ S

Q2 = S1 S0’

Q3 = S1 S

September 22, 2003 Decoders 9

A 3-to-8 decoder

• Larger decoders are similar. Here is a 3-to-8 decoder.

– The block symbol is on the right.

– A truth table (without EN) is below.

– Output equations are at the bottom right.

• Again, only one output is true for any input combination.

S2 S1 S0 Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q

Q0 = S2’ S1’ S0’

Q1 = S2’ S1’ S

Q2 = S2’ S1 S0’

Q3 = S2’ S1 S

Q4 = S2 S1’ S0’

Q5 = S2 S1’ S

Q6 = S2 S1 S0’

Q7 = S2 S1 S

September 22, 2003 Decoders 10

So what good is a decoder?

• Do the truth table and equations look familiar?

• Decoders are sometimes called minterm generators.

– For each of the input combinations, exactly one output is true.

– Each output equation contains all of the input variables.

– These properties hold for all sizes of decoders.

• This means that you can implement arbitrary functions with decoders.

If you have a sum of minterms equation for a function, you can easily

use a decoder (a minterm generator) to implement that function.

S1 S0 Q0 Q1 Q2 Q

Q0 = S1’ S0’

Q1 = S1’ S

Q2 = S1 S0’

Q3 = S1 S

Design example: addition

• Let’s make a circuit that adds three 1-bit inputs X, Y and Z.

• We will need two bits to represent the total; let’s call them C and S, for

“carry” and “sum.” Note that C and S are two separate functions of the

same inputs X, Y and Z.

• Here are a truth table and sum-of-minterms equations for C and S.

X Y Z C S

0 + 1 + 1 = 10 C(X,Y,Z) =^ Σm(3,5,6,7)

S(X,Y,Z) = Σm(1,2,4,7)

• Here, two 3-to-8 decoders implement C and S as sums of minterms.

• The “+5V” symbol (“5 volts”) is how you represent a constant 1 or true in

LogicWorks. We use it here so the decoders are always active.

Decoder-based adder

C(X,Y,Z) = Σm(3,5,6,7)

S(X,Y,Z) = Σm(1,2,4,7)

Active-low decoder example

• So we can use active-low decoders to implement arbitrary functions

too, but as a product of maxterms.

• For example, here is an implementation of the function from the

previous page, f(x,y,z) = ΠM(4,5,7), using an active-low decoder.

• The “ground” symbol connected to EN represents logical 0, so this

decoder is always enabled.

• Remember that you need an AND gate for a product of sums.

Summary

• A n-to-2n^ decoder generates the minterms of an n-variable function.

– As such, decoders can be used to implement arbitrary functions.

– Later on we’ll see other uses for decoders too.

• Some variations of the basic decoder include:

– Adding an enable input.

– Using active-low inputs and outputs to generate maxterms.

• We also talked about:

– Applying our circuit analysis and design techniques to understand

and work with decoders.

– Using block symbols to encapsulate common circuits like decoders.

– Building larger decoders from smaller ones.