第2个回答 2011-11-07
`define K n/2-1
module division_clk(rst,clk_in,clk_out);
input rst,clk_in;
output clk_out;
reg clk_out;
reg[26:0] count;
always@(posedge clk_in or negedge rst)
if(!rst)
begin
count<=0;
clk_out<=0;
end
else
begin
if(j==K)
begin
count<=0;clk_out=~clk_out;
end
else
count<=count+1;
end
endmodule