The states associated with a programmable state machine are reordered to
compress the storage of transitions which define the state machine. To
reorder the states, a score is computed and assigned to each of the
states. Next, the states are sorted according to their computed scores.
In some embodiments, to compute the score for each current state based on
the received input symbol, the number of times that the input symbol
causes transition to similar states is added. The sum of the scores in
each row of the table is representative of the score for the associated
current state associated with that row. The states are sorted according
to their score and a new state transition table is generated in
accordance with the reordered states.