|
发表于 2007-7-17 21:07:04
|
显示全部楼层
改成这样试试看
module fdivision( in_clk,control,out_clk,Reset );
input in_clk,Reset;
input[3:0] control;
output out_clk;
reg[3:0] j;
reg out_clk,out_clk1;
parameter code=4'd0;
always @ ( posedge in_clk)
begin if(!Reset) begin out_clk1<=0;j<=0; end
else if (j==control) begin j<=0;out_clk1<=!out_clk1;end
else j<=j+1;
end
always @ (in_clk or Reset or out_clk)
begin if (!Reset) out_clk<=0;
else if (control==code) out_clk<=in_clk;
else out_clk<=out_clk1;
end
endmodule |
|