EmbDev.net

Forum: FPGA, VHDL & Verilog VHDL Processes & Sensitivity Lists


von Brian S. (Company: UT Aerospace Systems) (utas)


Rate this post
useful
not useful
I am modifying some existing VHDL and find the code curious.  A snippet 
is attached with two processes.  In this snippet, A and B are completely 
independent from C and D.  First, is there any reason why the two 
processes could not be combined into one process?  Second, does the test 
for sysclk'event do anything?  I would think that having sysclk on the 
process sensitivity list would have already enforced the process to run 
on an event.  Perhaps the 'if' statement only has an effect on the first 
time the process runs?
1
process (sysclk) is
2
begin
3
    if (sysclk'event and sysclk='1') then
4
        A <= B;
5
    end if;
6
end process;
7
8
process (sysclk) is
9
begin
10
    if (sysclk'event and sysclk='1') then
11
        C <= D;
12
    end if;
13
end process;

von Rainer (Guest)


Rate this post
useful
not useful
You can combine the two processes, it will also work. But if you use a 
seperate process for every signal, it is  clearly arranged.
"if (sysclk'event and sysclk='1') then" means, that this is a clocked 
process. Only on a rising edge of sysclk there will happen something. 
Instead you can also write "if rising_edge(sysclk).

Have a nice day
Rainer

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
Brian Sutin wrote:
> I am modifying some existing VHDL and find the code curious.  A snippet
> is attached with two processes.  In this snippet, A and B are completely
> independent from C and D.  First, is there any reason why the two
> processes could not be combined into one process?
It may be in two processes, because the two things are 
independent...

> Second, does the test for sysclk'event do anything?
It tells the synthesizer to generate a flipflop.

> I would think that having sysclk on the process sensitivity list would
> have already enforced the process to run on an event.
The sensitivity list is only for the simulation. It tells the 
simulator when it has to recalculate the process.


So, when you write this
1
process (sysclk) is
2
begin
3
    if (sysclk'event and sysclk='1') then
4
        A <= B;
5
    end if;
6
process;
and this
1
process (someothersignal) is
2
begin
3
    if (sysclk'event and sysclk='1') then
4
        A <= B;
5
    end if;
6
process;
you will get exactly the same hardware, but in the second case the 
simulation will be total nuts...


And this here
1
process (sysclk) is
2
begin
3
    if (sysclk'event and sysclk='1') then
4
        A <= B;
5
    end if;
6
process;
will look exactly the same like this
1
process (sysclk) is
2
begin
3
    if (sysclk='1') then
4
        A <= B;
5
    end if;
6
process;
in simulation, but it will lead to a totally different hardware!
And why? It is because in the second case the sensitivity list is 
missing the signal B, because when sysclk ist '1' then every change on 
B must be transferred to A immediately.

To keep it short: the sensitivity list is only of interest, if you want 
a correctly working simulation. The synthesizer does not use the 
sensitivity list at all!
In the best case synthesis informs you that there may be a misalignment 
between simulation and reality due to an incomplete sensitivity list.

von Brian S. (Company: UT Aerospace Systems) (utas)


Rate this post
useful
not useful
Thank you for the replies.  Actually I am not simulating this at all; I 
don't even have a simulator.  The code is running on a Xilinx FPGA. 
What would happen if I left out the sensitivity list on hardware?  I 
assume that this would be considered bad programming practice.

von Lattice User (Guest)


Rate this post
useful
not useful
Sooner or later you WILL need to simulate do find some nasty bug. And 
when your sensitivy lists are not correct you have a BIG problem.

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
When you have Xilinx ISE, then you have the ISIM simulator.

von Brian S. (Company: UT Aerospace Systems) (utas)


Rate this post
useful
not useful
The project as a whole has 14 Xilinx cores, including Microblaze with 
10,000+ lines of C++ code.  It continuously communicates over Ethernet 
with external computers, and the custom VHDL in question controls such 
things as several high-speed DAC's and ADC's.  Some form of emulation 
would have to be written for all of these interfaces in order to create 
a worthwhile simulation of the changes I am making to the VHDL.  I admit 
that I am not man enough to do all that.  Tweaking the VHDL and running 
on hardware has been good to me so far.

I just wish I felt a little less like "Rogue Moon" when I enter VHDL 
Land.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.