J
Johnsy Joseph
Guest
Hello Everybody,
I am new to Verilog and would be very grateful if somebody could
kindly answer my doubt.
I understand that there are 2 ways by which we can specify things in
the sensitivity list of the always construct. Suppose I have a
variable called "moving". I can write it in 2 ways as "always @
(moving)" or "always @ (negedge moving)" depending on the application
I require. I now consider only the cases where 'moving' can have 0 or
1 and not 'x' or 'z'.
In that case I believe that "always @ (moving)" will enter at 2 times,
when moving from 0 to 1 or when it changes from 1 to 0. My question
is, when changing from 0 to 1, what will be the value of 'moving'
inside the always statement? Will it be 0 or 1? When changing from 1
to 0, what will be the value of 'moving' inside the always statement?
Will it be 0 or 1?
Similarly I believe that "always @ (negedge moving)" will enter only
once, when moving from 1 to 0. My question is, when changing from 1 to
0, what will be the value that 'moving' will hold inside the always
statement? Will it be 0 or 1? In short do we hold the final value or
the previous value of the change which caused the always to enter?
Please forgive me for such a qn, if it looks stupid.
Thanks for the help
Warm Regards
Johnsy
I am new to Verilog and would be very grateful if somebody could
kindly answer my doubt.
I understand that there are 2 ways by which we can specify things in
the sensitivity list of the always construct. Suppose I have a
variable called "moving". I can write it in 2 ways as "always @
(moving)" or "always @ (negedge moving)" depending on the application
I require. I now consider only the cases where 'moving' can have 0 or
1 and not 'x' or 'z'.
In that case I believe that "always @ (moving)" will enter at 2 times,
when moving from 0 to 1 or when it changes from 1 to 0. My question
is, when changing from 0 to 1, what will be the value of 'moving'
inside the always statement? Will it be 0 or 1? When changing from 1
to 0, what will be the value of 'moving' inside the always statement?
Will it be 0 or 1?
Similarly I believe that "always @ (negedge moving)" will enter only
once, when moving from 1 to 0. My question is, when changing from 1 to
0, what will be the value that 'moving' will hold inside the always
statement? Will it be 0 or 1? In short do we hold the final value or
the previous value of the change which caused the always to enter?
Please forgive me for such a qn, if it looks stupid.
Thanks for the help
Warm Regards
Johnsy