0
\$\begingroup\$

While I use the internal clock for DCM clkin input I am getting clk0 as perfect frequency of output same as internal clock but not in remaining o/p pins. I changed from previous coding like this and also schematic as below.

module dcm_clockverilog(clk,rst,clkdiv,clk0,clk2x,locked,clock);

input clk;
input rst;

output clkdiv;
output clk0;
output clk2x;
output locked;
output  clock;

wire clk0;
wire clk2x;
wire locked;
wire clkdiv;


reg [7:0] count=0;
reg clock=0;

dcmm instance_name (
    .CLKIN_IN(clock), 
    .RST_IN(rst),  
    .CLKDV_OUT(clkdiv), 
    .CLK0_OUT(clk0), 
    .CLK2X_OUT(clk2x), 
    .LOCKED_OUT(locked)
    );

always @(posedge clk)
begin
   count <=count+1;

if(count<=9) 
   clock<=0;
if(count>=10)
   clock<=1;
if(count>=19)
   count<=0;    
end 

endmodule



//---------------------------------------------plan ahead 

# PlanAhead Generated physical constraints 

NET "clk" LOC = P57;//-- (GCLK)
NET "clk0" LOC = P7;//--(I/O)
NET "clk2x" LOC = P8;//--(I/O)
NET "clkdiv" LOC = P10;//--(I/O)
NET "clock" LOC = P11;//--(THIS CLOCK I ASSIGN AS INPUT FOR DCM CLKIN) )
NET "locked" LOC = P12;//--(I/O)
NET "rst" LOC = P18;//--(INPUT SWITCH)

enter image description here

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

You don't have CLKFB connected - I'm surprised you get anything!

From the Spartan 3 userguide, UG331

CLKFB Clock feedback input to DCM. The feedback input is required unless the Digital Frequency Synthesis outputs, CLKFX or CLKFX180, are used stand-alone. The source of the CLKFB input must be the CLK0 or CLK2X output from the DCM and the CLK_FEEDBACK must be set to 1X or 2X accordingly. The feedback point ideally includes the delay added by the clock distribution network, either internally or externally.

\$\endgroup\$
3
  • \$\begingroup\$ Mr martin thompson pls see that schematic i connected clk0 output as clkfb input fro DCM WITH i/o BUFFER .... \$\endgroup\$
    – user39051
    Commented Mar 25, 2014 at 7:44
  • \$\begingroup\$ The schematic is unreadable, so I was going by what your code says. If your code has the feedback in it, please post that so we are not looking for problems in the wrong place. \$\endgroup\$ Commented Mar 25, 2014 at 10:09
  • \$\begingroup\$ Mr martin thompson thanks for your guidance .......... \$\endgroup\$
    – user39051
    Commented Mar 26, 2014 at 4:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.