FPGA crossover is believed to be a relatively frequent and relatively basic technology in FPGAs. The following is a specific explanation of the clock division of the FPGA.
Concept:
The FPGA clock is divided into the frequency of the system clock of the FPGA according to its own needs, so that it reaches the original 1/N times frequency. According to the value of N, it can usually be divided into even-numbered and odd-numbered.
Even frequency division:
Even frequency division, that is, N is an even number to divide the system clock. This design is mainly implemented by a counter. The design principle is as follows: the system reference clock is used as a trigger condition to make an up counter. When the counter value is (n/2 - 1), the output clock jumps. To implement a divide-by-4 program, do the following:
module div_4(clk,clr_n,clk_o);
input clk;
input clr_n;
Output clk_o;
reg [1:0] cnt_div;
reg clk_o_1;
always @ (posedge clk or negedge clr_n)
begin
if( !clr_n)
cnt_div <= 0;
else if(cnt_div == 2'b01)
cnt_div <= 0;< Br>
else
cnt_div <= cnt_div+1;
end
always @ (posedge clk or negedge clr_n)
begin< Br>
if(!clr_n)
clk_o_1<=0;
else if (cnt_div == 2'b01)
clk_o_1 <= ~clk_o_1;
end
assign clk_o=clk_o_1;
endmodule
odd frequency division:
odd multiple frequency division method when N is The system clock is divided at odd times. The principle is: set two identical counters with the maximum value of (n-1), one of which is triggered by the rising edge of the system clock, and the other is the triggering condition of the falling edge of the system clock; the output clock is at the counter value (n) -1)/2 and (n-1) respectively, flipping to obtain two clocks with a duty ratio other than 50%, and finally performing phase-OR operation on the two output clocks to obtain a duty ratio of 50%. Odd divided clock. The reference code to implement a divide-by-5 clock is as follows:
module div_5(clk,clr_n,clk_o);
input clk;
Input clr_n;
output clk_o;
reg [2:0] cnt_div1;
reg [2:0] cnt_div2;
reg clk_o_1;< Br>
reg clk_o_2;
always @ (posedge clk or negedge clr_n)
begin
if( !clr_n)
cnt_div1 < = 0;
else if(cnt_div1 == 3'b100)
cnt_div1 <= 0;
else
cnt_div1 <= cnt_div1+ 1;
end
always@(posedge clk or negedge clr_n)
begin
if(!clr_n)
clk_o_1< =0;
else if (cnt_div 1== 3'b010)
clk_o_1 <= ~clk_o_1;
else if(cnt_div1 ==3'b100)< Br>
clk_o_1 <= ~clk_o_1;
end
always @ (negedge clk or negedge clr_n)
begin
if( ! Clr_n)
cnt_div2 <= 0;
else if(cnt_div2 == 3'b100)
cnt_div2 <= 0;
else < Br>
cnt_div2 <= cnt_div2+1;
end
always @ (posedge clk or negedge clr_n)
begin
if( !clr_n)
clk_o_2< =0;
else if (cnt_div2== 3'b010)
clk_o_2 <= ~clk_o_2;
else if(cnt_div2 ==3'b100)
clk_o_2 <= ~clk_o_2;
end
assign clk_o=clk_o_1
In recent years, the open source Linux system can be said to be in the limelight, whether it is pers
date command The function of the date command is to display and set the system date and time. The ge
In different Linux distributions, there will be different GUI programs that can display various syst
Azure is one of the representatives of more and more companies considering moving their business to
Modify IP, DNS, and routing configuration under Linux operating system
Remote Warehouse Usage Tutorial
MongoDB installation basic tutorial under LInux
Analysis of Linux static and dynamic libraries
Linux shutdown command shutdown
Linux device model analysis drive article
Solutions to common problems in Linux systems
What is the reason that the Linux operating system does not need to be defragmented?
24 enhanced linux security tips
Linux source code installation apache+mysql+php5 and several forums installed
Can Plug and Play in Win7 system be disabled?
What should I do if the web page prompts "missing objects" under WinXP?
Win8 one pass: associated Sina Weibo to people application
Win7 computer hard disk partition can not be modified how to do
Just three steps to build a mini LAN
Using U disk to install win7 system tutorial under win8PE
Win10 system running anti-war black screen how to do
What should I do if the notebook win7 system installs the card reader?
Experience masters commonly used shortcut combination key Win+D magic effect