您当前的位置: 首页 > 

FPGA硅农

暂无认证

  • 1浏览

    0关注

    282博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Xilinx IDDR与ODDR原语的使用

FPGA硅农 发布时间:2021-12-26 20:26:10 ,浏览量:1

IDDR原语

在这里插入图片描述 如图所示,IDDR原语的输入输出包括D,CE,C,S,R,Q1,Q2,其中,D为输入的双倍速率的数据,即D在时钟的上升沿和下降沿都会发生切换,一个时钟周期发送2bit数据,CE为时钟使能信号,C为时钟信号,S,R为复位和置位信号,Q1,Q2为单倍速率的输出数据。 IDDR主要有三种工作模式,分别是:OPPOSITE_EDGE, SAME_EDGE,SAME_EDGE_PIPELINED 。 下面分别作一介绍:

1.OPPOSITE_EDGE

在这里插入图片描述 在该模式下,上升沿采样到的数据(如DOA)和下降沿采样到的数据(如D1A),可以在下一个时钟周期的上升沿从Q1,Q2端口读取。 附一张仿真的效果图: 在这里插入图片描述

2.SAME_EDGE

在这里插入图片描述 在该模式下,上升沿读取的数据,可以在下一个时钟周期的上升沿从Q1端口读取,而下降沿读取的数据,可以在下下个时钟周期的上升沿从Q2端口读取。 仿真波形如下 在这里插入图片描述

3.SAME_EDGE_PIPELINED

在这里插入图片描述 在该模式下,上升沿和下降沿捕获的数据将可以在下下个时钟周期的上升沿从Q1,Q2端口读取。 仿真波形如下: 在这里插入图片描述

代码

设计文件

`timescale 1ns / 1ps
//
// Company: 
// Engineer: 
// 
// Create Date: 2021/12/26 19:04:39
// Design Name: 
// Module Name: top
// Project Name: 
// Target Devices: 
// Tool Versions: 
// Description: 
// 
// Dependencies: 
// 
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
// 
//


module top(
input logic clk,
input logic rst,
input logic ddr_data_i,
output logic [1:0] sdr_data_o
    );



//      IDDR     : In order to incorporate this function into the design,
//     Verilog   : the following instance declaration needs to be placed
//    instance   : in the body of the design code.  The instance name
//   declaration : (IDDR_inst) and/or the port declarations within the
//      code     : parenthesis may be changed to properly reference and
//               : connect this function to the design.  Delete or comment
//               : out inputs/outs that are not necessary.

//  

   // IDDR: Input Double Data Rate Input Register with Set, Reset
   //       and Clock Enable.
   //       Artix-7
   // Xilinx HDL Language Template, version 2019.2

IDDR #(
    .DDR_CLK_EDGE("SAME_EDGE_PIPELINED"), // "OPPOSITE_EDGE", "SAME_EDGE" 
                                    //    or "SAME_EDGE_PIPELINED" 
    .INIT_Q1(1'b0), // Initial value of Q1: 1'b0 or 1'b1
    .INIT_Q2(1'b0), // Initial value of Q2: 1'b0 or 1'b1
    .SRTYPE("SYNC") // Set/Reset type: "SYNC" or "ASYNC" 
) IDDR_inst (
    .Q1(sdr_data_o[1]), // 1-bit output for positive edge of clock
    .Q2(sdr_data_o[0]), // 1-bit output for negative edge of clock
    .C(clk),   // 1-bit clock input
    .CE(1'b1), // 1-bit clock enable input
    .D(ddr_data_i),   // 1-bit DDR data input
    .R(1'b0),   // 1-bit reset
    .S(rst)    // 1-bit set
);
// End of IDDR_inst instantiation
					
					
endmodule

测试平台

`timescale 1ns / 1ps
//
// Company: 
// Engineer: 
// 
// Create Date: 2021/12/26 19:18:01
// Design Name: 
// Module Name: test_tb
// Project Name: 
// Target Devices: 
// Tool Versions: 
// Description: 
// 
// Dependencies: 
// 
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
// 
//


module test_tb(

    );

logic clk;
logic clk_div;
logic rst;
logic ddr_data;
logic [1:0] sdr_data;
//clk
initial begin
    clk=0;
    forever begin
        #5 clk=~clk;
    end
end
//clk_div
always_ff@(posedge clk,posedge rst)
if(rst)
    clk_div            
关注
打赏
1658642721
查看更多评论
0.0380s