adgjl40112
Newbie level 5
Hi, guys. I have a verilog problem.
In verilog, how do we lock the value?
What I mean is that I have a counter, and I want to increase it only one time.
If I put counter in the sequential block . It will increase when every posedge clock arrive. It's not what I desired. I want to increase the counter again until next enable signal arrive.
How can I achieve this?
For example, A is my input
It will increase the counter when every psoedge clk arrive.
But I want the counter only increase once. And it increase again when A signal is change.
Please help
In verilog, how do we lock the value?
What I mean is that I have a counter, and I want to increase it only one time.
If I put counter in the sequential block . It will increase when every posedge clock arrive. It's not what I desired. I want to increase the counter again until next enable signal arrive.
How can I achieve this?
For example, A is my input
Code:
always@(posedge clk)
begin
if (A)
counter <= counter + 1;
end
It will increase the counter when every psoedge clk arrive.
But I want the counter only increase once. And it increase again when A signal is change.
Please help