Hmm... Having said all that, it might be possible to
put a state
machine into a 16V8 that had a 7 bit current state and a next state
function that corresponded to "counting" is seven segments. In
theory that'd work, but I don't know off hand if there are enough
terms inside a 16V8 to implement that next state function.
You also need to make sure that the next-state function converges on a
valid state from all possible start states, or else add a way to reset
it to some valid state (probably zero).
Using (what I think of as) the canonical 7-stroke digits,
_ _ _ _ _ _ _ _
| | | _| _| |_| |_ |_ | |_| |_|
|_| | |_ _| | _| |_| | |_| _|
with the segments identified as A to G from top to bottom, left to
right, the digits are
A B C D E F G
0 1 1 1 0 1 1 1
1 0 0 1 0 0 1 0
2 1 0 1 1 1 0 1
3 1 0 1 1 0 1 1
4 0 1 1 1 0 1 0
5 1 1 0 1 0 1 1
6 1 1 0 1 1 1 1
7 1 0 1 0 0 1 0
8 1 1 1 1 1 1 1
9 1 1 1 1 0 1 1
Then, if X' is the next-state X, I find that, optimizing for gate count
(NOT, AND, OR, NAND, NOR), if I didn't make any typos feeding the
program,
A' = ~(G&F&~(D&B)) [2 gates - 2NAND, 3NAND]
B' = (C&F&D)|(A&~E) [4 gates - NOT, 2AND, 3AND, 2OR]
C' = E|~(B&~(D&C&A&B)) [3 gates - 4NAND, 2NAND, 2OR]
D' = ~(B&(C|E)&A&~(D&C&F&E)) [3 gates - 4NAND, 2OR, 4NAND]
E' = ~(E|(D&~(D&A&B))) [3 gates - 3NAND, 2AND, 2NOR]
F' = A|D [1 gate - 2OR]
G' = ~(G&F&(C|E)&~(D&C&A&B)) [3 gates - 4NAND, 2OR, 4NAND]
There's even a little commonality; ~(D&C&A&B) and (C|E) each occur
twice. (Trying to optimize for total gate count over all seven signals
would have been a lot more computation, using the technique I used.)
If this gate-count metric is not appropriate for a GAL, outline a more
appropriate metric and I can work out equations using it....
Using these equations, I find that, fortunately, all 128 initial states
settle into one of the ten digits in no more than four transitions, and
even that many for only six of the 128: 0101000, 0101001, 0101010,
0101011, 0111000, and 0111001. Interestingly, the digit all six of
those turn into after four transitions is the same. ("Fortunately"
because the way I did this doesn't have any good way to feed
information back into the equation determination from the loop
detection.)
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse at rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B