Techniqueadvanced
FSM decomposition
Also called finite state machine decomposition, general decomposition of FSMs.
Splits a finite state machine into interacting smaller machines, by Hartmanis-Stearns partitions or by Devadas and Newton's factorization, to cut logic and delay.
FSM decomposition builds one finite state machine from two or more smaller machines that run together and read each other's state. The pieces are easier to encode and to optimize, each piece has fewer inputs to its next-state logic, and a piece that is idle can be stopped. The classic theory of Hartmanis and Stearns (1966) says exactly when a machine splits without any loss: a serial decomposition, in which the second machine reads the state of the first, exists when the machine has a nontrivial partition of its states with the substitution property, and a parallel decomposition, in which neither reads the other, exists when it has two such partitions that together tell every state apart. Logic synthesis in the late 1980s added looser forms: general decomposition, in which each piece may read the other, and factorization, in which a pattern of states that occurs several times in the state graph is built once (Devadas and Newton 1989).
In plain words
A clock that shows hours and minutes is one machine with 1440 states, but nobody builds it that way. It is a minutes counter that ticks every minute and an hours counter that ticks only when the minutes wrap around. The hours counter needs to see one thing from the minutes counter, whether it is about to wrap; the minutes counter needs nothing from the hours counter. This is a serial decomposition. Decomposition looks for such splits in any machine: groups of states such that the group of the next state can be known from the group of the present state and the input alone.
When it applies
- The machine is deterministic and completely specified, with states , inputs and next-state function , as on the partition pair page, whose notation this page uses. It should first be minimized by DFA minimization, or by incompletely specified FSM minimization when it has unspecified entries, since redundant states create splits that only reflect the redundancy.
- For an exact serial split, the machine has an SP partition other than and . For an exact parallel split, it has two SP partitions , both other than and , with .
- The aim is smaller or faster logic, or lower power, at the price of more interacting pieces; the number of flip-flops can grow, as the pitfalls show.
The template
DECOMPOSE(M, π, τ)- 1
if π is not SP, or π ∧ τ ≠ 0 then fail - 2
M1.states ← blocks of π - 3
for each block B of π and input x do M1.δ(B, x) ← the block of π that holds δ(s, x), for any s in B - 4
M2.states ← blocks of τ - 5
for each block C of τ, block B of π and input x do - 6
if B ∩ C = {s} then - 7
M2.δ(C, (x, B)) ← the block of τ that holds δ(s, x) - 8
λ(B, C, x) ← λ(s, x) - 9
else leave M2.δ(C, (x, B)) and λ(B, C, x) unspecified - 10
return (M1, M2, λ)
The holes are the choice of among the SP partitions, the choice of , the codes of the blocks of each piece, and the cost that judges the result. If is SP too, then does not depend on and the decomposition is parallel. The SP partitions are listed from the generators of the partition pair page, and is chosen with as few blocks as possible; it needs at least as many blocks as the largest block of , since the states of one block of must lie in different blocks of .
Theorem (serial decomposition). If is SP and , then and run side by side, with reading the input and the state of , start from and , and produce the outputs of on every input word.
Proof. is well defined on line L3 because is SP: all states of go to one block of on input . We show by induction on the number of steps that if is in state , then is in and is in . This holds at the start. If it holds before input , then contains , and since it is exactly . So line L8 gives the output , line L7 moves to , and line L3 moves to . The entries left unspecified on line L9 are never used.
Theorem (parallel decomposition). If and are both SP and , then and , each driven by the input alone, together track the state of : it is the single state in the meet of their two blocks. The proof is the same, with well defined because is SP.
Conversely, a serial decomposition in which the second machine reads only the state of the first gives an SP partition: group the states of by the state of the first machine. So a reduced machine has a nontrivial serial decomposition exactly when it has an SP partition other than and . This is the result of Hartmanis and Stearns; their book states it with a precise notion of one machine realizing another, which this sketch of the converse takes for granted.
Classic examples
The counter modulo 4 with enable. Let . Its SP partitions come from the subgroups of , as the partition pair page shows: , the parity partition , and . Take and , with . Write . Then holds the parity with , and holds with : it reads the state of to know whether a carry comes in. This is the usual synchronous binary counter, with the carry from the low bit as the link between the two pieces. The counter has no parallel decomposition, since it has only one nontrivial SP partition.
The counter modulo 6. The subgroups and of give the SP partitions (the value modulo 2) and (the value modulo 3). Their meet is by the Chinese remainder theorem, so the counter is a counter modulo 2 and a counter modulo 3 that run in parallel on the same enable, with 1 + 2 = 3 flip-flops, the same as a plain encoding of 6 states.
A controller with a repeated pattern. In the controller of a finite state machine with datapath, the same sequence of states, such as a handshake or a memory access, often occurs at several places in the state graph. Factorization (Devadas and Newton 1989) builds that sequence once as a separate machine, which the main machine starts and waits for, so its states and transitions are not repeated. The main machine keeps one state per occurrence, in which it waits.
State assignment by partitions. A code in which a group of state bits encodes the blocks of an SP partition gives those bits next-state functions that depend only on themselves and the inputs; this is the serial decomposition hidden in a single encoding. Hartmanis used SP partitions and partition pairs this way for state assignment, before the symbolic methods such as KISS and MUSTANG.
Variations
- Partition pairs instead of SP partitions. If and are partition pairs with , each piece computes its next block from the state of the other and the input, so the pieces read each other. Hartmanis and Stearns treat such loops of partition pairs as well.
- General decomposition. Devadas and Newton (1989) split a state graph into two interacting machines that may each read the other's state, without asking for SP partitions, and judge the split by the size of the encoded logic. Ashar, Devadas and Newton (1991) give an exact algorithm and heuristics for this problem with a two-level logic cost.
- Factorization. Devadas and Newton (1989) find factors, sets of states and transitions that occur more than once with the same shape, and implement each factor once. An exact factor gives an exact decomposition; looser factors trade some extra logic for wider use.
- Krohn-Rhodes cascades. Repeated serial decomposition, with covers whose blocks may overlap in place of partitions, reaches components that are simple groups or reset machines. This is the Krohn-Rhodes theorem, a theoretical result rather than a synthesis tool.
- Functional decomposition. The same idea for combinational logic is Ashenhurst-Curtis decomposition, which splits a Boolean function by a partition of its inputs rather than of states.
Pitfalls
- More flip-flops. A decomposition into pieces with and states needs flip-flops, which can be more than . The counter modulo 15 splits into counters modulo 3 and modulo 5, with flip-flops, while a plain encoding needs 4. Whether the smaller logic pays for the extra flip-flop must be checked.
- A machine that is not minimized. Equivalent states can create SP partitions that a reduced machine does not have, and can hide the ones it does have. Minimize first.
- Choosing too fine. Any with works, and always does, but then is as large as . The best has as many blocks as the largest block of , and finding one that also keeps simple is itself a search problem.
- No SP partition at all. Many machines, including every counter modulo a prime, have only the SP partitions and , so they have no exact serial decomposition. Then general decomposition or factorization, which do not need SP partitions, are the only choices.
- Unspecified entries. Line L9 leaves entries of free. They are don't cares for the logic of , and forgetting them gives larger logic than needed.
Exercises
- List the SP partitions of the counter modulo 8 with enable, and decompose it serially into three machines with one flip-flop each.
- Show that if is SP and , then the number of blocks of is at least the size of the largest block of , and find a that reaches this bound for the counter modulo 6 and .
- Prove the converse stated after the theorems: if a reduced machine is the serial connection of and , and never influences , then grouping the states by the state of gives an SP partition.
- A machine has the SP partitions , , and only, with and . Which decompositions does it have?
References
- Juris Hartmanis and Richard E. Stearns, Algebraic Structure Theory of Sequential Machines, Prentice-Hall, 1966, serial and parallel decomposition of sequential machines by partitions with the substitution property and partition pairs
- Srinivas Devadas and A. Richard Newton, Decomposition and factorization of sequential finite state machines, IEEE Transactions on Computer-Aided Design 8(11), 1206 to 1217, 1989, general decomposition of a state graph and factorization by repeated subgraphs
- Pranav Ashar, Srinivas Devadas and A. Richard Newton, Optimum and heuristic algorithms for an approach to finite state machine decomposition, IEEE Transactions on Computer-Aided Design 10(3), 296 to 310, 1991, exact and heuristic algorithms for general decomposition with a two-level logic cost
- Giovanni De Micheli, Synthesis and Optimization of Digital Circuits, McGraw-Hill, 1994, Chapter 9 (finite state machine decomposition as part of sequential logic optimization)
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag 93E5AP Edit this page History Report an error Markdown