process getting called more than once

G

googler

I have a process like below.

alu: process (ain, bin, sel, cinflag)
begin
....
end process alu;

Inside this process, it is modifying another signal cout based on the
values of the parameters. Basically, cout <= ain (op) bin. When the
signals ain and cout are identical, this ends up invoking the process
again (since the value of ain in the sensitivity list changes). How can
I prevent this from happening?

Thanks in advance.
 
E

Egbert Molenkamp

I added two examples:

I added two example processes. Process no_problem assigns a value to b and
in the next delta that value is assigned to c.
In hardware this would result in a wire between a,b and c. No problem!

The next process, comb_loop, is more complicated. b is assigned the value of
a (after a delta). In the next delta a is assigned the inverse of b.
This will not be stable during simulation (assuming initial vlaue is
'0'/'1'). Synthesis will result in a combinational loop (output of inverter
connected with the input).

no_problem:process(a,b)
begin
b<= a;
c <=b;
end process;

comb_loop:process(a,b)
begin
b<=a;
a<=not b;
end process;

Egbert Molenkamp
 
G

googler

Thanks for the reply. I understand this. But I was asking how do we
make sure that such a thing does not happen.

alu: process (ain, bin)
begin
cout <= {some function of ain and bin}
end process alu;

I mean the above process is getting called with a signal that is
serving as both ain and cout. So a change in the output cout results in
change in ain in the sensitivity list (in the next delta simulation
time). Is there any way I do not let the process be entered during this
next delta simulation time?
 
U

usenet_10

HI
alu: process (ain, bin, sel, cinflag)
begin
...
end process alu;

Inside this process, it is modifying another signal cout based on the
values of the parameters. Basically, cout <= ain (op) bin. When the
signals ain and cout are identical, this ends up invoking the process
again (since the value of ain in the sensitivity list changes). How can
I prevent this from happening?

There should nothing happen as long as the sensitivity list contains no
signal that is inside the process on the left side.
I assume, that your cout has a feedback to ain outside the process.
There is no way to prevent a trigger on the process, but you could use
a after statement to prevent your signal toggling in deltas.
A typical code like
process (a,b)
begin
a <= a xor b
end process

would simulate ways faster when using
a <= a xor b after 2 ns
nevertheless you have a combinational feedback which should only be
used, as long as you know what you are doing.

bye Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top