欧美1区2区3区激情无套,两个女人互添下身视频在线观看,久久av无码精品人妻系列,久久精品噜噜噜成人,末发育娇小性色xxxx

題解 | #任意小數(shù)分頻#

任意小數(shù)分頻

http://fangfengwang8.cn/practice/24c56c17ebb0472caf2693d5d965eabb

`timescale 1ns/1ns

module div_M_N(
 input  wire clk_in,
 input  wire rst,
 output wire clk_out
);
parameter M_N = 8'd87; 
parameter c89 = 8'd24; // 8/9時鐘切換點
parameter div_e = 5'd8; //偶數(shù)周期
parameter div_o = 5'd9; //奇數(shù)周期

//之前得奇數(shù)分頻要求了占空比50%,所以牽扯到下降沿,現(xiàn)在這個未要求占空比,用clk_in上升沿即可,9分配1 4個 0 5個
reg [7:0]cnt;
reg [3:0]cnt_8,cnt_9;
always@(posedge clk_in or negedge rst)begin
    if(!rst)begin
        cnt <= 8'b0;
    end
    else if(cnt < M_N)begin
        cnt <= cnt + 1'b1;
    end
    else begin
        cnt <= 8'd1;
    end
end
//cnt8
always@(posedge clk_in or negedge rst)begin
    if(!rst)begin
        cnt_8 <= 4'b0;
    end
    else if(cnt <= c89)begin
        if(cnt_8 == 4'd8)begin
            cnt_8 <= 4'd1;
        end
        else begin
            cnt_8 <= cnt_8 + 1'b1;
        end
    end
    else if(cnt == M_N)begin
        cnt_8 <= 4'd1;
    end
end
//cnt9
always@(posedge clk_in or negedge rst)begin
    if(!rst)begin
        cnt_9 <= 4'b0;
    end
    else if(cnt >= c89 && cnt < M_N)begin 
        if(cnt_9 == 4'd9)begin
            cnt_9 <= 4'd1;
        end
        else begin
            cnt_9 <= cnt_9 + 1'b1;
        end
    end
    else if(cnt == M_N)begin
        cnt_9 <= 4'b0;
    end

end


reg clk_out_temp;
always@(posedge clk_in or negedge rst)begin
    if(!rst)begin
        clk_out_temp <= 1'b0;
    end
    else if(cnt <= c89)begin //3個8分頻
        if(cnt_8 == 4'd0 | cnt_8 == 4'd8)begin
            clk_out_temp <= 1'b1;
        end
        else if(cnt_8 == 4'd4)begin
            clk_out_temp <= 1'b0;
        end
    end
    else if(cnt > c89 && cnt <= M_N) begin  //7個9分頻
        if(cnt_9 == 4'd0 | cnt_9 == 4'd9)begin
            clk_out_temp <= 1'b1;
        end
        else if(cnt_9 == 4'd4)begin
            clk_out_temp <= 1'b0;
        end
    end
end

assign clk_out = clk_out_temp;
endmodule

全部評論
如果理解了小數(shù)分頻的意思,這個題就不是很難了,我實現(xiàn)的方法就是三個計數(shù)器,來計數(shù)。需要注意的是計數(shù)器rst復(fù)位初始化都為0,使用過程中復(fù)位的時候均復(fù)位到1,1到87,1到8,1到9
點贊 回復(fù) 分享
發(fā)布于 2023-02-14 16:55 廣東

相關(guān)推薦

誰知道呢_:要掉小珍珠了,庫庫學(xué)三年,這個結(jié)果
點贊 評論 收藏
分享
評論
1
收藏
分享

創(chuàng)作者周榜

更多
??途W(wǎng)
牛客企業(yè)服務(wù)