除頻器的程式

我不會打除頻器的程式,誰能把除頻器的程式貼上來呢?麻煩一下嚕!!

1 Answer

Rating
  • 小白
    Lv 5
    1 decade ago
    Favorite Answer

    //

    // The frequency of clk_in is divided by default power(2,20).

    //

    module freq_div (clk_in, reset, clk_out);

    parameter size=20;

    input clk_in, reset;

    output clk_out;

    reg [size-1:0]divider;

    integer i;

    assign clk_out = divider[size-1];

    always @(posedge clk_in or negedge reset)

    begin

    if (!reset)

    for (i=1'd0; i < size; i=i 1'd1)

    divider[i] = 1'd0;

    else

    divider = divider 1'd1;

    end

    endmodule

    以上是所有的除頻器程式碼...

    希望能解決你的問題...

    2007-10-11 08:35:52 補充:

    divider = divider 1'd1;

    那一行少打一個"+"

    divider = divider+1'd1;

    Source(s): 自己
Still have questions? Get your answers by asking now.