Escolar Documentos
Profissional Documentos
Cultura Documentos
Par t=news_00003&Rcg=1
2010/10/4
CH080512
Figure 8.39
2010/10/4 CH080512 2
11 0 00 0 01 1 10 1 01 0 10 0 11 1
G 00 1 G: carry-in = 0 H: carry-in = 1
Figure 840
2010/10/4 CH080512 3
Figure 841
2010/10/4 CH080512 4
Figure 842
2010/10/4 CH080512 5
a b
s Full adder Y
carry-out
Q Q
Clock Reset
Figure 8.43
2010/10/4 CH080512
Figure 8.44
G0: sum = 0, carry = 0; G1: sum = 1, carry = 0; H0: sum = 0, carry = 1; H1: sum = 1, carry = 1;
2010/10/4 CH080512 7
Figure 8.45
2010/10/4 CH080512 8
Figure 8.46
2010/10/4 CH080512 9
Figure 8.47
2010/10/4 CH080512 10
Figure 8.48
11
Figure 8.50
2010/10/4 CH080512 12
2010/10/4
CH080512
Figure 8.49
13
State encoding with more bits (e.g., One-hot) has simpler equations
Complexity directly related to complexity of state diagram
Algorithm sketch
Place all states in one set Initially partition set based on output behavior Successively partition resulting subsets based on next state transitions Repeat until no further partitioning is required
States left in the same set are equivalent
Example 8.6
Figure 8.51
2010/10/4 CH080512 16
Figure 8.52
2010/10/4 CH080512 17
Suppose that a coin-operated vending machine dispenses candy under the following conditions:
The machine accepts nickels and dimes. It takes 15 cents for a piece of candy to be released from the machine. If 20 cents is deposited, the machine will not return the change, but it will credit the buyer with 5 cents and wait for the buyer to make a second purchase.
2010/10/4
CH080512
18
Figure 8.54
2010/10/4 CH080512 20
Figure 8.55
2010/10/4 CH080512 21
Figure 8.56
2010/10/4 CH080512 22
Figure 8.57
2010/10/4 CH080512 23
Figure 8.58
2010/10/4 CH080512 24
Figure 8.59
2010/10/4 CH080512 25
2010/10/4
CH080512
26
Example
2010/10/4
CH080512
27
No polynomial time algorithm exists for determining best grouping of states into equivalent sets that will yield the smallest number of final states .
2010/10/4 CH080512 28
State Assignment
Choose bit vectors to assign to each symbolic state
With n state bits for m states there are 2n! / (2n m)! [log n <= m <= 2n] 2n codes possible for 1st state, 2n1 for 2nd, 2n2 for 3rd, Huge number even for small values of n and m
Intractable for state machines of any size Heuristics are necessary for practical solutions
2010/10/4
CH080512
29
2010/10/4
CH080512
31
Adjacent codes to states that share a common ancestor state To group 1's in next state map
Adjacent codes to states that have a common output behavior To group 1's in output map
2010/10/4
CH080512
32
Different weights make sense depending on whether we are optimizing for two-level or multi-level forms Can't consider all possible embeddings of state clusters in Boolean cube
Heuristics for ordering embedding To prune search for best embedding Expand cube (more state bits) to satisfy more constraints
2010/10/4
CH080512
33
Output-based Encoding
Reuse outputs as state bits - use outputs to help distinguish states
Why create new functions for state bits when output can serve as well Fits in nicely with synchronous Mealy implementations
2010/10/4
CH080512
34
One-hot encoding
Easy for small state machines Generates small equations with easy to estimate complexity Common in FPGAs and other programmable logic
Output-based encoding
Ad hoc - no tools Most common approach taken by human designers Yields very small circuits for most FSMs
2010/10/4
CH080512
35
2010/10/4
CH080512
36
Figure 8.72
2010/10/4 CH080512
Figure 8.73
38
Figure 8.74
2010/10/4 CH080512 39
Example 8.12
2010/10/4
CH080512
40
Example 8.12
Figure 8.90
Figure 8.91
Figure 8.92
2010/10/4
CH080512
41
Example 8.13
Figure 8.16
2010/10/4
CH080512
42
Example 8.13
2010/10/4
CH080512
43
Example 8.14
Figure 8.95
2010/10/4 CH080512 44
Example 8.15
Figure 8.92
Figure 8.97
2010/10/4
CH080512
45
Example 8.16
module sequence (Clock, Resetn, w, z); input Clock, Resetn, w; output z; reg [3:1] y, Y; parameter [3:1] A = 3'b000, B = 3'b001, C = 3'b010, D = 3'b011, E = 3'b100; // Define the next state combinational circuit always @(w, y) case (y) A: if (w) Y = D; else Y = B; B: if (w) Y = D; else Y = C; C: if (w) Y = D; else Y = C; D: if (w) Y = E; else Y = B; E: if (w) Y = E; else Y = B; default: Y = 3'bxxx; endcase
Figure 8.89
// Define the sequential block always @(negedge Resetn, posedge Clock) if (Resetn == 0) y <= A; else y <= Y; // Define output assign z = (y == C) | (y == E); endmodule Figure
8.98
46
2010/10/4
CH080512
Example 8.17
Figure 8.94
Figure 8.99
2010/10/4
CH080512
47
Example 8.18
2010/10/4
CH080512
48
Example 8.18
Figure 8.100
2010/10/4 CH080512 49
Example 8.18
Figure 8.101
2010/10/4 CH080512 50
2010/10/4
CH080512
51