vead
Full Member level 5
- Joined
- Nov 27, 2011
- Messages
- 285
- Helped
- 3
- Reputation
- 6
- Reaction score
- 3
- Trophy points
- 1,298
- Location
- india
- Activity points
- 3,815
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
please help me to write code
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