anandruban
Newbie level 2
- Joined
- Dec 14, 2011
- Messages
- 2
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,296
Hello all,
I wnat to know how to achieve a special case always block with delayed non blocking assignments. Consider the following code
`timescale 1s/1ps
always@(posedge clk)
a<=1'b1;
always@(negedge clk)
a<=#100n 1'b0;
In this code, a<=#100n 1'b0 will be executed and the change is scheduled to happen after 100n. but If the negedge of clk occurs before 100n, say it occurs 70n later than the last negedge of clk, the statement a<=#100n 1'b0 will again be executed while the previous statement is still in place. So after 30n (i.e., 100n from the last negedge of clk) the previous scheduled event will happen.
I don't want that to happen, when the next clk edge comes what ever statement that has been executed and scheduled should be killed. Is there any way to do this?
- - - Updated - - -
Hello all,
I found the solution.
always@(posedge clk)
a<=1'b1;
always@(negedge clk) begin
disable schedule
begin:schedule
a<=#100n 1'b0;
end
end
will do what I wanted.....
Thanks...
I wnat to know how to achieve a special case always block with delayed non blocking assignments. Consider the following code
`timescale 1s/1ps
always@(posedge clk)
a<=1'b1;
always@(negedge clk)
a<=#100n 1'b0;
In this code, a<=#100n 1'b0 will be executed and the change is scheduled to happen after 100n. but If the negedge of clk occurs before 100n, say it occurs 70n later than the last negedge of clk, the statement a<=#100n 1'b0 will again be executed while the previous statement is still in place. So after 30n (i.e., 100n from the last negedge of clk) the previous scheduled event will happen.
I don't want that to happen, when the next clk edge comes what ever statement that has been executed and scheduled should be killed. Is there any way to do this?
- - - Updated - - -
Hello all,
I found the solution.
always@(posedge clk)
a<=1'b1;
always@(negedge clk) begin
disable schedule
begin:schedule
a<=#100n 1'b0;
end
end
will do what I wanted.....
Thanks...