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

Reply

VHDL - fundamental question on process

 
Thread Tools Search this Thread
Old 04-23-2005, 05:03 AM   #1
Default fundamental question on process


Hi all,

I have been looking at some code that raised a basic question. If we
have process like

process
begin
wait on TRIGGER;
signal1 <= signal2;
signal2 <= signal1 + signal3;
signal3 <= signal2;
RESULT <= signal1 + signal2 + signal3;
end process;

when trigger is true are the 4 signal assignment statements executed
sequentially or concurrently ?

What happens when they are variable assignments like below

process
begin
wait on TRIGGER;
variable1 := Variable2;
Variable2 := Variable1 + Variable3;
Variable3 := signal2;
RESULT <= Variable1 + Variable2 + Variable3; -- RESULT is of
type signal
end process;


I tried simulating both of them and the results are different (because
of the variable/signal differnce on assignment).

The website where this example is cited
http://www.seas.upenn.edu/~ee201/vhd...#_Toc526061350
says ..when they are declared as variables they are executed
sequentially and when declared as signals are executed concurrently.
The book that I usually follow says (and I agree) that the signal
assignments are sequentially executed. Is'nt that the reason why
processes were created in the first place?

If they are executed sequentially, why do we get the different values
when they are declared as variables/signals.

Could someone help me out?

Thanks.



Praveen
  Reply With Quote
Old 04-23-2005, 07:26 AM   #2
jtw
 
Posts: n/a
Default Re: fundamental question on process

"Praveen" <> wrote in message
news: ups.com...
> Hi all,
>
> I have been looking at some code that raised a basic question. If we
> have process like
>
> process
> begin
> wait on TRIGGER;
> signal1 <= signal2;
> signal2 <= signal1 + signal3;
> signal3 <= signal2;
> RESULT <= signal1 + signal2 + signal3;
> end process;
>
> when trigger is true are the 4 signal assignment statements executed
> sequentially or concurrently ?


Concurrently.

>
> What happens when they are variable assignments like below
>
> process
> begin
> wait on TRIGGER;
> variable1 := Variable2;
> Variable2 := Variable1 + Variable3;
> Variable3 := signal2;
> RESULT <= Variable1 + Variable2 + Variable3; -- RESULT is of
> type signal
> end process;
>
>
> I tried simulating both of them and the results are different (because
> of the variable/signal differnce on assignment).
>
> The website where this example is cited
> http://www.seas.upenn.edu/~ee201/vhd...#_Toc526061350
> says ..when they are declared as variables they are executed
> sequentially and when declared as signals are executed concurrently.
> The book that I usually follow says (and I agree) that the signal
> assignments are sequentially executed. Is'nt that the reason why
> processes were created in the first place?


Inside a process, the later assignments take precedence. E.g.,

process
begin
wait on clk='1';
dummy0 <= '1';
dummy0 <= not dummy0;
end process;

This toggles dummy0 (which yes, should be initialized somewhere.) Even
though the first dummy0 assignment is scheduled, it get's overwritten. The
last assignment takes precedence. For example, the following process
synchronously resets dummy0 when reset is '1', and synchronously sets dummy0
when reset is '0';

process
begin
wait on clk='1';
dummy0 <= '1';
if reset = '1' then
dummy0 <= '0';
end if;
end process;

>
> If they are executed sequentially, why do we get the different values
> when they are declared as variables/signals.
>
> Could someone help me out?
>
> Thanks.
>





jtw
  Reply With Quote
Old 04-23-2005, 09:30 AM   #3
Egbert Molenkamp
 
Posts: n/a
Default Re: fundamental question on process

"Praveen" <> schreef in bericht
news: ups.com...
> Hi all,
>
> I have been looking at some code that raised a basic question. If we
> have process like
>
> process
> begin
> wait on TRIGGER;
> signal1 <= signal2;
> signal2 <= signal1 + signal3;
> signal3 <= signal2;
> RESULT <= signal1 + signal2 + signal3;
> end process;
>
> when trigger is true are the 4 signal assignment statements executed
> sequentially or concurrently ?
>
> What happens when they are variable assignments like below
>
> process
> begin
> wait on TRIGGER;
> variable1 := Variable2;
> Variable2 := Variable1 + Variable3;
> Variable3 := signal2;
> RESULT <= Variable1 + Variable2 + Variable3; -- RESULT is of
> type signal
> end process;
>
>
> I tried simulating both of them and the results are different (because
> of the variable/signal differnce on assignment).
>
> The website where this example is cited
> http://www.seas.upenn.edu/~ee201/vhd...#_Toc526061350
> says ..when they are declared as variables they are executed
> sequentially and when declared as signals are executed concurrently.
> The book that I usually follow says (and I agree) that the signal
> assignments are sequentially executed. Is'nt that the reason why
> processes were created in the first place?


I copied a part of the document you refere to:
*************
It is important to understand the difference between variables and signals,
particularly how it relates to when their value changes. A variable changes
instantaneously when the variable assignment is executed. On the other hand,
a signal changes a delay after the assignment expression is evaluated. If no
delay is specified, the signal will change after a delta delay. This has
important consequences for the updated values of variables and signals. Lets
compare the two files in which a process is used to calculate the signal
RESULT [7].
*************

Notice that also the last line "has important consequences..".

The statement in both processes you give are exectured sequentially. However
in the first proces signal signal1 is not updated immediatly (it takes one
delta). Therefore the second sequential statement in that process "signal2
<= signal1 + signal3" uses the not updated value of signal1.
When is signal1 updated? When all concurrent statements have finished there
execution. Due to this mechanism concurrency is possible.

Egbert Molenkamp






Egbert Molenkamp
  Reply With Quote
Old 04-24-2005, 11:33 PM   #4
Praveen
 
Posts: n/a
Default Re: fundamental question on process
Thanks Wright and Egbert for the replies. I got the picture now.



Praveen
  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
Asynchronous process from asp.net page button click event? Ritha Software 0 09-29-2009 03:20 PM
A+ Exam Revision Update Process Starting John P. Dearing A+ Certification 6 02-10-2006 01:44 AM
Re: Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good God DVD Video 3 04-25-2005 04:19 PM
Re: Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good Filthy Mcnasty DVD Video 0 04-25-2005 04:29 AM
Re: Safe Mode Question (A+ question) Gordon Findlay A+ Certification 0 06-16-2004 10:48 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