k map
DESCRIPTION
Software to convert a given input equation to its simplified form using K-map using C++TRANSCRIPT
![Page 1: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/1.jpg)
K-MAP TOOL
SOLVING EQUATIONS MADE EASY…..
![Page 2: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/2.jpg)
SUBMITTED BY
DEEPAK R -
2SD08EE022
KUMAR PATIL -2SD08EE030
NAGAPPA D V -
2SD08EE033
UNDER THE GUIDANCE OF
PROF. H N VIJAYMURTHY
![Page 3: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/3.jpg)
Problem statement
Development of an application software called K-Map software tool which gives the simplified
Boolean equation.
![Page 4: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/4.jpg)
NEED TO SIMPLIFY EQUATIONS..?
![Page 5: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/5.jpg)
prerequisite
• BOOLEAN ALGEBRA-
Boolean algebra is formal way to
express digital logic equations and to
represent a logical design in an alpha-numeric
way. It is a language of 0’s and 1’s.
• A Boolean function is an expression formed
with binary variables which makes use of logic
gates based on Boolean algebra
e.g.F1=xyz’ where F1=1 only if x=1,y=1,z=0
![Page 6: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/6.jpg)
• Sum-of-products form (SOP) – first the product(AND) terms are formed then these are summed(OR) – e.g.: ABC + DEF + GHI
• Product-of-sum form (POS) – first the sum (OR) terms are formed then the products are taken (AND) – e.g.: (A+B+C) (D+E+F) (G+H+I)
• It is possible to convert between these two forms using Boolean algebra (DeMorgan’s Laws)
![Page 7: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/7.jpg)
Minimization by Karnaugh Map
The Karnaugh map is a theoretical method for the simplification of any Boolean expressions regardless of its number of variables.
It provides simple straightforward approach for minimizing Boolean functions.
It either regarded as pictorial form of truth table or as an extension of the Venn diagram.
![Page 8: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/8.jpg)
Example: Let’s do this in relation to the 3-input example
S A B Y
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1 result: Y = S.B + S’.A
![Page 9: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/9.jpg)
main ( )
read input
validate input
derive truth table
generate k-map
solve k-map
solve for 2 var
quad
pair
solve for 3 var
octet
quad
pair
solve for 4 var
1
octet
quad
pair
display
2var
3var
4var
Architectural design
![Page 10: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/10.jpg)
![Page 11: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/11.jpg)
Algorithm int read input ()
// Input : No of variable n , Input// Output : Formation Of Input Truth Table Array {
step1: read the no of variables
if it is 2, 3 or 4
go to step 2
step2: read the type of input
case 1: if minterm with literals check validity of input if valid form the input array case 2: if maxterm with literals check validity of input if valid form the input array
![Page 12: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/12.jpg)
case 3: if minterm with truth table values
check validity of input
if valid form the input array
case 4: if maxterm with truth table values
check validity of input
if valid form the input array } // end of Read Input
![Page 13: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/13.jpg)
Algorithm int formKmap (int n)
// input : no of variable (n) , Integer array input[2^n ]
//output : two dimensional matrix say
//Forms the k map depending on the type of input
{
k=0;
for (i=0;i < no. of rows ;i++)
for (j=0;j < no. of columns; j++)
{ k mat [ i ][ j ] = min[k];
k++;
}
if n is 3
Swap the columns 3 & 4 in the k mat
if n is 4
Swap the columns 3 & 4 and rows 3 and 4 in the k mat
} // end of form K-map
![Page 14: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/14.jpg)
SolveKmap (k mat [ ][ ],n )
// input : no of variable (n) , k mat
// calls other functions depending on value of n
{ if n is 2
solve2var (k mat [ ][ ])
if n is 3
solve3var (k mat [ ][ ])
if n is 4
solve4var (k mat [ ][ ])
} // end
![Page 15: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/15.jpg)
Algorithm solve2var(k mat [ ][ ] )
// input : no of variable (n) , k_mat
// solves the given k_mat with n=2 and calls display function
{
check for all ones in k mat
if True push 1 to the linked list
else if
the group formed is in pairs then send the group value to the list
else if only one variable in the matrix is one then send
its group value to the list.
Display();}
![Page 16: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/16.jpg)
Algorithm solve3var (k_mat [ ][ ])
// input : no of variable (n) , k mat
// solves the given k mat with n=2 and calls display function
{
check for all k mat [ i ] [ j ] =1
if true
o list.Push_front (1);
set all flag [ i ] [ j ] =1; else Quad;
Pair;
Single;
Display ( ); }
![Page 17: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/17.jpg)
Algorithm solve4var (k_mat [ ][ ])
// input : no of variable (n) , k_mat
// solves the given k_mat with n=2 and calls display function
{
check for all k mat [ i ] [ j ] =1
if true o_list.Push_front (1);
set all flag [ i ] [ j ] as 1;
else Octet;
Quad;
Pair ;
Single ;
Display ( ); } // end
![Page 18: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/18.jpg)
Algorithm Octet (k_mat , flag)// input : no of variable (n) , k_mat
// find the respective quad and push its group value to the O_list
{
for (i=0;i < 4 ;i++)
for (j=0;j < 4; j++)
{ if ( k_mat [ i ][ j ] = 1 && flag [ i ] [ j ] =0)
{
search for a octet
if exist
//push the respective group value
outeq ( i, j);
set all positions in the flag matrix as 1
}
}
} // end of octet
![Page 19: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/19.jpg)
Algorithm Quad (k_mat , flag)
// input : K_mat , flag
// find the respective quad and push its group value to the O_list
{
for (i=0;i < 4 ;i++)
for (j=0;j < 4; j++)
{ if ( k_mat [ i ][ j ] = 1 && flag [ i ] [ j ] =0)
{
search for a Quad
if exist
push the respective group value
set all positions in the flag matrix as 1
}
}
} // end of Quad
![Page 20: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/20.jpg)
Algorithm Pair (k_mat , flag)
// input : K_mat , flag
// find the respective Pair and push its group value to the O_list
{
for (i=0;i < 4;i++)
for (j=0;j < 4; j++)
{ if ( k_mat[ i][ j ] = 1 && flag [ i ] [ j ] =0)
{
find a adjacent one
push the respective group value
set all positions in the flag matrix as 1
}
}
} // end of Pair
![Page 21: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/21.jpg)
Tool can be a part of sequential circuit designing software.
Aids to practical method of designing sequential circuits with multi input.
It can be included in systems which involve in process of simplifying expressions frequently.
The tool can be incorporated in educational fields as in by the text book designers, staff and students themselves to verify their answers.
application
![Page 22: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/22.jpg)
CONCLUSION
conclusion
K-Tool can be used for reducing Boolean expressions.
User specified Boolean expression is converted to is simpler form through various stages.
User is able to get output for 2,3,4 variable equations
Input is processed in various different forms of input to achieve simplicity
Its a tool for deductive reasoning in designing digital logic circuits and machines
![Page 23: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/23.jpg)
FUTURE SCOPE
Tool can be extended to handle more number of
variables.
Tool can be modified to handle DON’T CARE
conditions.
Can be enhanced to obtain possible alternate
solutions.
The gate implementation of the input and output
equations can be shown for comparison.
![Page 24: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/24.jpg)
REFERENCES Books:
Digital Fundamentals -Thomas L. Floyd
Digital Principles and Applications -Albert Paul Malvino
and Donald P. Leach
Digital Logic and Computer Design -M. Morris Mano
Website: http://en.wikipedia.org/wiki/Karnaugh_map
![Page 25: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/25.jpg)
Any queries…??
![Page 26: K map](https://reader031.vdocument.in/reader031/viewer/2022013121/555cdd3fd8b42a4f2b8b547e/html5/thumbnails/26.jpg)
Thank you..