一开始是使用了clocking wizard 想分出来2个时钟来输出(CLK_50M和MCLK),并且再用产生的一个时钟生成其他信号输出,结果一开始就报错,提示不可以用做输出。然后没有直接输出MCLK信号,而是将次信号做了个寄存器缓存再输出,然而综合却出现了错误:
WARNING:Place:1205 - This design contains a global buffer instance,<PR_MCLK_TYPE_PLL/clkout2_buf>, driving the net, <PR_MCLK_TYPE_OBUF>, that is driving the following (first 30) non-clock source pins off chip.
< PIN: PR_MCLK.O; >
This design practice, in Spartan-6, can lead to an unroutable situation due to limitations in the global routing. If the design does route there may be excessive delay or skew on this net. It is recommended to use a Clock Forwarding technique to create a reliable and repeatable low skew solution:
Synthesize - XST综合过了,但是Implement Design 过不了。经过网上查找及借鉴和Xilinx的ug381手册发现,此处需要实例化一个小元件ODDR2。手册中有源代码。
更改前的代码:
Pr_clk PR_CLK
(// Clock in ports
.CLK_IN1(sys_clk), // IN
// Clock out ports
.CLK_OUT1(clk_out1), // OUT CLK_50M
.CLK_OUT2(clk_out2), // OUT MCLK
// Status and control signals
.RESET(~sys_rst)); // IN
更改后的代码为
Pr_clk PR_CLK
(// Clock in ports
.CLK_IN1(sys_clk), // IN
// Clock out ports
.CLK_OUT1(clk_out1), // OUT
.CLK_OUT2(clk_out2), // OUT
.CLK_OUT3(CLK_50M), // OUT //此处是要引入内部的时钟
.CLK_OUT4(MCLK_TYPE), // OUT //同样要引入内部
// Status and control signals
.RESET(~sys_rst)); // IN
// INST_TAG_END ------ End INSTANTIATION Template ---------
wire clk_out1;
wire clk_out2;
//clk_out1
ODDR2 #(
// The following parameters specify the behavior
// of the component.
.DDR_ALIGNMENT("NONE"), // Sets output alignment
// to "NONE", "C0" or "C1"
.INIT(1'b0), // Sets initial state of the Q
// output to 1'b0 or 1'b1
.SRTYPE("SYNC") // Specifies "SYNC" or "ASYNC"
// set/reset
)
ODDR2_clkout1 (
.Q(clk_50M), // 1-bit DDR output data 需要输出到外部而不能再引入内部的时钟
.C0(clk_out1), // 1-bit clock input
.C1(~clk_out1), // 1-bit clock input
.CE(1'b1), // 1-bit clock enable input
.D0(1'b1), // 1-bit data input (associated with C0)
.D1(1'b0), // 1-bit data input (associated with C1)
.R(1'b0), // 1-bit reset input
.S(1'b0) // 1-bit set input
);
//clk_out2
ODDR2 #(
// The following parameters specify the behavior
// of the component.
.DDR_ALIGNMENT("NONE"), // Sets output alignment
// to "NONE", "C0" or "C1"
.INIT(1'b0), // Sets initial state of the Q
// output to 1'b0 or 1'b1
.SRTYPE("SYNC") // Specifies "SYNC" or "ASYNC"
// set/reset
)
ODDR2_clkout2 (
.Q(MCLK), // 1-bit DDR output data
.C0(clk_out2), // 1-bit clock input
.C1(~clk_out2), // 1-bit clock input
.CE(1'b1), // 1-bit clock enable input
.D0(1'b1), // 1-bit data input (associated with C0)
.D1(1'b0), // 1-bit data input (associated with C1)
.R(1'b0), // 1-bit reset input
.S(1'b0) // 1-bit set input
);
一开始觉得既然clk_50M、MCLK_TYPE可以输出,那么也就可以引入别的模块,结果一到Implement Design 就报错。
错误类型:
The dual data rate register “ODDR2_clkout2” failed to join an OLOGIC component as required.
错误原因是ODDR的输出必须直接连到输出上,不可以再引进逻辑内部。因此会出现do_oddr的输出无法连入OLOGIC中。
解决方法: