Binary Coded Decimal (BCD)

What does BCD stand for?
BCD stands for Binary Coded Decimal.

What is Binary Coded Decimal (BCD) used for?
BCD is used for encoding decimal numbers as binary numbers.

Decoders

What is the purpose of a decoder?
A purpose of a decoder is to convert a binary code into a set of outputs.

What does a decoder do with a binary code as input?
With a binary code as input, a decoder produces a set of outputs where only one output is active at a time.

...

How to build a Decoder?

What is the truth table for a 2x4 decoder?
The truth table for a 2x4 decoder is:

0 0 1 0 0 0
0 1 0 1 0 0
1 0 0 0 1 0
1 1 0 0 0 1

Let's draw the circuit

What is the circuit diagram for a 2x4 decoder?
The circuit diagram for a 2x4 decoder is:
2x4 Decoder.png

Enable Signal

What is an enable signal?
An enable signal is a signal which forces all outputs of a decoder to be 0 if the signal is 0.

What is the symbol for the enable signal if the circuit stops functioning when it's 0?
If the circuit stops functioning when the enable signal is 0, the symbol for it is .

What is the symbol for the enable signal if the circuit stops functioning when it's 1?
If the circuit stops functioning when the enable signal is 1, the symbol for it is .

What is the truth table for a decoder that outputs 4-bits with an enable signal?
The truth table for a decoder that outputs 4-bits with an enable signal is:

0 0 0 0 0 0 0
0 0 1 0 0 0 0
0 1 0 0 0 0 0
0 1 1 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

Generic Decoder Structure

How many inputs and outputs does a decoder for an -bit binary code have?
A decoder for an -bit binary code has inputs and outputs.

What is the symbol for a generic decoder?
The symbol for a generic decoder is:
Generic Decoder.png

Encoder

What does an encoder do?
An encoder generates an encoded value based on which input path is active.

What is the truth table for a 4-bit encoder?
The truth table for a 4-bit encoder is:

0 0 0 1 0 0
0 0 1 0 0 1
0 1 0 0 1 0
1 0 0 0 1 1

Binary Encoder

What is the symbol for a generic encoder?
The symbol for a generic encoder is:
Generic Encoder.png

Priority Encoder

What does a priority encoder do when multiple input paths are active at the same time?
When multiple input paths are active at the same time, a priority encoder encodes the highest priority input.

What is the truth table for a priority encoder where the Most Significant Bit (MSB) is has the highest priority?
The truth table for a priority encoder where the MSB has the highest priority is:

0 0 0 0 DNC DNC
0 0 0 1 0 0
0 0 1 DNC 0 1
0 1 DNC DNC 1 0
1 DNC DNC DNC 1 1

Real-Life Use-case of Priority Encoder: Interrupt Handling

Todo

This slide gives an example use of a priority encoder.

Code Converter

Decoders and encoders are both ... ...
Decoders and encoders are both code converters.

What are encoders used for when it comes to data?
When it comes to data, encoders are used for compression and saving storage space.

What are decoders used for when it comes to data?
When it comes to data, decoders are used for decompression.

Use-case of Code Conversion: 7-Segment Display

Todo

This slide shows an example of how a multi-hot decoder is used to control a 7-segment display.

Arithmetic Comparator

What is the truth table for an arithmetic comparator using a decoder?
The truth table for an arithmetic comparator using a decoder is:

0 0 1 0 0
0 1 0 0 1
1 0 0 1 0
1 1 1 0 0

Multi-bit Comparison: Priority Encoding!

...