Design of divider based on Verilog (half-integer, fractional-divide: lower)

Source: Internet
Author: User

Half-integer divider: The counter is triggered by the rising edge, so when the count is N-1, the Count trigger is flipped, the clock's falling edge changes to the rising edge, so the count value is 0, so every time the n+0.5-frequency clock is generated, the trigger clock is flipped once. , using XOR gate and 2-way module design pulse deduction circuit, pulse deduction is the input frequency and 2 output difference or results.

ModuleFenpin (clk,rst_n,clk_out);inputCLK;inputRst_n;Outputclk_out;RegClk_out2; Wireclk_out1;Reg[1:0] CNT;RegFB_CLK; always@(PosedgeClk_out2,Negedgerst_n)begin if(!rst_n) FB_CLK<=0;ElseFB_CLK<=~FB_CLK;End always@(PosedgeCLK_OUT1,Negedgerst_n)begin if(!rst_n)beginCNT<=0; Clk_out2<=0;EndElse if(cnt==2)beginCNT<=0; Clk_out2<=1;EndElsebeginCNT<=cnt+1'B1;clk_out2<=0;EndEndXORXor1 (CLK_OUT1,CLK,FB_CLK); WireClk_out_r;AssignClk_out_r= (cnt==1) ?1'b0:1'B1;AssignClk_out=clk_out2 |Clk_out_r;Endmodule

Design of divider based on Verilog (half-integer, fractional-divide: lower)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.