Mapping the DCM clock output onto a global buffer

Jun 18, 2008 7 Replies

Hello, I am using a Xilinx Spartan-3 FPGA (XC3S200-4), and I am having difficulty mapping the Digital Clock Manager (DCM) output onto my clock net using a global buffer.



My intent is to take my external clock, input it into the DCM, and use the double frequency output, X2, to run my internal logic. I used the Xilinx Wizard to generate code for the DCM, and I have am instance of that DCM in my VHDL file. The Wizard does map the X2 output to a Global Buffer, BUFG, but when I assign that output to my clock net, it looks like it is on a local routing line.



Should I assign my clock net to another BUFG? This looks like a waste of resources. I should only have to use one Global Buffer for the X2 output. I have attached my VHDL code below. Thanks for the help.



Here is the instantiation in my code:



Inst_dcm_x2: dcm_x2 PORT MAP ( CLKIN_IN => clock, -- This is my external clock in RST_IN => rst_bar, CLKIN_IBUFG_OUT => open, CLK0_OUT => open, CLK2X_OUT => clk, -- I am trying to map the CLK2X_OUT to clk LOCKED_OUT => dcm_locked );


Here is the VHDL code the wizard generated:



entity dcm_x2 is port ( CLKIN_IN : in std_logic; RST_IN : in std_logic; CLKIN_IBUFG_OUT : out std_logic; CLK0_OUT : out std_logic; CLK2X_OUT : out std_logic; LOCKED_OUT : out std_logic); end dcm_x2;



architecture BEHAVIORAL of dcm_x2 is signal CLKFB_IN : std_logic; signal CLKIN_IBUFG : std_logic; signal CLK0_BUF : std_logic; signal CLK2X_BUF : std_logic; signal GND_BIT : std_logic; begin GND_BIT CLK0_BUF, O=>CLKFB_IN);



CLK2X_BUFG_INST : BUFG port map (I=>CLK2X_BUF, O=>CLK2X_OUT); -- CLK2X_OUT is already assigned to a BUFG, how do I map this to 'clk'



DCM_INST : DCM generic map( CLK_FEEDBACK => "1X", CLKDV_DIVIDE => 2.0, CLKFX_DIVIDE => 1, CLKFX_MULTIPLY => 4, CLKIN_DIVIDE_BY_2 => FALSE, CLKIN_PERIOD => 25.000, CLKOUT_PHASE_SHIFT => "NONE", DESKEW_ADJUST => "SYSTEM_SYNCHRONOUS", DFS_FREQUENCY_MODE => "LOW", DLL_FREQUENCY_MODE => "LOW", DUTY_CYCLE_CORRECTION => TRUE, FACTORY_JF => x"8080", PHASE_SHIFT => 0, STARTUP_WAIT => FALSE) port map (CLKFB=>CLKFB_IN, CLKIN=>CLKIN_IBUFG, DSSEN=>GND_BIT, PSCLK=>GND_BIT, PSEN=>GND_BIT, PSINCDEC=>GND_BIT, RST=>RST_IN, CLKDV=>open, CLKFX=>open, CLKFX180=>open, CLK0=>CLK0_BUF, CLK2X=>CLK2X_BUF, CLK2X180=>open, CLK90=>open, CLK180=>open, CLK270=>open, LOCKED=>LOCKED_OUT, PSDONE=>open, STATUS=>open);



end BEHAVIORAL;


What makes you think the clock is local routing?

You should be able to use FPGA Editor to see the DCM and BUFG instances and the associated clocks.

If you see the clock jumping off the global net, perhaps there's a mixup with the appropriate device half or quadrant that the BUFG drives versus the location of the driven logic.

Good luck,

- John_H

Hi John,

The tool reports that there could be excessive skew on the clk signal. I also have this signal mapped to an IO pin. Maybe that is what the tool is complaining about?

Thanks for the suggestion of using the FPGA Editor. I will take a look to see what is actually going on.

You probably have it figured out. What I like to do to get clocks to the outputs is use the IOB DDR flops with opposite DC values on the the D inputs for the two phases. I get a clock that stays 100% global and is better correlated to output data generated by that clock.

- John

Hi John,

Thanks for the suggestion for outputting the clock using the DDR flops. I'll give it a try.

BT

Hi John,

I have dug into the DCM issue a bit more. It looks like it is indeed being routed onto a global clock net after the DCM.

I decided to create a simple design to remove the complexity and focus on the DCM. I now have a design that instantiates a 8-bit counter. The tool states it can run at 220+ MHZ. Once, I add the DCM, the frequency is cut in half. Have you seen this behavior from a DCM? It seems strange that the max frequency would be cut in half like this.

Thanks.

It only makes sense if you have signals in a counter loop that are registered by a different version of the clock, adding unexpected delays. A properly synchronous counter does not care if its clock is from a DCM or from a global input. There's a remote possibility the DCM jitter affects the maximum frequency but the timing budget is only affected by DCM jitter on a few devices, not the whole Xilinx portfolio.

I've had a 300 MHz DCM working two synchonous circuits internally in a DDR phased arrangement in a Spartan-3E, no problem.

Your timing report should be able to give you the full timing budget. If you look at the report with the DCM and the report without, you should see where they differ so widely.

- John_H

t

That probably is the input clock frequency. If you feed a 200MHz counter through a 2x DCM the input clock can only run at up to 100MHz before the maximum frequency of the counter is exceeded.

Kolja Sulimma

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required