module mc_clock(\r
\r
I_CLK_36M,\r
+I_DCM_LOCKED,\r
O_CLK_18M,\r
O_CLK_12M,\r
O_CLK_06M,\r
);\r
\r
input I_CLK_36M;\r
+input I_DCM_LOCKED;\r
output O_CLK_18M;\r
output O_CLK_12M;\r
output O_CLK_06M;\r
// 2/3 clock (duty 66%)\r
always @(posedge I_CLK_36M)\r
begin\r
- case (state)\r
- 2'd0: state <= 2'd1;\r
- 2'd1: state <= 2'd2;\r
- 2'd2: state <= 2'd0;\r
- 2'd3: state <= 2'd0;\r
- endcase\r
+ if (I_DCM_LOCKED == 1) begin\r
+ case (state)\r
+ 2'd0: state <= 2'd1;\r
+ 2'd1: state <= 2'd2;\r
+ 2'd2: state <= 2'd0;\r
+ 2'd3: state <= 2'd0;\r
+ endcase\r
\r
- if (state == 2'd2)\r
+ if (state == 2'd2)\r
+ clk_12m = 0;\r
+ else\r
+ clk_12m = 1;\r
+ end\r
+ else begin\r
+ state <= 2'd0;\r
clk_12m = 0;\r
- else\r
- clk_12m = 1;\r
+ end\r
end\r
\r
assign O_CLK_12M = clk_12m;\r
reg CLK_18M;\r
always @(posedge I_CLK_36M)\r
begin\r
- CLK_18M <= ~ CLK_18M;\r
+ if (I_DCM_LOCKED == 1)\r
+ CLK_18M <= ~ CLK_18M;\r
+ else\r
+ CLK_18M <= 0;\r
end\r
assign O_CLK_18M = CLK_18M;\r
\r
wire W_CLK_6M,WB_CLK_6M;\r
wire W_CLK_6Mn;\r
wire W_STARS_CLK;\r
+wire W_DCM_LOCKED;\r
\r
mc_dcm clockgen(\r
.CLKIN_IN(I_CLK_125M),\r
.RST_IN(! W_RESETn),\r
-.CLKFX_OUT(W_CLK_36M)\r
+.CLKFX_OUT(W_CLK_36M),\r
+.LOCKED_OUT(W_DCM_LOCKED)\r
);\r
\r
//------ H&V COUNTER -------------------------\r
mc_clock MC_CLK(\r
\r
.I_CLK_36M(W_CLK_36M),\r
+.I_DCM_LOCKED(W_DCM_LOCKED),\r
.O_CLK_18M(W_CLK_18M),\r
.O_CLK_12M(WB_CLK_12M),\r
.O_CLK_06M(WB_CLK_6M),\r