Periodic feedback pure digital phase-locked loop based on actel fpga
[Copy link]
This post was last edited by teleagle on 2018-10-8 22:19 A periodic feedback pure digital phase-locked loop based on actel FPGA: Simply put, it is to establish a state machine, update the value of the input cycle parameter at the first time of each cycle of the clock, and then enter the next state counting, and return to the initial state when the count is consistent with the input cycle. The code synthesis simulation is correct, and the process is relatively simple, so I will not teach you how to do it. If there are any inappropriate parts, let's learn and communicate together and improve them together. The code is as follows: //Top-level module: module TE_DPLL_B(sys_clk, sys_rst, clk_in, clk_out); //---Global parameters---parameter DATA_W = 16; // The cycle counter and data bit width are adjusted according to the difference between the system clock and the input clock. parameter PN_EDGE = 2'b01; // Edge detection parameter (01=rising edge, 10=falling edge) parameter DPLL_M = 2; // M parameter parameter DPLL_N = 10; // N parameter //---Input and output interface--- input sys_clk; // System clock input sys_rst; // System reset input clk_in; // Input clock output clk_out; // Output clock TE_DPLL_Figure TE_DPLL_Figure_0( .sys_clk(sys_clk), // System clock .sys_rst(sys_rst), // System reset .clk_i(clk_in), // Input clock .t_o(n_ti) // Input clock period value ); defparam TE_DPLL_Figure_0.CNT_W = DATA_W; // Period counter bit width defparam TE_DPLL_Figure_0.PN_EDGE = PN_EDGE; // Edge detection parameters (01=rising edge, 10=falling edge) //--------------------------------------------------------- // Instantiate feedback module //--------------------------------------------------------- TE_DPLL_Feed TE_DPLL_Feed_0( .sys_clk(sys_clk), // System clock .sys_rst(sys_rst), // System reset .ti_i(n_ti), // Input period value .clk_o(clk_out) // Output clock ); defparam TE_DPLL_Feed_0.DATA_W = DATA_W; // Data bit width defparam TE_DPLL_Feed_0.PN_EDGE = PN_EDGE; // Edge detection parameter (01=rising edge, 10=falling edge) defparam TE_DPLL_Feed_0.DPLL_M = DPLL_M; // M parameter defparam TE_DPLL_Feed_0.DPLL_N = DPLL_N; // N parameter endmodule
|