Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Process or concurrent statement?

Reply
Thread Tools

Process or concurrent statement?

 
 
Daniel
Guest
Posts: n/a
 
      01-28-2008
Hello,
I'm newer in VHDL and always had this question:
which practice is best from these two:

a)
clk1 <= '1' when (counter32b = PERIOD_1) else '0',
clk2 <= '1' when (counter32b = PERIOD_2) else '0',
clk3 <= '1' when (counter32b = PERIOD_3) else '0',


b)

process(clk)
begin
 
Reply With Quote
 
 
 
 
Daniel
Guest
Posts: n/a
 
      01-28-2008
On Jan 28, 12:06 pm, Daniel <(E-Mail Removed)> wrote:
> Hello,
> I'm newer in VHDL and always had this question:
> which practice is best from these two:
>
> a)
> clk1 <= '1' when (counter32b = PERIOD_1) else '0',
> clk2 <= '1' when (counter32b = PERIOD_2) else '0',
> clk3 <= '1' when (counter32b = PERIOD_3) else '0',
>
> b)
>
> process(clk)
> begin


The question was not complete but I thing you can figure what's next.
Anyway, hara is the rest:


b)
process(clk)
begin
clk1 <= '0';
clk2 <= '0';
clk3 <= '0';
if rising_edge(clk)
case counter32b of
when PERIOD_1 => clk1 <= '1';
when PERIOD_2 => clk1 <= '1';
when PERIOD_3 => clk1 <= '1';
when others => NULL;
end if;
end process,
 
Reply With Quote
 
 
 
 
Symon
Guest
Posts: n/a
 
      01-28-2008
Hi Daniel,
'a' and 'b' are not equivalent. It's like asking if apples are better than
asphalt. FWIW, 'a' will synthesise to combinational logic, 'b' to
combinational logic and some flip flops clocked by 'clk'.
HTH.,Syms.


 
Reply With Quote
 
Daniel
Guest
Posts: n/a
 
      01-28-2008
On Jan 28, 12:55 pm, "Symon" <(E-Mail Removed)> wrote:
> Hi Daniel,
> 'a' and 'b' are not equivalent. It's like asking if apples are better than
> asphalt. FWIW, 'a' will synthesise to combinational logic, 'b' to
> combinational logic and some flip flops clocked by 'clk'.
> HTH.,Syms.


Hi,
I use these clocks to trigger three events. The option without flip-
flip will result in a simpler async logic.
With 'clk' running at 100Mhz, the flip-flip option would be beter.
Thanks for your help.
Daniel.
 
Reply With Quote
 
KJ
Guest
Posts: n/a
 
      01-28-2008
On Jan 28, 12:01*pm, Daniel <(E-Mail Removed)> wrote:
> On Jan 28, 12:55 pm, "Symon" <(E-Mail Removed)> wrote:
>
> > Hi Daniel,
> > 'a' and 'b' are not equivalent. It's like asking if apples are better than
> > asphalt. FWIW, 'a' will synthesise to combinational logic, 'b' to
> > combinational logic and some flip flops clocked by 'clk'.
> > HTH.,Syms.

>
> Hi,
> I use these clocks to trigger three events. The option without flip-
> flip will result in a simpler async logic.


Simpler than what?

> With 'clk' running at 100Mhz, the flip-flip option would be beter.


Better than what?

If your intention is to then use the signals 'clk1', 'clk2' and 'clk3'
as the clock inputs to some other processes (as you alluded to by
saying "I use these clocks to trigger three events") then here are
some tips if you plan to implement the design in an FPGA.

1. Don't do that.
2. Really...don't do that...both approaches are bad.
3. The combinatorial approach is worse...
4. The synced up version is nearly just as bad.
5. Are you getting the point? Don't do it that way.

Anyway, the way you 'should' use the various clk1...clk3 signals in
your design would be

process(clk)
begin
if rising_edge(clk) then
if (clk1 = '1') then
-- Do whatever you were thinking of doing on rising_edge(clk1)
here
end if;
end if;
end process;

Repeat this template for 'clk2' and 'clk3'.

If you insist on trying to use 'clk1', 'clk2' and 'clk3' to clock
other things then I wish you good luck with your timing analysis and
even more good luck with getting the design to be stable over
temperature ranges. Creating gated clocks in FPGAs is not good
practice because inevitably the multiple clock domains need to
communicate with each other and there is always going to be some
uncontrollable skew between 'clk', 'clk1', 'clk2' and 'clk3' that
simply doesn't exist if you use a synchronous design approach (i.e.
using only 'clk' to clock anything).

