---
# System prepended metadata

title: Digital Design Lab 4
tags: [IUG, Digital Design, Computer Engineering, Digital]

---

---
description: In this lab, we are going to talk about how to convert your ideas to the actual design, we will start by analysing the idea, extracting inputs, finally, we will talk about how to optimize your design in different ways.
---
<h1 style='border: none'><center>Digital Design Lab 4</center></h1>
<h2 style='border: none'><center>From Idea To Design<br>Simplification using Karnaugh Map</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/10/15</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 talk about how to convert your ideas to the actual design, we will start by analysing the idea, extracting inputs, finally, we will talk about how to optimize your design in different ways.
</p>

## Analyzing Idea
In this section, we will learn how to build a system from an idea to real logic gates, note that these designs will not have any memory element.

### Extracting Inputs and Outputs
<p style='text-align:justify'>
When you think about any system you interact with, you should notice that you won't know the internals of that system, but you rather know what is the inputs, outputs of this system.
</p>

If we take the coffee machine as an example, you know that the inputs of that system are:
- Money
- Suger Amount
- Drink Choice

and the outputs are:
- The Drink!
- The Change

Now, for any other system and ideas, you will come with, you should start first by analyzing the inputs and outputs of your system.

<div style="page-break-after: always;"></div>

### Inputs & Outputs Relations

<p style='text-align:justify'>
The output of the system should be expected from the inputs, you won't expect a cup of Espresso if you ordered a French Coffee from the coffee machine.
Even for systems that appear to generate random outputs, there are inputs (e.g. Time).
</p>


<p style='text-align:justify'>
So After knowing your inputs & outputs, you should find the relation between the inputs and the outputs.
</p>

### Design & Optimization

<p style='text-align:justify'>
Now, it's time to design your system, by knowing the relations between inputs and outputs, you could easily write the truth table for the system, and convert the truth table to boolean expressions then gates.
</p>



<p style='text-align:justify'>
The final step will be optimizing your design, the word optimizing could mean a lot of things for example:

- Minimum Resources
- Faster Speed
- Lower Budget
</p>

So you should focus on what you're going to optimize for (e.g today you will optimize your design to use only `NAND` gates because of your limited resources 😶)

## Sum-Of-Products

<p style='text-align:justify'>
One of the easiest methods to design your system is to use the sum of products technique, and it is pretty easy and systematic, after creating your truth table, you should write the boolean expression that makes a single line true, then sum them all together (By adding OR between each expression),
After that, you will just optimize your last boolean expression.
</p>

<div style="page-break-after: always;"></div>


![Minterms and Maxterms for Three Binary Variables](https://i.imgur.com/gft3s8D.png)

<center>
Figure 1: Minterms and Maxterms for Three Binary Variable

</center>
<div style="page-break-after: always;"></div>

## Karnaugh Map (K-Map)

<p style='text-align:justify'>
A <b>K-map</b> is a diagram made up of squares, with each square representing one minterm of the function that is to be minimized. Since any Boolean function can be expressed as a sum of minterms, it follows that a Boolean function is recognized graphically in the map from the area enclosed by those squares whose minterms are included in the function. In fact, the map presents a visual diagram of all possible ways a function may be expressed in standard form. By recognizing various patterns, the user can derive alternative algebraic expressions for the same function, from which the simplest can be selected.
</p>

<center>
    
![Two-variable K-map](https://i.imgur.com/HWC32YM.png =400x)
Figure 2: Two-variable K-map
</center>

<center>
    
![](https://i.imgur.com/S71Xbk8.png)
Figure 3: Three-variable K-map
</center>


## Chapter 3 Notes
**NOTE:** Please read Chapter 3 in your textbook very carefully, it is a very important chapter, and each minimization method is very important and useful, and here is a list of examples:
- If your truth table has a lot of ones, **product-of-sums** will be easier and more efficient than **sum-of-products**.
- Solving **K-Map** is easier than doing boolean algebra, and it's systematic.
- **Don't-Care** conditions are very important, and you should look at them carefully, they will do a huge difference in your design.

## Lab Tasks

### Task 1: Design half-adder

The **half-adder** is a thing that could add two bits together, design the half-adder, fill its truth table, then write to boolean expression for its outputs.

### Task 2: Simulate half-adder

In this task, you should convert your previous design to only `NAND` gates, then you should simulate it once using **gates**, and the other using **ICs**.

Test your design, and ensure that you go the output correctly.

### Task 3: Build half-adder

After simulating the half-adder, you should build it using `NAND` IC, which is 74/00.

<br/>
<br/>

<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 3</center>