标签:
最近项目需要用到差分信号传输,于是看了一下FPGA上差分信号的使用。Xilinx FPGA中,主要通过原语实现差分信号的收发:OBUFDS(差分输出BUF),IBUFDS(差分输入BUF)。
注意在分配引脚时,只需要分配SIGNAL_P的引脚,SIGNAL_N会自动连接到相应差分对引脚上;若没有使用差分信号原语,则在引脚电平上没有LVDS的选项(IO Planning PlanAhead)。
测试代码:
////////////////////////////////////////////////////////////////////////////////// module lvds_test( sys_clk, sys_rst, signal_in_p, signal_in_n, signal_out_p, signal_out_n, led_signal ); input sys_clk,sys_rst; input signal_in_p,signal_in_n; output signal_out_p,signal_out_n; output led_signal; wire signal_out_temp; reg[31:0] clk_cnt; always @ (posedge sys_clk) begin if(!sys_rst) clk_cnt <= 32‘d0; else begin if(clk_cnt == 32‘d10_000_000) clk_cnt <= 32‘d0; else clk_cnt <= clk_cnt+1‘b1; end end assign signal_out=(clk_cnt >= 32‘d5_000_000) ? 1 : 0; OBUFDS signal_out_diff( .O(signal_out_p), .OB(signal_out_n), .I(signal_out) ); IBUFDS signal_in_diff( .O(led_signal), .I(signal_in_p), .IB(signal_in_n) ); endmodule
约束文件:
NET "signal_out_p" IOSTANDARD = LVDS_33; NET "signal_out_p" LOC = U16; NET "sys_clk" IOSTANDARD = LVCMOS33; NET "sys_rst" IOSTANDARD = LVCMOS33; NET "led_signal" LOC = D18; NET "led_signal" IOSTANDARD = LVCMOS33; #Created by Constraints Editor (xc6slx45t-csg324-3) - 2016/06/06 NET "sys_clk" TNM_NET = "sys_clk"; TIMESPEC TS_sys_clk = PERIOD "sys_clk" 50 MHz HIGH 50 %; NET "signal_in_p" LOC = T12; NET "signal_in_n" LOC = V12; NET "sys_clk" LOC = G8; NET "sys_rst" LOC = U3; # PlanAhead Generated IO constraints NET "signal_in_p" IOSTANDARD = LVDS_33;
约束文件IO Planning PlanAhead产生,原语的使用可参考:E:\Xilinx\ISE\14.7\ISE_DS\ISE\doc\usenglish\isehelp\spartan6里面提供了所用器件的原语。同时,Xilinx器件内部信号内部还提供了100欧姆电阻匹配,可参考Spartan-6 FPGA SelectIO Resources(UG381)
标签:
原文地址:http://www.cnblogs.com/yangjun1219/p/5565013.html