frequency divider by 2 in Verilog?

Status
Not open for further replies.

jason7361

Newbie level 4
Joined
Apr 14, 2010
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,317
Can anyone give me a divider which frequency equal clock divider by 2 in Verilog?

The divider will create by a D flip flop.

Thank you.
 

Simply invert the output on each clock cycle:
always @(posedge clk)
q <= ~q;
 

always@(posedge clk or negedge rst)
if(rst)
q<= '0';
else
q<= ~q;
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…