Electronic – How to make a Karnaugh Map with “don’t care” inputs

digital-logicinputkarnaugh mapverilog

I know that don't cares mean that it doesn't matter whether it is a 0 or a 1 and when don't cares are just outputs I can kind of understand how they work. But I am having a really hard time understanding how they work when they are inputs.

I have read that when an input is a don't care the whole input doesn't count. But if one or more of the inputs no longer count then how do you make a k-map? Don't k-maps use the first two and latter two in a longitude latitude sort of way when you mark down the outputs?

Here is what I am currently working on:

inputs    outputs 
A B C D | Q R S
0 0 0 0 | x x 0
0 0 0 1 | 0 0 1
0 0 1 x | 0 1 1
0 1 x x | 1 0 1
1 x x x | 1 1 1

my first attempt at making a k-map:

  00 01 1X
0 X    
0
0 0
1
1 0
X
X    1   1
X    

Then I was theorizing that if they don't count that means that the bit length is either shortened or the don't cares count as 1's or zeros if it is shortened I was thinking it is like this:

1XXX=1'b1 = 1
01XX=2'b01=1

but if that is true wouldn't

0 1 x x | 1 0 1
1 x x x | 1 1 1

not be like that and instead the out puts would be identical?

Or perhaps it is what I first thought and it's like:

0 1 x x | 1 0 1 means put an output in 5,6, and 7? Or maybe just 7?

Finally how do you mark things as don't care in the test bench? Do you even mark them at all? Is there a specific mark?

Best Answer

Here's how to create the K-Map for the Q output. Remember that you need to do a separate Karnaugh Map for each of the three outputs.

inputs    output 
A B C D | Q
0 0 0 0 | x
0 0 0 1 | 0
0 0 1 x | 0
0 1 x x | 1
1 x x x | 1
  1. 0000 = x. This first line is standard. The "don't care" is an output. Simply put the "x" in the appropriate place.

k1

  1. 0001 = 0. This next line is also standard. Put the "0" where it belongs.

k2

  1. 001x = 0. The third line contains a "don't care" input. In this case, there should be an output of "0" for both 0010 and 0011. Insert these into the map:

k3

  1. 01xx = 1. Similarly, the fourth line states that there should be a "1" in all of the following cases: 0100, 0101, 0110, and 0111. Put these in the map:

k4

  1. 1xxx = 1. Following the same reasoning, the last line does the following:

k5

Now, do the same for your R and S outputs!