---
description: In this lab, we are going to design some common combinational devices, we will start by designing decoder and encoder, then we will design a Multiplexer.
---
<h1 style='border: none'><center>Digital Design Lab 7</center></h1>
<h2 style='border: none'><center>Combinational Designs II</center></h2>
<h5><center>The Islamic University of Gaza<br>Engineering Faculty<br>Department of Computer Engineering</center></h5>
<h6>Authors: Usama R. Al Zayan and Enaam Rajab<span style="float:right">2022/11/10</span></h6>
<h6>Parts of this Lab were adapted from work done by Mohammed Nafiz ALMadhoun and Mai Z. Alyazji.</h6>
---
## Introduction
<p style='text-align:justify'>
In this lab, we are going to design some common combinational devices, we will start by designing decoder and encoder, then we will design a Multiplexer.
</p>
## Decoder & Encoder
In this section, we will talk about very useful designs, which are decoders and encoders, as you might notice from the name, the encoder will do the opposite job of the decoder.
### Decoder
The decoder is a device that takes a binary number, and outputs 1 on that number output line, in a more scientific way it converts binary information from $n$ input lines to a maximum of $2^n$ unique output lines.
<center>

3Bit Decoder
</center>
As you notice, we have 3 bits input, thus we will have $2^3=8$ outputs.
Notice that the decoder should make only one output different from the others (Some decoders assign zero to the active line, and one to every other output).
The decoder internal design is very simple that we won't cover!
**Note:** The decoder is a very useful device, you could control the active device using a decoder, or you could implement any truth table using a decoder and OR gates.
### Encoder
The encoder will take $2^n$ inputs and encode them back to binary, notice that one of the inputs should be one and the others should be zeros.
<center>

Useless design that will do nothing!
</center>
As you notice, when we connected our decoder outputs to the encoder inputs, it just outputs the decoder inputs.
Note that this is a priority encoder, which means if two lines are one it will output the bigger number (depends on the design).
<div style="page-break-after: always;"></div>
## Multiplexer
<p style='text-align:justify'>
One of the most important combinational designs is the multiplexer, which will allow you to choose a single data line from many data lines, building a multiplexer is very similar to the encoder, the encoder will output a number that represents the selected line, the multiplexer will pass the data in that line to our output.
</p>
<center>

Multiplexer
</center>
So this design, we've selected A to be in our output by putting the selection bits to `00`.
The design will be more useful if we used more than one multiplexer together to multiplex a data bus
<center>

3-Bits data lines in Mutliplexer
</center>
## Lab Tasks
### Task 1: Prime numbers detector
Using a 3-bit decoder, design a circuit that will detect if the input is a prime number or not, and as you know the prime number from 0 to 7 are 2, 3, 5, 7.
Use a `74LS138` IC (3-bit decoder) and `74LS08` IC (Quad 2-Input AND Gate) to design the detector.
**Note 1:** Design it using Logisim before starting wiring!
**Note 2:** If the number is prime output `0`.
### Task 2: Implementing functions using Multiplexers
Using `KL-33006 block f` (8-input multiplexer) implement the following function:
<center>
$F(A,B,C,D) = ∑(0,2,4,5,8,10,11,15)$
</center>
**Note**: Connect STROBE to 0, Read the result from F.
<center>

</center>
<br/>
## DataSheets
Please find the datasheets here:
**$74/08$** [DM74LS08 Quad 2-Input AND Gates](https://cdn.datasheetspdf.com/pdf-down/7/4/L/74LS08_FairchildSemiconductor.pdf).
**$74/138$** [DM74LS138 3-to-8-line decoders](https://cdn.datasheetspdf.com/pdf-down/7/4/L/74LS138_FairchildSemiconductor.pdf).
**$74/151$** [DM74LS151 1-of-8 Line Data Selector/Multiplexer](https://cdn.datasheetspdf.com/pdf-down/7/4/L/74LS151_FairchildSemiconductor.pdf).
<span style="color:#e20000" >**DON'T POWER UP THE KL-31001 WITHOUT MY PERMSIONS.**</span>
###### tags: `Digital Design` `Digital` `IUG` `Computer Engineering`
<center>End Of Lab 7</center>