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

P

Perry

Guest
hi all,
i often seen the expression "always@(posedge CLK)", however, what is
the difference when no "always"?

thanks
 
always@(posedge clk) => every +edge of the clock.
@(posedge clk) => next +edge of the clock.
 
"Perry :
"
hi all,
i often seen the expression "always@(posedge CLK)", however, what is
the difference when no "always"?

thanks
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
 
On 2006-12-08, Perry <lipeng.net@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.)

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
 
On 2006-12-12, Andreas Ehliar <ehliar@lysator.liu.se> wrote:
On 2006-12-08, Perry <lipeng.net@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
 

Welcome to EDABoard.com

Sponsor

Back
Top