A
Alessandro Basili
Guest
After some study and a lot of discussions with colleagues and friends I
would like to pin down the reasons why I have always believed that a
finite state machine (FSM) _is not_ a counter and at the same time try
to explain why a counter is a very special FSM (hope the thread will not
be too hot!).
I will start with my definitions and proceed with conclusions.
_Definition_: an FSM is a mathematical abstraction used to describe a
particular process or model. It consists of states which carry no
information about the history of the process (*1*) and of arcs which
define the conditions to move from one state to another one.
*note*: every state may have multiple incoming arcs and multiple
outgoing arcs.
Formally one can say the following: given a set of states S and a set of
inputs I, it exists s_next = f(s_curr, i) which belongs to S (where i
belongs to I and s_curr belong to S).
Iff (not a typo) the function f(s, i) = f(i) for each state s, then our
FSM is describing a counter, since there are no multiple
outgoing/incoming arcs in any state. Every state is the same and next
state is only function of the input (so called "event").
In this case we can not only determine what will be the next state but
also the "previous state" (since it will be the nth-1 next state where n
is the periodicity of the counter).
Usually, together with the description of the states and the arcs, comes
a description of the output function, where the outputs may be a
function of the inputs and/or the current state (Mealy/Moore). In this
case the behavioral model of a process does not need any additional
information to be described.
_Definition_: a counter is a device which stores the number of times a
particular event has occurred since a certain moment in time.
Given this definition we cannot define multiple arcs from one state of
the counter to the other, since they are all the same. Therefore some
additional information (=states) would be needed to define the
behavioral model of the process.
Strictly speaking I should say that an FSM and a counter are completely
different objects, sitting on different levels. An FSM is a "way" to
describe a process such that given the state it is possible to predict
the next state of the process according to the current inputs.
A counter can not model anything, it can simply count the number of events.
IMHO whenever there is a need of a sequence of actions (set/reset bits
or outputs) that is "fixed", a counter may be handy, even though most of
the times the sequence inherit a structure that is best described with
an FSM.
Any comment is appreciated!
Al
(*1*) think about the liquid state of a material, like water. Given its
state it is not possible to determine whether it came from ice or from
gas. Same may happen in a logical device like a flip-flop, it is not
possible to know the previous state unless we stored the history of the
input, while it is possible to know the next state given the current
input. These considerations may be helpful when we are considering
phenomena which may upset the state of a register accidentally and
putting our system at risk.
--
Alessandro Basili
CERN, PH/UGC
Electronic Engineer
would like to pin down the reasons why I have always believed that a
finite state machine (FSM) _is not_ a counter and at the same time try
to explain why a counter is a very special FSM (hope the thread will not
be too hot!).
I will start with my definitions and proceed with conclusions.
_Definition_: an FSM is a mathematical abstraction used to describe a
particular process or model. It consists of states which carry no
information about the history of the process (*1*) and of arcs which
define the conditions to move from one state to another one.
*note*: every state may have multiple incoming arcs and multiple
outgoing arcs.
Formally one can say the following: given a set of states S and a set of
inputs I, it exists s_next = f(s_curr, i) which belongs to S (where i
belongs to I and s_curr belong to S).
Iff (not a typo) the function f(s, i) = f(i) for each state s, then our
FSM is describing a counter, since there are no multiple
outgoing/incoming arcs in any state. Every state is the same and next
state is only function of the input (so called "event").
In this case we can not only determine what will be the next state but
also the "previous state" (since it will be the nth-1 next state where n
is the periodicity of the counter).
Usually, together with the description of the states and the arcs, comes
a description of the output function, where the outputs may be a
function of the inputs and/or the current state (Mealy/Moore). In this
case the behavioral model of a process does not need any additional
information to be described.
_Definition_: a counter is a device which stores the number of times a
particular event has occurred since a certain moment in time.
Given this definition we cannot define multiple arcs from one state of
the counter to the other, since they are all the same. Therefore some
additional information (=states) would be needed to define the
behavioral model of the process.
Strictly speaking I should say that an FSM and a counter are completely
different objects, sitting on different levels. An FSM is a "way" to
describe a process such that given the state it is possible to predict
the next state of the process according to the current inputs.
A counter can not model anything, it can simply count the number of events.
IMHO whenever there is a need of a sequence of actions (set/reset bits
or outputs) that is "fixed", a counter may be handy, even though most of
the times the sequence inherit a structure that is best described with
an FSM.
Any comment is appreciated!
Al
(*1*) think about the liquid state of a material, like water. Given its
state it is not possible to determine whether it came from ice or from
gas. Same may happen in a logical device like a flip-flop, it is not
possible to know the previous state unless we stored the history of the
input, while it is possible to know the next state given the current
input. These considerations may be helpful when we are considering
phenomena which may upset the state of a register accidentally and
putting our system at risk.
--
Alessandro Basili
CERN, PH/UGC
Electronic Engineer