Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - Two processes with communication through a signal.

 
Thread Tools Search this Thread
Old 05-30-2008, 11:46 PM   #1
Default Two processes with communication through a signal.


signal trigger;

proc1 : process(clk)
begin
trigger <= '0';
case state_proc1 is
when ... (other states)
when STATE1 =>
trigger <= '1';
state_proc1 <= STATE2;
when STATE2 =>
-- do something, but don't set trigger to anything
when ... (other states)
end case;
end process proc1;

proc2 : process(clk)
begin
case state_proc2 is
when STATE1 =>
if trigger = '1' then
state_proc2 <= STATE2;
end if;
when STATE2 =>
-- do something
state_proc2 <= STATE1;
end case;
end process proc2;

Can proc1 transition from (some state)->STATE1->STATE2->(some other
state) without causing proc2 to transition from STATE1 to STATE2?
(assuming state_proc2 is STATE1 to start)

I have similar code which is implemented on a FPGA where proc2 somehow
misses the trigger signal going high unless I keep it high for a few
clock cycles and I really don't understand how this can happen. I
thought in the above case both processes would run and then pending
signal assignments (such as trigger going to 1) would be made
simultaneously after a delta delay.

If this is indeed not possible, any ideas on trying to identify what
is causing this?

Thanks!


jumpz
  Reply With Quote
Old 05-31-2008, 03:09 AM   #2
kennheinrich@sympatico.ca
 
Posts: n/a
Default Re: Two processes with communication through a signal.


jumpz wrote:

>
> Can proc1 transition from (some state)->STATE1->STATE2->(some other
> state) without causing proc2 to transition from STATE1 to STATE2?
> (assuming state_proc2 is STATE1 to start)
>
> I have similar code which is implemented on a FPGA where proc2 somehow
> misses the trigger signal going high unless I keep it high for a few
> clock cycles and I really don't understand how this can happen. I
> thought in the above case both processes would run and then pending
> signal assignments (such as trigger going to 1) would be made
> simultaneously after a delta delay.
>
> If this is indeed not possible, any ideas on trying to identify what
> is causing this?
>


Don't think about delta delays here. As long as both processes run on
the same clock you just think of clock cycle delays. You'll see
'trigger' going high on the clock *after* proc1 is in STATE1, i.e.
rising edge of trigger coincides with the proc1 state transition from
STATE1 -> STATE2.

If your code is *exactly* as written, proc2 should always pick up on
the trigger when proc2 is in STATE1 intially, and proc2 will be in
STATE2 the clock after the trigger pulse.

Other things that could be going on: you might not really be in STATE1
in proc2. If you have rapid back-to-back triggers, proc2 might still
be in state2 and will then not be looking for the trigger.

You also are using a state type constant or enum which has more than 2
states (hinted at in proc1). But proc2 doesn't recover if for any
reason (ESD, DCM glitch, bad reset timing) it gets into one of the
other states.

You might also have a "gross motor function" problem like power supply
glitches, unstable clocks, missed timing constraints during synthesis/
P&R etc. Also, make sure they're the identical clocks on both
processes.

Also doublecheck that proc1 doesn't write to 'trigger' anywhere else
in the process.

HTH,
- Kenn


kennheinrich@sympatico.ca
  Reply With Quote
Old 05-31-2008, 02:46 PM   #3
KJ
 
Posts: n/a
Default Re: Two processes with communication through a signal.

"jumpz" <> wrote in message
news:95b5027c-47ad-44f6-a96c-...
> signal trigger;
>
>
> If this is indeed not possible, any ideas on trying to identify what
> is causing this?
>


Use a simulator...it will happily provide you all the clues you need.

KJ




KJ
  Reply With Quote
Old 05-31-2008, 05:09 PM   #4
Mike Treseler
 
Posts: n/a
Default Re: Two processes with communication through a signal.
jumpz wrote:

> Can proc1 transition from (some state)->STATE1->STATE2->(some other
> state) without causing proc2 to transition from STATE1 to STATE2?
> (assuming state_proc2 is STATE1 to start)


Your state values are stored in two
different registers, state_proc1 and state_proc2.
They may or may not have the same value,
but this, in itself, does not cause interaction
any more than if I had two counter
registers both with the value 42.

> I have similar code which is implemented on a FPGA where proc2 somehow
> misses the trigger signal going high unless I keep it high for a few
> clock cycles and I really don't understand how this can happen.


A one-way handshake strobe can only succeed
if the receiving process is *always* waiting
whenever the strobe might occur.

> I thought in the above case both processes would run and then pending
> signal assignments (such as trigger going to 1) would be made
> simultaneously after a delta delay.


The processes run one case per clock tick.
What happens depends on the input and state values
for that tick.

> If this is indeed not possible, any ideas on trying to identify what
> is causing this?


Any operation is possible.
What might eliminate your confusion is to avoid
two process when one would do
and to use boolean flags and counters
instead of a state enumeration.

Or, as KJ suggests, use simulation
instead of trial-and-error synthesis.
Stepping through the code and watching
the register values change tick by tick
is educational.

-- Mike Treseler



Mike Treseler
  Reply With Quote
Old 06-02-2008, 08:45 PM   #5
Ralf Hildebrandt
 
Posts: n/a
Default Re: Two processes with communication through a signal.
jumpz schrieb:

> proc1 : process(clk)
> begin
> trigger <= '0';
> case state_proc1 is
> when ... (other states)
> when STATE1 =>
> trigger <= '1';
> state_proc1 <= STATE2;
> when STATE2 =>
> -- do something, but don't set trigger to anything
> when ... (other states)
> end case;
> end process proc1;


I can't see no "if rising_edge(clk) then". This process ist triggered
during simulation only if clk has an event, but after synthesis it is
purely combinational logic.

Ralf


Ralf Hildebrandt
  Reply With Quote
Old 06-03-2008, 03:53 AM   #6
kennheinrich@sympatico.ca
 
Posts: n/a
Default Re: Two processes with communication through a signal.
On Jun 2, 3:45 pm, Ralf Hildebrandt <Ralf-Hildebra...@gmx.de> wrote:
> jumpz schrieb:
>
> > proc1 : process(clk)
> > begin
> > trigger <= '0';
> > case state_proc1 is
> > when ... (other states)
> > when STATE1 =>
> > trigger <= '1';
> > state_proc1 <= STATE2;
> > when STATE2 =>
> > -- do something, but don't set trigger to anything
> > when ... (other states)
> > end case;
> > end process proc1;

>
> I can't see no "if rising_edge(clk) then". This process ist triggered
> during simulation only if clk has an event, but after synthesis it is
> purely combinational logic.
>
> Ralf


D'Oh! Good catch -- it's easy to get fooled into seeing what you
*think* should be there. Either the OP has overly simplified the
example, but really did include a rising_edge(clk) (then the the
original advice holds), or he's doing a Bad Thing. In that case, take
Kevin's advice and use a simulator to explore the ways in which this
can fail. Then fix it.

- Kenn


kennheinrich@sympatico.ca
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
I am having trouble editing a signal in a sub program. Haai Hardware 0 08-28-2007 02:58 PM
Need help on Modelsim VHDL syntax? ASAP:) kaji General Help Related Topics 0 03-14-2007 10:43 PM
Need help on a Modelsim VHDL Syntax? ASAP:) kaji Software 0 03-14-2007 10:43 PM
Need Help on a Modelsim VHDL Syntax....ASAP:) kaji Hardware 0 03-14-2007 10:41 PM
IMHO, Digital SECAM video is better than Analog NTSC video Radium DVD Video 167 10-25-2006 04:16 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46