Monday, December 12, 2011

How do I make a 4x4 K-map for a 2-variable function?

For a (verilogger) multiplier that takes two 2-bit unsigned binary numbers: There are 2^2 = 4 possible combinations (for each variable) and 2^4 = 16 total combinations. A 4x4 K-map would be easy to make except I only have 2 variables. Part of the project requirement is to make truth tables and K-maps, so it must be possible.





Is the sequence below in the correct order for a truth table and K-mapping as well as to follow gray code? If so, what is the correct way to arrange it in an actual K-map and truth table?





A B Product


0 0 0


0 1 0


0 2 0


0 3 0


1 0 0


1 1 1


1 2 2


1 3 3


2 0 0


2 1 2


2 2 4


2 3 6


3 0 0


3 1 3


3 2 6


3 3 9|||K-maps solve boolean algebra, in particular, they deal with


2-value, not 4-value variables. Thus the inputs should be


four 1-bit values.





The single 2-bit input "A" should be two 1-bit inputs, "AB".


The single 2-bit input "B" should be two 1-bit inputs, "CD".





The 4-bit output is really four 1-bit outputs (each with


a separate equation, and separate K-maps).








If you label the 4 output bits as W, X, Y, and Z, then the


the truth tables are:





AB CD W X Y Z


00 00 0 0 0 0


01 00 0 0 0 0


11 00 0 0 0 0


10 00 0 0 0 0





00 01 0 0 0 0


01 01 0 0 0 1


11 01 0 0 1 1


10 01 0 0 1 0





00 11 0 0 0 0


01 11 0 0 1 1


11 11 1 0 0 1


10 11 0 1 1 0





00 10 0 0 0 0


01 10 0 0 1 0


11 10 0 1 1 0


10 10 0 1 0 0





Each output (W, X, Y, and Z) can be quickly placed on a


K-map and solved. Alternatively, I've included the boolean


algebra to reduce each of the output equations:





X = 1011 + 1110 + 1010


X = AB'CD + ABCD' + AB'CD'


X = AB'CD + ABCD' + AB'CD' + AB'CD'


X = AB'CD + AB'CD' + ABCD' + AB'CD'


X = (AB'CD + AB'CD') + (ABCD' + AB'CD')


X = AB'C + ACD'





Y = 1101 + 1001 + 1011 + 0111 + 0110 + 1110


Y = ABC'D + AB'C'D + AB'CD + A'BCD + A'BCD' + ABCD'


Y = ABC'D + AB'C'D + AB'C'D + AB'CD + A'BCD + A'BCD' + A'BCD' + ABCD'


Y = (ABC'D + AB'C'D) + (AB'C'D + AB'CD) + (A'BCD + A'BCD') + (A'BCD' + ABCD')


Y = (AC'D) + (AB'D) + (A'BC) + (BCD')


Y = AC'D + AB'D + A'BC + BCD'





Z = 0101 + 1101 + 0111 + 1111


Z = A'BC'D + ABC'D + A'BCD + ABCD


Z = (A'BC'D + ABC'D) + (A'BCD + ABCD)


Z = (BC'D) + (BCD)


Z = BC'D + BCD


Z = BD








Thus, the final equations are:





W = ABCD


X = AB'C + ACD'


Y = AC'D + AB'D + A'BC + BCD'


Z = BD

No comments:

Post a Comment