Kevin Jennings
 
Reply With Quote
 
Daniel
Guest
Posts: n/a
 
      01-29-2008
Hi,
ok, I get the point. I'll follow your advice... by the way, can I ask
you for a good reference where I can read about best aproches to
digital design in FPGA. I've been searching in the internet but I'm
overhelmed by such a lot information.
Thanks,
Daniel.


On Jan 28, 2:19 pm, KJ <(E-Mail Removed)> wrote:
> On Jan 28, 12:01 pm, Daniel <(E-Mail Removed)> wrote:
>
> > On Jan 28, 12:55 pm, "Symon" <(E-Mail Removed)> wrote:

>
> > > Hi Daniel,
> > > 'a' and 'b' are not equivalent. It's like asking if apples are better than
> > > asphalt. FWIW, 'a' will synthesise to combinational logic, 'b' to
> > > combinational logic and some flip flops clocked by 'clk'.
> > > HTH.,Syms.

>
> > Hi,
> > I use these clocks to trigger three events. The option without flip-
> > flip will result in a simpler async logic.

>
> Simpler than what?
>
> > With 'clk' running at 100Mhz, the flip-flip option would be beter.

>
> Better than what?
>
> If your intention is to then use the signals 'clk1', 'clk2' and 'clk3'
> as the clock inputs to some other processes (as you alluded to by
> saying "I use these clocks to trigger three events") then here are
> some tips if you plan to implement the design in an FPGA.
>
> 1. Don't do that.
> 2. Really...don't do that...both approaches are bad.
> 3. The combinatorial approach is worse...
> 4. The synced up version is nearly just as bad.
> 5. Are you getting the point? Don't do it that way.
>
> Anyway, the way you 'should' use the various clk1...clk3 signals in
> your design would be
>
> process(clk)
> begin
> if rising_edge(clk) then
> if (clk1 = '1') then
> -- Do whatever you were thinking of doing on rising_edge(clk1)
> here
> end if;
> end if;
> end process;
>
> Repeat this template for 'clk2' and 'clk3'.
>
> If you insist on trying to use 'clk1', 'clk2' and 'clk3' to clock
> other things then I wish you good luck with your timing analysis and
> even more good luck with getting the design to be stable over
> temperature ranges. Creating gated clocks in FPGAs is not good
> practice because inevitably the multiple clock domains need to
> communicate with each other and there is always going to be some
> uncontrollable skew between 'clk', 'clk1', 'clk2' and 'clk3' that
> simply doesn't exist if you use a synchronous design approach (i.e.
> using only 'clk' to clock anything).
>
> Kevin Jennings


 
Reply With Quote
 
Thomas Stanka
Guest
Posts: n/a
 
      01-30-2008
On 28 Jan., 16:10, Daniel <(E-Mail Removed)> wrote:
> process(clk)
> begin
> clk1 <= '0';
> clk2 <= '0';
> clk3 <= '0';
> if rising_edge(clk)
> case counter32b of
> when PERIOD_1 => clk1 <= '1';
> when PERIOD_2 => clk1 <= '1';
> when PERIOD_3 => clk1 <= '1';
> when others => NULL;
> end if;
> end process,


I just wonder what your synthesis tools creates out of this process. A
good tool will complain as you mix combinatorial and sequential
template in one process. But I guess you made some copy&paste errors,
as the code above contains several syntax errors and at least two c&p
errors.

if you'd wrote
if rising_edge(clk) then
clk1 <= '0';
case counter32
when PERIOD1 => clk1 <= '1'
......
end case

You would have a correct sequential template, but as Symon stated this
is something different than the combinatorial statement from a) which
should be easy observable in a simulation.

bye Thomas

 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Why not mix concurrent and synchronous assignments in the same process? KJ VHDL 4 09-21-2012 01:11 PM
parallel/concurrent process in python Ommer.Simjee@gmail.com Python 4 03-10-2009 11:51 PM
Process vs concurrent stataments? p.tucci VHDL 11 01-21-2009 06:33 PM
Concurrent, persistent background process for a J2EE container Arne Vajh°j Java 23 08-31-2008 02:15 AM
problems locating the concurrent EDU.oswego.cs.dl.util.concurrent package Pep Java 6 08-16-2005 07:26 AM



Advertisments