Digital Logic Design Lecture # 7 University of Tehran.

23
Digital Logic Design Lecture # 7 University of Tehran

Transcript of Digital Logic Design Lecture # 7 University of Tehran.

Page 1: Digital Logic Design Lecture # 7 University of Tehran.

Digital Logic Design

Lecture # 7University of Tehran

Page 2: Digital Logic Design Lecture # 7 University of Tehran.

Outline

Verilog More on Minimization by KM Don’t Care Terms Hazard Quine-McCluskey Method for

Minimization

Page 3: Digital Logic Design Lecture # 7 University of Tehran.

Verilog Continuing our discussion on Verilog, consider

for instance a situation where we want to simulate a circuit such as the below shown. The code for this circuit would look like this:

module function(a, b, c, d, w); input a, b, c, d; output f;

wire w, y; and #( , ) u1(w, a, b); nand #( , ) u2(y, c, d); nor #( , ) u3(f, y, w); endmodule

a

b

c y

w

f

d

Page 4: Digital Logic Design Lecture # 7 University of Tehran.

Verilog (continued…) As you can see we can also include timing

conditions for the gates as we did for transistors. The only difference is that we have at most 2 values showing the transition to 1 and transition to 0 delay times. There is no third value included because at gate level, transition to Z doesn’t have any meaning.

Page 5: Digital Logic Design Lecture # 7 University of Tehran.

More on Minimization by KM We saw before how switching functions of up to

5 variables could be minimized using karnaugh maps. We will now show a 6 variables karnaugh map which is practically the largest karnaugh map we will ever use.

1

4

cd

ef

000

1 5

73

2 6

01

11

10

812

13 9

1115

14 10

00 01 11 10

400

0

1 5

73

2 6

01

11

10

812

13 9

1115

14 10

00 01 11 10

400

0

1 5

73

2 6

01

11

10

812

13 9

1115

14 10

00 01 11 10

400

0

1 5

73

2 6

01

11

10

812

13 9

1115

14 10

00 01 11 10

0

0

1

ab

cd

cd cd

ef

ef ef

1

1 1

1

Page 6: Digital Logic Design Lecture # 7 University of Tehran.

More on Minimization by KM (continued…) Adjacency rules are maintained as they were

before. We can consider these four 4 variables maps stacked onto each other to help us visualize the adjacency rules between them. For instance, the term representing the four shown minterms would be

This will be the largest karnaugh map we will ever use. Using karnaugh maps for switching functions of a larger number of variables would be impractical.

.defc

Page 7: Digital Logic Design Lecture # 7 University of Tehran.

Don’t Care Terms In some functions, not all combinations of the

used number of variables can occur. For instance when the input of a circuit is in BCD form, we will only be receiving inputs of the binary numbers 0000 through 1001, in other words we don’t care what the outputs to these particular conditions are, because they will not be occurring in our problem. When using a karnaugh map for minimization, these terms need not be covered necessarily and are only considered to be 1 if they help us in covering a larger arena with certain maps.

Page 8: Digital Logic Design Lecture # 7 University of Tehran.

Don’t Care Terms (continued…) Note: Don’t care terms can not be used to

distinguish between implicants and prime implicants.

Note: Don’t care terms are not specified to be 0 or 1 until after a mapping has been done. It is also not necessary to consider the same don’t cares of a function that we have mapped as 1s in a SOP form, as 1s when mapping for a POS form. Consider for instance a case where we want to map the following karnaugh map for both SOP and POS form.

Page 9: Digital Logic Design Lecture # 7 University of Tehran.

Don’t Care Terms (continued…)

40 0

0 1

000

1 5

71 0

0 1

3

2 6

01

11

10

8- 0

- 1

12

13 9

11- -

- -

15

14 10

00 01 11 10

*

* *

A2 A1 A0 A2 A1 A0 A2 A1 A0A3 A0+ + +

A0A1

A2A3

*

40 0

0 1

000

1 5

71 0

0 1

3

2 6

01

11

10

8- 0

- 1

12

13 9

11- 0

- -

15

14 10

00 01 11 10

*

*

*

A2A3

A0A1

*

(A1+A0)(A3+A2+A1)(A2+A1+A0)(A2+A0)

Page 10: Digital Logic Design Lecture # 7 University of Tehran.

Hazard Consider the following gate structure and its

timing diagram (numbers on the gates show their delays):

a

b

c

y

w

xv

5

7

3

7

a

b

c

v

x

w

y

1

0

1

0

1

0

1

0

1

0

1

0

1

0

5 5

12 12

7 7

5

3

Page 11: Digital Logic Design Lecture # 7 University of Tehran.

Hazard (continued…) As we can see after a period of time and after

changes have occurred, ‘y’ finally becomes 1. But for a small period of time, both of the gates have 0 on their outputs and thus cause ‘y’ to become 0 for 5ns.

Page 12: Digital Logic Design Lecture # 7 University of Tehran.

Hazard (continued…) Let’s look at what has happened more

carefully: When the input of the circuit changes from 111 to 101, there shouldn’t actually be any change in the circuit’s output theoretically but because the delay of one of the two paths which ‘b’ is passing through to reach the output is more than the other, an unwanted pulse known as a glitch (or a 1-hazard in this case) is occurring where the output drops to 0 for 5ns.

