关于占空比为50%的三分频设计(verilog)
毛刺。
就是说可以综合了?
完全可以综合的,把时钟取反后再上升沿
always@(posedge clk or negedge rst_n)
assign clk1=~clk;
always@(posedge clk1 or negedge rst_n)
把代码给我们参考一下嘛我也想知道怎么写的
对哦,我怎么没想到呵呵!谢谢!
网上是这样写的!
module div3(clk, reset, clk_div3);
input clk;
input reset;
output clk_div3;
reg clk1;
reg[1:0] state;
always@(posedge clk or negedge reset)
begin
if(!reset)
state<= 2’b00;
else
begin
case(state)
2’b00: state<= 2’b01;
2’b01: state<= 2’b11;
2’b10: state<= 2’b00;
2’b11: state<= 2’b00;
endcase
end
end
always@(negedge clk or negedge reset)
begin
if(!reset)
clk1<= 0;
else
clk1<= state[0];
end
assign clk_div3 = clk1 & state[0];
endmodule
module div3(clk, reset, clk_div3);
input clk;
input reset;
output clk_div3;
reg clk1;
reg[1:0] state;
wire clk1;
assign clk1=~clk;
always@(posedge clk or negedge reset)
begin
if(!reset)
state<= 2’b00;
else
begin
case(state)
2’b00: state<= 2’b01;
2’b01: state<= 2’b11;
2’b10: state<= 2’b00;
2’b11: state<= 2’b00;
endcase
end
end
always@(posedge clk1 or negedge reset)
begin
if(!reset)
clk1<= 0;
else
clk1<= state[0];
end
assign clk_div3 = clk1 & state[0];
endmodule
[b]回复 [url=http://bbs.
soga!
ding.......................................
nice!