Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

what's the differences between "always@(posedge CLK)" and "@(posedge CLK)"?

1,354 views
Skip to first unread message

Perry

unread,
Dec 8, 2006, 3:23:34 AM12/8/06
to
hi all,
i often seen the expression "always@(posedge CLK)", however, what is
the difference when no "always"?

thanks

ank...@yahoo.com

unread,
Dec 8, 2006, 9:29:17 AM12/8/06
to
always@(posedge clk) => every +edge of the clock.
@(posedge clk) => next +edge of the clock.

Shenli

unread,
Dec 9, 2006, 7:18:43 AM12/9/06
to

"Perry :

always@(posedge CLK) is used to describe a D-Flip Flop, while @(posedge
CLK) is used in testbench.

For example,
c = d;
@(posedge CLK);
a = b;

means a = b; will not be executed until there is a posedge CLK(i.e. at
the posedge CLK time slot, simulator will execute a = b) .

Thanks!
Davy

Andreas Ehliar

unread,
Dec 12, 2006, 6:45:41 AM12/12/06
to

You are not allowed to use a @(posedge CLK) (or any other @... event
control statement for that matter) unless you are in a procedural
block (that is, in an always block). (Well, you can use it in a
specify block as well but I don't think that is what you are asking
for.)

So I guess your question boils down to something like this:

What is the difference between

always@(posedge CLK) begin
/* Some code */
end

and


always begin
@(posedge CLK);
/* Some code */
end


As far as I know there is no behavioral difference between these.
But your synthesizer might not like the last example. (At least XST
8.1 doesn't like it.)

/Andreas

Andreas Ehliar

unread,
Dec 12, 2006, 7:11:19 AM12/12/06
to
On 2006-12-12, Andreas Ehliar <ehl...@lysator.liu.se> wrote:
> On 2006-12-08, Perry <lipen...@gmail.com> wrote:
>> hi all,
>> i often seen the expression "always@(posedge CLK)", however, what is
>> the difference when no "always"?
>
> You are not allowed to use a @(posedge CLK) (or any other @... event
> control statement for that matter) unless you are in a procedural
> block (that is, in an always block). (Well, you can use it in a
> specify block as well but I don't think that is what you are asking
> for.)

I just realized that I forgot about initial blocks.
shame on me. You can of course use @... in those blocks
as well.

/Andreas

0 new messages