Page 13: Digital Logic Design Lecture # 7 University of Tehran.

Hazard (continued…) We would have never observed such problems

by only taking the switching algebra to mind, because this is a problem caused by the physics of our realization.

What we want to know is how to identify and solve such problems before they occur, that is while they are still potential hazards.

Consider for instance the karnaugh map of the last example that we have:

2

1

ab

c00

0

1

0

1 3

41

1 1

6

7 5

01 11 10

Page 14: Digital Logic Design Lecture # 7 University of Tehran.

Hazard (continued…) To identify where potential hazards may occur

from a KM, we must realize the fact that there can only be a hazard where an input is passed through to the output by more than one path. That is, on the KM, potential hazards only occur when we move from one 1 to another when they are not covered in one map. Whether or not this potential hazards turn into reality depends on the actual gate timings. To eliminate such potential hazards we must map those particular 1s thus using redundant map.

redundant map

2

1

ab

c00

0

1

0

1 3

41

1 1

6

7 5

01 11 10

Page 15: Digital Logic Design Lecture # 7 University of Tehran.

Hazard (continued…) Example:

Potential hazards:01010001

01110011

In these cases, we can’t be sure that hazards occur, but because of the disjoint mapping, it is possible. To eliminate this chance, we can add the map and write

da.dabdba

41

1 1

ab

cd

000

1 5

71 1

1

3

2 6

01

11

10

8

1

12

13 9

111

15

14 10

00 01 11 10

redundant map

Page 16: Digital Logic Design Lecture # 7 University of Tehran.

Hazard (continued…) Quote: 0-hazards can occur in the same shape as

1-hazards but in POS representation of the circuit. Another type of hazard, which occurs less often

than the hazards mentioned so far (static hazards) is called a dynamic hazard. There are two kinds of dynamic hazards with two different waveforms which are :

Page 17: Digital Logic Design Lecture # 7 University of Tehran.

Hazard (continued…) It can be proven that dynamic hazards are

results of static hazards. For instance it is quite obvious that the second waveform can occur as a result of two static hazards that occur after each other.

The reason dynamic hazards occur less often is that they often involve a change in 2 variables of the switching function in a very short period or at one instance.

Page 18: Digital Logic Design Lecture # 7 University of Tehran.

Quine-McCluskey Method for Minimization Up until now, all methods of minimization we

have used were practical for a small number of variables. For example, the KM was practical for at most 6 variable functions. For functions of a larger number of variables, we need method that can be applied to computer based minimization. One method that we can use for this means is the Quine-McCluskey method that uses the following steps. For example:

)15,13,7,5,3,2,1,0(m

Page 19: Digital Logic Design Lecture # 7 University of Tehran.

Quine-McCluskey Method for Minimization (continued…)

It is obvious that only minterms that differ in one variable’s value can be combined. Thus we list our minterms so that they are in groups with each group having the same number of 1s. So the first step is ordering the minterms according to their number of 1s (0-cube list) as shown below for this example (In such groups, only minterms residing in adjacent groups have the chance to be combined.):

0 0 0 0

0 0 0 1

0 0 1 0

0 0 1 1

0 1 0 1

1 1 0 1

1 1 1 1

0 1 1 1

1

2

3

4

5

0_cube

The checkmarks arepart of the next stage.

Page 20: Digital Logic Design Lecture # 7 University of Tehran.

Quine-McCluskey Method for Minimization (continued…)

Compare minterms of a group with those of an adjacent one to form 1-cube list. When doing the combining, we put checkmark alongside the minterms in the 0-cube list that have been combined.

The checkmarks arepart of the next stage.

0 0 0 x

0 0 x 0

0 0 x 1

0 0 0 1

0 x 1 1

x 1 0 1

x 1 1 1

0 1 x 1

1

2

3

4

1_cube

0 0 1 x

1 1 x 1

Group 1,2

Group 2,3

Group 3,4

Group 4,5

Page 21: Digital Logic Design Lecture # 7 University of Tehran.

Quine-McCluskey Method for Minimization (continued…)

We do the same combination procedure of comparing adjacent group minterms to form 2-cubes, 3-cubes and so on. While doing so, it can be seen that only minterms of adjacent groups have the chance of being combined which have an X in the same position.

0 0 x x

0 0 x x

0 x x 1

0 x x 1

x 1 x 1x 1 x 1

2_cube

Group 1,2

Group 2,3

Page 22: Digital Logic Design Lecture # 7 University of Tehran.

Quine-McCluskey Method for Minimization (continued…)

PIs are those terms left without checkmarks. After identifying our PIs, we list them against the minterms

needed to be covered in the following manner:

0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 1 0 1 1 1 1 1 0 1 1 1 1 1

0 0 x x

0 x x 1

x 1 x 1

Func

Page 23: Digital Logic Design Lecture # 7 University of Tehran.

Quine-McCluskey Method for Minimization (continued…)

To find a minimal cover, we first need to find essential PIs. To do this we need to find columns that only have one checkmark in them, the according row will thus show the essential PI. After identifying essential PIs, that are necessarily part of the cover, we cover any remaining minterms using a minimal set of PIs. In this example:

bdbadcbaF ),,,(