I need some help I want to write verilog code for up counter using D flip flop
table
N | A B C(current state) clk |next state
0 | 0 0 0 | ↑ 001
1 | 0 0 1 | ↑ 010
2 | 0 1 0 | ↑ 011
3 | 0 1 1 | ↑ 100
4 | 1 0 0 | ↑ 101
5 | 1 0 1 | ↑ 110
6 | 1 1 0 | ↑ 111
7 | 1 1 1 | ↑ 000
verilog code
Code:
module up_counter(current state, next state ,clk)
input current state ;
input clk;
output next state;
reg 3:0
always @ (posedge clk);
begin
next state <= current state +1 ;
end
endmodule
please help me to write code