How to sequencialize two finite state machines ?

M

Martin Maurer

Guest
Hello,

i have two state machine: one is collecting data (FSM1) and the second one
is storing them (FSM2).
How can i start FSM2 from a state in FSM1 ? I tried to modify a state of
FSM2 in FSM1, but then i get an error message, that state of FSM2 is
multi-sourced. I already tried to create a variable to signal "Start" to
second state machine, but even there i can't reset the variable. So FSM1
must set and reset the variable, but i don't know when i can reset the
variable, because FSM2 is running...

Is there a better way of doing it ? My solution look more like workarounds
than elegant solutions.

Regards,

Martin
 
In article <caiihm$2jm$00$1@news.t-online.com>,
Martin Maurer <capiman@clibb.de> wrote:
Hello,

i have two state machine: one is collecting data (FSM1) and the second one
is storing them (FSM2).
How can i start FSM2 from a state in FSM1 ? I tried to modify a state of
FSM2 in FSM1, but then i get an error message, that state of FSM2 is
multi-sourced. I already tried to create a variable to signal "Start" to
second state machine, but even there i can't reset the variable. So FSM1
must set and reset the variable, but i don't know when i can reset the
variable, because FSM2 is running...

Is there a better way of doing it ? My solution look more like workarounds
than elegant solutions.
My suggestion:

Use 2 signals like this:

FSM1 takes the FSM2Go signal true when it wants FSM2To start. When FSM2
is running it takes FSM2Running true. When FSM1 sees FSM2Running go true
it steps to the next state allowing FSM2Go to go false. This assumes that
the two state machines are timed by using the same clock or something that
makes sure you don't get glitches.

If you can't be sure of no glitches then you need a bunch more logic to
ensure the timing, but the same idea applies..
--
--
kensmith@rahul.net forging knowledge
 
Martin Maurer wrote:

Hello,

i have two state machine: one is collecting data (FSM1) and the second one
is storing them (FSM2).
How can i start FSM2 from a state in FSM1 ? I tried to modify a state of
FSM2 in FSM1, but then i get an error message, that state of FSM2 is
multi-sourced. I already tried to create a variable to signal "Start" to
second state machine, but even there i can't reset the variable. So FSM1
must set and reset the variable, but i don't know when i can reset the
variable, because FSM2 is running...

Is there a better way of doing it ?
Yes. Consider putting this controller in a single synchronous process.
You may just need a single boolean variable for the two modes.
Use whatever sequential statements you need to update the state
variables and the output signals every rising_edge.
Don't get hung up on the textbook machine examples.

-- Mike Treseler
 
On Sun, 13 Jun 2004 23:56:03 +0200, Martin Maurer wrote:

Hello,

i have two state machine: one is collecting data (FSM1) and the second one
is storing them (FSM2).
How can i start FSM2 from a state in FSM1 ? I tried to modify a state of
FSM2 in FSM1, but then i get an error message, that state of FSM2 is
multi-sourced. I already tried to create a variable to signal "Start" to
second state machine, but even there i can't reset the variable. So FSM1
must set and reset the variable, but i don't know when i can reset the
variable, because FSM2 is running...

Is there a better way of doing it ? My solution look more like workarounds
than elegant solutions.

Regards,

Martin
You don't need to use a registered signal, use a combinational signal
that's set when FSM1 reaches a certain state.

E.g. when GoState =>
GoSignal <= '1';

and then have a second signal from FSM2 to hand control back. Just
remember to set the default value of GoSignal to be '0' otherwise you'll
infer a latch.

It might be worth running one of the FSMs on an inverted clock to make the
synchronisation a bit easier.

HTH,

Andrew.
 

Welcome to EDABoard.com

Sponsor

Back
Top