module clockgen ( input mclk, /* 4.433619 Mhz input */ output sysclk16, /* System clock outputs */ output sysclk33, /* System clock outputs */ output pixclk /* Pixel clock */ ); wire pll_mclk; wire pll_c33; wire pll_c25; wire dll_c33; wire dll_c16; IBUFG mclk_buf( .I(mclk), .O(pll_mclk)); /* Generate 33.25 for the DLL cpu*/ DCM # ( .CLKDV_DIVIDE(2.0), // Divide by: 1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5, // 7.0,7.5,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0 or 16.0 .CLKFX_DIVIDE(2), // Can be any integer from 1 to 32 .CLKFX_MULTIPLY(15), // Can be any integer from 2 to 32 .CLKIN_DIVIDE_BY_2("FALSE"), // TRUE/FALSE to enable CLKIN divide by two feature .CLKIN_PERIOD(225.0), // Specify period of input clock .CLKOUT_PHASE_SHIFT("NONE"), // Specify phase shift of NONE, FIXED or VARIABLE .CLK_FEEDBACK("NONE"), // Specify clock feedback of NONE, 1X or 2X .DESKEW_ADJUST("SYSTEM_SYNCHRONOUS"), // SOURCE_SYNCHRONOUS, SYSTEM_SYNCHRONOUS or an integer from 0 to 15 .DFS_FREQUENCY_MODE("LOW"), // HIGH or LOW frequency mode for frequency synthesis .DLL_FREQUENCY_MODE("LOW"), // HIGH or LOW frequency mode for DLL .DUTY_CYCLE_CORRECTION("TRUE"), // Duty cycle correction, TRUE or FALSE .FACTORY_JF(16'hC080), // FACTORY JF values .PHASE_SHIFT(0), // Amount of fixed phase shift from -255 to 255 .STARTUP_WAIT("FALSE") // Delay configuration DONE until DCM LOCK, TRUE/FALSE ) pllmain ( .CLKFX(pll_c33), // DCM CLK synthesis out (M/D) .CLKIN(pll_mclk) // Clock input (from IBUFG, BUFG or DCM) ); /* Generate a rough 25.1Mhz for the video */ DCM # ( .CLKDV_DIVIDE(3.0), // Divide by: 1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5, // 7.0,7.5,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0 or 16.0 .CLKFX_DIVIDE(3), // Can be any integer from 1 to 32 .CLKFX_MULTIPLY(17), // Can be any integer from 2 to 32 .CLKIN_DIVIDE_BY_2("FALSE"), // TRUE/FALSE to enable CLKIN divide by two feature .CLKIN_PERIOD(225.0), // Specify period of input clock .CLKOUT_PHASE_SHIFT("NONE"), // Specify phase shift of NONE, FIXED or VARIABLE .CLK_FEEDBACK("NONE"), // Specify clock feedback of NONE, 1X or 2X .DESKEW_ADJUST("SYSTEM_SYNCHRONOUS"), // SOURCE_SYNCHRONOUS, SYSTEM_SYNCHRONOUS or an integer from 0 to 15 .DFS_FREQUENCY_MODE("LOW"), // HIGH or LOW frequency mode for frequency synthesis .DLL_FREQUENCY_MODE("LOW"), // HIGH or LOW frequency mode for DLL .DUTY_CYCLE_CORRECTION("TRUE"), // Duty cycle correction, TRUE or FALSE .FACTORY_JF(16'hC080), // FACTORY JF values .PHASE_SHIFT(0), // Amount of fixed phase shift from -255 to 255 .STARTUP_WAIT("FALSE") // Delay configuration DONE until DCM LOCK, TRUE/FALSE ) pllpix ( .CLKFX(pll_c25), // DCM CLK synthesis out (M/D) .CLKIN(pll_mclk) // Clock input (from IBUFG, BUFG or DCM) ); /* DLL that 33.25Mhz input and generate the 16.6 from it. Note: The Xilinx tools don't * seem to like when you do that ;-) Looks like we should really have put a faster * crystal on the board */ DCM # ( .CLKDV_DIVIDE(2.0), // Divide by: 1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5, // 7.0,7.5,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0 or 16.0 .CLKFX_DIVIDE(2), // Can be any integer from 1 to 32 .CLKFX_MULTIPLY(2), // Can be any integer from 2 to 32 .CLKIN_DIVIDE_BY_2("FALSE"), // TRUE/FALSE to enable CLKIN divide by two feature .CLKIN_PERIOD(30.0), // Specify period of input clock .CLKOUT_PHASE_SHIFT("NONE"), // Specify phase shift of NONE, FIXED or VARIABLE .CLK_FEEDBACK("1X"), // Specify clock feedback of NONE, 1X or 2X .DESKEW_ADJUST("SYSTEM_SYNCHRONOUS"), // SOURCE_SYNCHRONOUS, SYSTEM_SYNCHRONOUS or an integer from 0 to 15 .DFS_FREQUENCY_MODE("LOW"), // HIGH or LOW frequency mode for frequency synthesis .DLL_FREQUENCY_MODE("LOW"), // HIGH or LOW frequency mode for DLL .DUTY_CYCLE_CORRECTION("TRUE"), // Duty cycle correction, TRUE or FALSE .FACTORY_JF(16'hC080), // FACTORY JF values .PHASE_SHIFT(0), // Amount of fixed phase shift from -255 to 255 .STARTUP_WAIT("FALSE") // Delay configuration DONE until DCM LOCK, TRUE/FALSE ) dll ( .CLKIN(pll_c33), // Clock input (from IBUFG, BUFG or DCM) .CLK0(dll_c33), // 0 degree DCM CLK output .CLKDV(dll_c16), // Divided DCM CLK out (CLKDV_DIVIDE) .CLKFB(sysclk33) // DCM clock feedback ); /* Global clock buffers */ BUFG clk33_buf( .I(dll_c33), .O(sysclk33)); BUFG clk16_buf( .I(dll_c16), .O(sysclk16)); /* Temporarily assign pixclock to 33Mhz, will fix later */ BUFG pixclk_buf( .I(pll_c25), .O(pixclk)); endmodule // clocks