lab5
lab5
lab5
DIGITAL ELECTRONIC
GROUP: I3-GEE-C (2)
PHNOM PENH
2.DECODER
A decoder is a digital circuit that detects the presence of a specified combination of
bits (code) on its inputs and indicates the presence of that code by the specified
output level. An example of the basic binary encoder is explained as follows.
2
Suppose you need to determine when the binary 1001 occurs on the inputs of a
digital circuit. You can represent this output which indicates the truth condition
when inputs are 1001 as “X”. We got the relation between inputs and output as
shown in the figure below (Suppose X is active-HIGH output).
3
FIGURE 1: BINARY-TO-DECIMAL DECODER WITH ACTIVE-LOW OUTPUTS
Practice
a. Explain the differences between the active-LOW and active-HIGH outputs of
the decoder.
The main difference between active-LOW and active-HIGH outputs of a
decoder is the logic level that indicates that the output is active. In an active-LOW
4
decoder, the output is active when it is at a logic LOW level. This means that the
output will be high when the input is low, and low when the input is high. In an
active-HIGH decoder, the output is active when it is at a logic HIGH level. This
means that the output will be low when the input is low, and high when the input is
high.
b. Implementing and simulate the decoder above in the software Quartus Prime.
5
FIGURE 3:WAVEFORM’S 4-BIT BINARY-TO-DECIMAL DECODER
6
2.2The BCD-to-Decimal Decoder
The BCD-to-decimal decoder converts each BCD code (8421 code) into one of ten
possible decimal digit indications. It is frequently referred to as a 4-line-to-10-line
decoder or 1-of-10 decoder.
Practice
a. Implement the BCD-to-Decimal decoder in Quartus Prime and verify with the
input waveform below.
7
FIGURE 4:CONNETING LOGIC CIRCUIT OF BCD-TO-DECIMAL DECODER
8
The BCD-to-7-Segment Decoder
The BCD-to-7-Segment decoder accepts the BCD code on its input and provides
outputs to drive 7-segment display devices to produce a decimal readout. The logic
diagram for a basic 7-segment decoder is shown in Figure below
Practice
a.
9
b. Make a truth table for the operation of the BCD-to-7-segment decoder with
common anode 7-Segment display as shown in Figure above.
Decimal A0 A1 A2 A3 a b c d e f g Display
Digital
0 0 0 0 0 1 1 1 1 1 1 0 0
1 0 0 0 1 0 1 1 0 0 0 0 1
2 0 0 1 0 1 1 0 1 1 0 1 2
3 0 0 1 1 1 1 1 1 0 0 1 3
4 0 1 0 0 0 1 1 0 0 1 1 4
5 0 1 0 1 1 0 1 1 0 1 1 5
6 0 1 1 0 1 0 1 1 1 1 1 6
7 0 1 1 1 1 1 1 0 0 0 0 7
8 1 0 0 0 1 1 1 1 1 1 1 8
9 1 0 0 1 1 1 1 1 0 1 1 9
10
11
3. Encoder
An Encoder is a combinational logic circuit that essentially performs a “reverse”
decoder function. An encoder accepts an active level on one of its inputs
representing a digit, such as a decimal or octal digit, and converts it to a coded output,
such as BCD or binary. Encoder can also be devised to encode various symbols and
alphabetic characters. The process of converting from familiar symbols or numbers
to a coded format is called encoding
12
The Decimal-to-BCD Encoder
This type of encoder has 10 inputs, one for each decimal digit, and 4 outputs
corresponding to the BCD code. This is called a 10-line-to-4-line decoder
Practice
a. Implement and simulate the Decimal-to-BCD encoder using Quartus Prime
13
Discussion: The waveform shows a decimal-to-BCD encoder implemented. The
encoder has 10 input lines, one for each decimal digit, and 4 output lines, which
correspond to the BCD code for the decimal digit. The waveform shows the output
of the encoder for the decimal 11 digits 0 to 9. For example, when the input is 0, the
output of the encoder is 0000. When the input is 1, the output of the encoder is 0001,
and so on..
4. Implementation Decoder
FPGA Board a. Component
The following component will be used:
➢ Breadboard
➢ Male-to-female jumper wires
➢ ALTERA Cyclone IV board (EP4CE22F17C6)
Process A 4-bit adder will be used as an example.
Step 1: Board setup (Install the driver and establish a connection)
This step is only needed the first time you connect the FPGA board to your PC.
You need to:
14
Right-click on Alter USB-Blaster and Choose Update.
After drivers are updated, the connection will be established between the PC and
the board.
Note: Driver location depends on the location of your installed software.
Step 2: Device selection In this step, you need to open your project which is
already simulated (Project Adder).
15
Right-click on the name of the device (Ex: Cyclone V) and then change it to the
kind of board you need to use.
16
17
Step 4: Compiling the project Go to Processing → Start Compilation. And wait until you got as
in the figure below.
18
19
20
21
22
23
5. CONCLUSION
after completed the experiment it shown that encoders and decoders are important
components in many electronic systems and he implementation of the decoders on FPGA boards
is a relatively straightforward process and can be used to improve the reliability of transmission
data.
24
25