FPGA——DDR3的IP核

FPGA——DDR3的ip核

  • IP核配置
  • 基于MIG核代码
  • 基于AXI接口的DDR3

IP核配置

1
在这里插入图片描述
在这里插入图片描述
2
在这里插入图片描述
3
在这里插入图片描述

4
在这里插入图片描述

5
在这里插入图片描述
6
在这里插入图片描述

基于MIG核代码

控制MIG核的信号进行读写

module MIG_APP_Drive(input               i_ui_clk            ,input               i_ui_rst            ,input			    init_calib_complete ,output [28:0]		app_addr            ,    output [2 :0]		app_cmd             ,                        output				app_en              ,                    output [255:0]		app_wdf_data        ,                    output				app_wdf_end         ,                    output				app_wdf_wren        ,                input  [255:0]		app_rd_data         ,                    input			    app_rd_data_end     ,                        input			    app_rd_data_valid   ,                    input			    app_rdy             ,                    input			    app_wdf_rdy         ,                output [31:0]		app_wdf_mask        ,    input  [1 :0]       i_operation_cmd     ,input  [15:0]       i_operation_len     ,input  [28:0]       i_operation_addr    ,input               i_operation_valid   ,output              o_operation_ready   ,input  [255:0]      i_write_data        ,input               i_write_last        ,input               i_write_valid       ,output [255:0]      o_read_data         ,output              o_read_valid                     
);/***************function**************//***************parameter*************/
localparam              P_ST_INIT       =   0   ,P_ST_IDLE       =   1   ,P_ST_WAIT       =   2   ,P_ST_WRITE      =   3   ,P_ST_READ       =   4   ,P_ST_READ_WAIT  =   5   ;/***************port******************/             /***************mechine***************/
(* mark_debug = "true" *)reg  [7 :0]             r_st_current        ;
reg  [7 :0]             r_st_next           ;
reg  [15:0]             r_st_cnt            ;/***************reg*******************/
reg  [28:0]		        ro_app_addr         ;
reg  [2 :0]		        ro_app_cmd          ;
reg  				    ro_app_en           ;
reg  				    ro_app_wdf_wren     ;
reg  [31:0]             ro_app_wdf_mask     ;
reg                     ro_operation_ready  ;
reg  [255:0]            ro_read_data        ;
reg                     ro_read_valid       ;
reg  [1 :0]             ri_operation_cmd    ;
reg  [15:0]             ri_operation_len    ;
reg  [28:0]             ri_operation_addr   ;
reg                     r_op_act            ;
reg  [15:0]             r_write_cnt         ;
reg  [15:0]             r_read_cnt          ;
(* mark_debug = "true" *)reg  [15:0]             r_read_data_cnt     ;
reg  [7 :0]             r_init              ;/***************wire******************/
wire                    w_op_act            ;
wire [255:0]            w_write_fifo_dout   ;
wire                    w_write_fifo_empty  ;
wire                    w_write_fifo_full   ;
wire                    w_mig_wvalid        ;
wire                    w_mig_rvalid        ;
wire                    w_write_fifo_rd_en  ;/***************component*************/
FIFO_256X512 FIFO_256X512_U0 (.clk                  (i_ui_clk           ),      // input wire clk.din                  (i_write_data       ),      // input wire [63 : 0] din.wr_en                (i_write_valid      ),  // input wire wr_en.rd_en                (w_write_fifo_rd_en ),  // input wire rd_en.dout                 (w_write_fifo_dout  ),    // output wire [63 : 0] dout.full                 (w_write_fifo_full  ),    // output wire full.empty                (w_write_fifo_empty )  // output wire empty
);
/***************assign****************/
assign app_addr             = ro_app_addr           ;
assign app_cmd              = ro_app_cmd            ;
assign app_en               = ro_app_en & app_rdy   ;
assign app_wdf_data         = w_write_fifo_dout     ;
assign app_wdf_end          = app_wdf_wren          ; 
assign app_wdf_wren         = ro_app_wdf_wren & app_rdy & app_wdf_rdy;
assign app_wdf_mask         = ro_app_wdf_mask       ;
assign o_operation_ready    = ro_operation_ready    ;
assign o_read_data          = ro_read_data          ;
assign o_read_valid         = ro_read_valid         ;
assign w_op_act             = i_operation_valid & o_operation_ready;
assign w_mig_wvalid         = app_rdy & app_wdf_rdy & app_en & ro_app_wdf_wren & app_cmd == 0;
assign w_write_fifo_rd_en   = w_mig_wvalid          ;
assign w_mig_rvalid         = app_rdy & app_en & app_cmd == 1;/***************always****************/
always@(posedge i_ui_clk,posedge i_ui_rst) 
beginif(i_ui_rst)r_st_current <= P_ST_INIT;else r_st_current <= r_st_next;
endalways@(*)
begincase(r_st_current)P_ST_INIT       : r_st_next = &r_init   ? P_ST_IDLE     : P_ST_INIT;P_ST_IDLE       : r_st_next = r_op_act  ?ri_operation_cmd == 0 ? P_ST_WAIT     : P_ST_READ: P_ST_IDLE ;P_ST_WAIT       : r_st_next = r_st_cnt    == 4                          ? P_ST_WRITE    : P_ST_WAIT         ;P_ST_WRITE      : r_st_next = r_write_cnt == ri_operation_len - 1 & w_mig_wvalid    ? P_ST_IDLE     : P_ST_WRITE        ;P_ST_READ       : r_st_next = r_read_cnt  == ri_operation_len - 2 & w_mig_rvalid    ? P_ST_READ_WAIT: P_ST_READ         ;P_ST_READ_WAIT  : r_st_next = r_read_data_cnt >= ri_operation_len - 2 & app_rd_data_valid ? P_ST_IDLE     : P_ST_READ_WAIT    ;default         : r_st_next = P_ST_INIT;endcase
endalways@(posedge i_ui_clk,posedge i_ui_rst) 
beginif(i_ui_rst)r_init <= 'd0;elser_init <= {r_init[6 :0],init_calib_complete};
endalways@(posedge i_ui_clk,posedge i_ui_rst) 
beginif(i_ui_rst)r_st_cnt <= 'd0;else if(r_st_current != r_st_next)r_st_cnt <= 'd0;else r_st_cnt <= r_st_cnt  + 1;
endalways@(posedge i_ui_clk,posedge i_ui_rst) 
beginif(i_ui_rst) beginri_operation_cmd  <= 'd0;ri_operation_len  <= 'd0;ri_operation_addr <= 'd0;end else if(w_op_act) beginri_operation_cmd  <= i_operation_cmd ;ri_operation_len  <= i_operation_len ;ri_operation_addr <= i_operation_addr;end else beginri_operation_cmd  <= ri_operation_cmd ;ri_operation_len  <= ri_operation_len ;ri_operation_addr <= ri_operation_addr;endendalways@(posedge i_ui_clk,posedge i_ui_rst) 
beginif(i_ui_rst)r_op_act <= 'd0;else r_op_act <= w_op_act;
endalways@(posedge i_ui_clk,posedge i_ui_rst) 
beginif(i_ui_rst) beginro_app_cmd <= 'd0;ro_app_en  <= 'd0;end else if(r_st_current == P_ST_WRITE) beginro_app_cmd <= 'd0;ro_app_en  <= 'd1;end else if(r_st_current == P_ST_READ) beginro_app_cmd <= 'd1;ro_app_en  <= 'd1;end else beginro_app_cmd <= 'd0;ro_app_en  <= 'd0;endendalways@(posedge i_ui_clk,posedge i_ui_rst) 
beginif(i_ui_rst)ro_app_addr <= 'd0;else if(w_op_act)ro_app_addr <= i_operation_addr;else if(w_mig_wvalid)ro_app_addr <= ro_app_addr + 8 ;else if(w_mig_rvalid)ro_app_addr <= ro_app_addr + 8 ;else ro_app_addr <= ro_app_addr;
endalways@(posedge i_ui_clk,posedge i_ui_rst) 
beginif(i_ui_rst)ro_app_wdf_mask <= 'd0;else ro_app_wdf_mask <= 'd0;
endalways@(posedge i_ui_clk,posedge i_ui_rst) 
beginif(i_ui_rst)ro_app_wdf_wren <= 'd0;else if(r_st_current == P_ST_WRITE)ro_app_wdf_wren <= 'd1;else ro_app_wdf_wren <= 'd0;
endalways@(posedge i_ui_clk,posedge i_ui_rst) 
beginif(i_ui_rst) beginro_read_data  <= 'd0;ro_read_valid <= 'd0;end else  beginro_read_data  <= app_rd_data;ro_read_valid <= app_rd_data_valid;end 
endalways@(posedge i_ui_clk,posedge i_ui_rst) 
beginif(i_ui_rst)ro_operation_ready <= 'd0;else if(w_op_act)ro_operation_ready <= 'd0;else if(r_st_next == P_ST_IDLE)ro_operation_ready <= 'd1;else ro_operation_ready <= ro_operation_ready;
endalways@(posedge i_ui_clk,posedge i_ui_rst) 
beginif(i_ui_rst)r_write_cnt <= 'd0;else if(r_st_current == P_ST_IDLE)r_write_cnt <= 'd0;else if(w_mig_wvalid)r_write_cnt <= r_write_cnt + 1;else r_write_cnt <= r_write_cnt;
endalways@(posedge i_ui_clk,posedge i_ui_rst) 
beginif(i_ui_rst)r_read_cnt <= 'd0;else if(r_st_current == P_ST_IDLE)r_read_cnt <= 'd0;else if(w_mig_rvalid)r_read_cnt <= r_read_cnt + 1;else r_read_cnt <= r_read_cnt;
endalways@(posedge i_ui_clk,posedge i_ui_rst)
beginif(i_ui_rst)r_read_data_cnt <= 'd0;else if(r_st_current == P_ST_IDLE)r_read_data_cnt <= 'd0;else if(app_rd_data_valid) r_read_data_cnt <= r_read_data_cnt + 1;else r_read_data_cnt <= r_read_data_cnt;
endendmodule

示列

DDR3_MIG u_DDR3_MIG (// Memory interface ports.ddr3_addr                      (ddr3_addr                  ),.ddr3_ba                        (ddr3_ba                    ),.ddr3_cas_n                     (ddr3_cas_n                 ),.ddr3_ck_n                      (ddr3_ck_n                  ),.ddr3_ck_p                      (ddr3_ck_p                  ),.ddr3_cke                       (ddr3_cke                   ),.ddr3_ras_n                     (ddr3_ras_n                 ),.ddr3_reset_n                   (ddr3_reset_n               ),.ddr3_we_n                      (ddr3_we_n                  ),.ddr3_dq                        (ddr3_dq                    ),.ddr3_dqs_n                     (ddr3_dqs_n                 ),.ddr3_dqs_p                     (ddr3_dqs_p                 ),.ddr3_cs_n                      (ddr3_cs_n                  ),.ddr3_dm                        (ddr3_dm                    ),.ddr3_odt                       (ddr3_odt                   ),// Application interface ports.init_calib_complete            (w_init_calib_complete      ),.app_addr                       (w_app_addr                 ),.app_cmd                        (w_app_cmd                  ),.app_en                         (w_app_en                   ),.app_wdf_data                   (w_app_wdf_data             ),.app_wdf_end                    (w_app_wdf_end              ),.app_wdf_wren                   (w_app_wdf_wren             ),.app_rd_data                    (w_app_rd_data              ),.app_rd_data_end                (w_app_rd_data_end          ),.app_rd_data_valid              (w_app_rd_data_valid        ),.app_rdy                        (w_app_rdy                  ),.app_wdf_rdy                    (w_app_wdf_rdy              ),.app_wdf_mask                   (w_app_wdf_mask             ),.app_sr_req                     (0                          ),.app_ref_req                    (0                          ),.app_zq_req                     (0                          ),.app_sr_active                  (                           ),.app_ref_ack                    (                           ),.app_zq_ack                     (                           ),.ui_clk                         (ui_clk                     ),.ui_clk_sync_rst                (ui_clk_sync_rst            ),// System Clock Ports.sys_clk_p                      (i_clk_200m_p               ),.sys_clk_n                      (i_clk_200m_n               ),.sys_rst                        (0                          ) 
);MIG_APP_Drive MIG_APP_Drive_u0(.i_ui_clk                       (ui_clk                     ),.i_ui_rst                       (ui_clk_sync_rst            ),.init_calib_complete            (w_init_calib_complete      ),.app_addr                       (w_app_addr                 ),    .app_cmd                        (w_app_cmd                  ),                        .app_en                         (w_app_en                   ),                    .app_wdf_data                   (w_app_wdf_data             ),                    .app_wdf_end                    (w_app_wdf_end              ),                    .app_wdf_wren                   (w_app_wdf_wren             ),                .app_rd_data                    (w_app_rd_data              ),                    .app_rd_data_end                (w_app_rd_data_end          ),                        .app_rd_data_valid              (w_app_rd_data_valid        ),                    .app_rdy                        (w_app_rdy                  ),                    .app_wdf_rdy                    (w_app_wdf_rdy              ),                .app_wdf_mask                   (w_app_wdf_mask             ),    .i_operation_cmd                (w_app_operation_cmd        ),.i_operation_len                (w_app_operation_len        ),.i_operation_addr               (w_app_operation_addr       ),.i_operation_valid              (w_app_operation_valid      ),.o_operation_ready              (w_app_operation_ready      ),           .i_write_data                   (w_app_write_data           ),.i_write_last                   (w_app_write_last           ),.i_write_valid                  (w_app_write_valid          ),.o_read_data                    (w_app_read_data            ),.o_read_valid                   (w_app_read_valid           )             
);

基于AXI接口的DDR3

module AXI_Master_Drive(input                   i_clk                   ,input                   i_rst                   ,(* mark_debug = "true" *)    input                   i_init_calib_complete   ,output [3 :0]           m_axi_awid              ,output [29:0]			m_axi_awaddr            ,output [7 :0]			m_axi_awlen             ,output [2 :0]			m_axi_awsize            ,           output [1 :0]			m_axi_awburst           ,           output [0 :0]			m_axi_awlock            ,              output [3 :0]			m_axi_awcache           ,          output [2 :0]			m_axi_awprot            ,                  output [3 :0]			m_axi_awqos             ,         output 		            m_axi_awvalid           ,                 
(* mark_debug = "true" *)    input 			        m_axi_awready           ,   output [255:0]			m_axi_wdata             ,                 output [31:0]			m_axi_wstrb             ,             output			        m_axi_wlast             ,       output			        m_axi_wvalid            ,   
(* mark_debug = "true" *)    input			        m_axi_wready            ,  input [3 :0]			m_axi_bid               ,       input [1 :0]			m_axi_bresp             ,   
(* mark_debug = "true" *)    input			        m_axi_bvalid            ,       output			        m_axi_bready            ,  output  [3 :0]			m_axi_arid              ,       output  [29:0]			m_axi_araddr            ,   output  [7 :0]			m_axi_arlen             ,output  [2 :0]			m_axi_arsize            ,   output  [1 :0]			m_axi_arburst           ,       output  [0 :0]			m_axi_arlock            ,       output  [3 :0]			m_axi_arcache           ,       output  [2 :0]			m_axi_arprot            ,       output  [3 :0]			m_axi_arqos             ,   output			        m_axi_arvalid           ,   
(* mark_debug = "true" *)    input			        m_axi_arready           ,  input [3 :0]			m_axi_rid               ,       input [255:0]			m_axi_rdata             ,       input [1 :0]			m_axi_rresp             ,       input			        m_axi_rlast             ,       input			        m_axi_rvalid            ,       output			        m_axi_rready                       
);/***************function**************//***************parameter*************/
localparam                  P_ST_INIT   =   0   ,P_ST_IDLE   =   1   ,P_ST_WRITE  =   2   ,P_ST_READ   =   3   ;localparam                  P_LEN       =   16  ;/***************port******************/             /***************mechine***************/
(* mark_debug = "true" *)reg  [7 :0]                 r_st_current        ;
reg  [7 :0]                 r_st_next           ;
reg  [15:0]                 r_st_cnt            ;/***************reg*******************/
reg  [3 :0]                 ro_m_axi_awid       ;
(* mark_debug = "true" *)reg  [29:0]			        ro_m_axi_awaddr     ;
(* mark_debug = "true" *)reg  [7 :0]			        ro_m_axi_awlen      ;
reg  [2 :0]			        ro_m_axi_awsize     ;
reg  [1 :0]			        ro_m_axi_awburst    ;
reg  [0 :0]			        ro_m_axi_awlock     ;
reg  [3 :0]			        ro_m_axi_awcache    ;
reg  [2 :0]			        ro_m_axi_awprot     ;
reg  [3 :0]			        ro_m_axi_awqos      ;
(* mark_debug = "true" *)reg  		                ro_m_axi_awvalid    ;
(* mark_debug = "true" *)reg  [255:0]			    ro_m_axi_wdata      ;
reg  [31:0]			        ro_m_axi_wstrb      ;
(* mark_debug = "true" *)reg  			            ro_m_axi_wlast      ;
(* mark_debug = "true" *)reg  			            ro_m_axi_wvalid     ;
(* mark_debug = "true" *)reg                         ro_m_axi_bready     ;
reg  [3 :0]			        ro_m_axi_arid       ;
(* mark_debug = "true" *)reg  [29:0]			        ro_m_axi_araddr     ;
(* mark_debug = "true" *)reg  [7 :0]			        ro_m_axi_arlen      ;
reg  [2 :0]			        ro_m_axi_arsize     ;
reg  [1 :0]			        ro_m_axi_arburst    ;
reg  [0 :0]			        ro_m_axi_arlock     ;
reg  [3 :0]			        ro_m_axi_arcache    ;
reg  [2 :0]			        ro_m_axi_arprot     ;
reg  [3 :0]			        ro_m_axi_arqos      ;
(* mark_debug = "true" *)reg  		                ro_m_axi_arvalid    ;
(* mark_debug = "true" *)reg                         ro_m_axi_rready     ;
reg  [3 :0]			        ri_m_axi_rid        ;
(* mark_debug = "true" *)reg  [255:0]			    ri_m_axi_rdata      ;
reg  [1 :0]			        ri_m_axi_rresp      ;
(* mark_debug = "true" *)reg  			            ri_m_axi_rlast      ;
(* mark_debug = "true" *)reg  			            ri_m_axi_rvalid     ;
reg  [15:0]     r_read_cnt;/***************wire******************/
wire                        w_aw_act            ;
wire                        w_w_act             ;
wire                        w_br_act            ;
wire                        w_ar_act            ;
wire                        w_r_act             ;/***************component*************//***************assign****************/
assign m_axi_awid    = ro_m_axi_awid                    ;
assign m_axi_awaddr  = ro_m_axi_awaddr                  ;
assign m_axi_awlen   = ro_m_axi_awlen                   ;
assign m_axi_awsize  = ro_m_axi_awsize                  ;
assign m_axi_awburst = ro_m_axi_awburst                 ;
assign m_axi_awlock  = ro_m_axi_awlock                  ;
assign m_axi_awcache = ro_m_axi_awcache                 ;
assign m_axi_awprot  = ro_m_axi_awprot                  ;
assign m_axi_awqos   = ro_m_axi_awqos                   ;
assign m_axi_awvalid = ro_m_axi_awvalid                 ;
assign m_axi_wdata   = ro_m_axi_wdata                   ;
assign m_axi_wstrb   = ro_m_axi_wstrb                   ;
assign m_axi_wlast   = ro_m_axi_wlast                   ;
assign m_axi_wvalid  = ro_m_axi_wvalid                  ;
assign m_axi_bready  = ro_m_axi_bready                  ;
assign m_axi_arid    = ro_m_axi_arid                    ;
assign m_axi_araddr  = ro_m_axi_araddr                  ;
assign m_axi_arlen   = ro_m_axi_arlen                   ;
assign m_axi_arsize  = ro_m_axi_arsize                  ;
assign m_axi_arburst = ro_m_axi_arburst                 ;
assign m_axi_arlock  = ro_m_axi_arlock                  ;
assign m_axi_arcache = ro_m_axi_arcache                 ;
assign m_axi_arprot  = ro_m_axi_arprot                  ;
assign m_axi_arqos   = ro_m_axi_arqos                   ;
assign m_axi_arvalid = ro_m_axi_arvalid                 ;
assign m_axi_rready  = ro_m_axi_rready                  ;
assign w_aw_act      = m_axi_awvalid & m_axi_awready    ;//写地址激活信号
assign w_w_act       = m_axi_wvalid  & m_axi_wready     ;//写数据激活信号
assign w_br_act      = m_axi_bvalid  & m_axi_bready     ;//响应激活信号
assign w_ar_act      = m_axi_arvalid & m_axi_arready    ;//读地址激活信号
assign w_r_act       = m_axi_rvalid  & m_axi_rready     ;//读数据信号/***************always****************/
//第一段状态机
always@(posedge i_clk,posedge i_rst)
beginif(i_rst)r_st_current <= P_ST_IDLE;elser_st_current <= r_st_next;    
end//第二段
always@(*)
begincase(r_st_current)P_ST_INIT   : r_st_next <= i_init_calib_complete ? P_ST_IDLE : P_ST_INIT;P_ST_IDLE   : r_st_next <= P_ST_WRITE;P_ST_WRITE  : r_st_next <= w_br_act     ? P_ST_READ : P_ST_WRITE;P_ST_READ   : r_st_next <= r_read_cnt == P_LEN - 1 && w_r_act  ? P_ST_IDLE : P_ST_READ;default     : r_st_next <= P_ST_IDLE;endcase
endalways@(posedge i_clk,posedge i_rst)
beginif(i_rst)r_st_cnt <= 'd0;else if(r_st_current != r_st_next)r_st_cnt <= 'd0;else r_st_cnt <= r_st_cnt + 1;
endalways@(posedge i_clk,posedge i_rst)
beginif(i_rst) beginro_m_axi_awid    <= 'd0;ro_m_axi_awaddr  <= 'd0;ro_m_axi_awlen   <= 'd0;ro_m_axi_awsize  <= 'd0;ro_m_axi_awburst <= 'd0;ro_m_axi_awlock  <= 'd0;ro_m_axi_awcache <= 'd0;ro_m_axi_awprot  <= 'd0;ro_m_axi_awqos   <= 'd0;ro_m_axi_awvalid <= 'd0;end else if(w_aw_act) beginro_m_axi_awid    <= 'd0;ro_m_axi_awaddr  <= 'd0;ro_m_axi_awlen   <= 'd0;ro_m_axi_awsize  <= 'd0;ro_m_axi_awburst <= 'd0;ro_m_axi_awlock  <= 'd0;ro_m_axi_awcache <= 'd0;ro_m_axi_awprot  <= 'd0;ro_m_axi_awqos   <= 'd0;ro_m_axi_awvalid <= 'd0;end else if(r_st_current == P_ST_WRITE && r_st_cnt == 0) beginro_m_axi_awid    <= 'd0;ro_m_axi_awaddr  <= 'd0;ro_m_axi_awlen   <= P_LEN - 1;ro_m_axi_awsize  <= 3'b101;//32bytero_m_axi_awburst <= 'd1;//突发模式ro_m_axi_awlock  <= 'd0;ro_m_axi_awcache <= 4'b0010;//无缓存ro_m_axi_awprot  <= 'd0;ro_m_axi_awqos   <= 'd0;ro_m_axi_awvalid <= 'd1;//有效拉高end else beginro_m_axi_awid    <= ro_m_axi_awid   ;ro_m_axi_awaddr  <= ro_m_axi_awaddr ;ro_m_axi_awlen   <= ro_m_axi_awlen  ;ro_m_axi_awsize  <= ro_m_axi_awsize ;ro_m_axi_awburst <= ro_m_axi_awburst;ro_m_axi_awlock  <= ro_m_axi_awlock ;ro_m_axi_awcache <= ro_m_axi_awcache;ro_m_axi_awprot  <= ro_m_axi_awprot ;ro_m_axi_awqos   <= ro_m_axi_awqos  ;ro_m_axi_awvalid <= ro_m_axi_awvalid;end 
endalways@(posedge i_clk,posedge i_rst)
beginif(i_rst)ro_m_axi_wdata <= 'd0;else if(ro_m_axi_wdata == P_LEN - 1 && w_w_act)ro_m_axi_wdata <= 'd0;else if(w_w_act)ro_m_axi_wdata <= ro_m_axi_wdata + 1;else ro_m_axi_wdata <= ro_m_axi_wdata;
endalways@(posedge i_clk,posedge i_rst)
beginif(i_rst)ro_m_axi_wvalid <= 'd0;else if(ro_m_axi_wdata == P_LEN - 1 && w_w_act)ro_m_axi_wvalid <= 'd0;else if(w_aw_act)       ro_m_axi_wvalid <= 'd1;else ro_m_axi_wvalid <= ro_m_axi_wvalid;
endalways@(posedge i_clk,posedge i_rst)
beginif(i_rst)ro_m_axi_wlast <= 'd0;else if(ro_m_axi_wdata == P_LEN - 1 && w_w_act)ro_m_axi_wlast <= 'd0;else if(ro_m_axi_wdata == P_LEN - 2)   ro_m_axi_wlast <= 'd1;else ro_m_axi_wlast <= ro_m_axi_wlast;
endalways@(posedge i_clk,posedge i_rst)
beginif(i_rst)ro_m_axi_wstrb <= 32'hffffffff;else ro_m_axi_wstrb <= 32'hffffffff;
endalways@(posedge i_clk,posedge i_rst)
beginif(i_rst)ro_m_axi_bready <= 'd0;else if(w_br_act)ro_m_axi_bready <= 'd0;else if(ro_m_axi_wlast)ro_m_axi_bready <= 'd1;else ro_m_axi_bready <= ro_m_axi_bready;
endalways@(posedge i_clk,posedge i_rst)
beginif(i_rst) beginro_m_axi_arid    <= 'd0;ro_m_axi_araddr  <= 'd0;ro_m_axi_arlen   <= 'd0;ro_m_axi_arsize  <= 'd0;ro_m_axi_arburst <= 'd0;ro_m_axi_arlock  <= 'd0;ro_m_axi_arcache <= 'd0;ro_m_axi_arprot  <= 'd0;ro_m_axi_arqos   <= 'd0;ro_m_axi_arvalid <= 'd0;end else if(w_ar_act) beginro_m_axi_arid    <= 'd0;ro_m_axi_araddr  <= 'd0;ro_m_axi_arlen   <= 'd0;ro_m_axi_arsize  <= 'd0;ro_m_axi_arburst <= 'd0;ro_m_axi_arlock  <= 'd0;ro_m_axi_arcache <= 'd0;ro_m_axi_arprot  <= 'd0;ro_m_axi_arqos   <= 'd0;ro_m_axi_arvalid <= 'd0;end else if(r_st_current == P_ST_READ && r_st_cnt == 0) beginro_m_axi_arid    <= 'd0;ro_m_axi_araddr  <= 'd0;ro_m_axi_arlen   <= P_LEN - 1;ro_m_axi_arsize  <= 3'b101;ro_m_axi_arburst <= 'd1;ro_m_axi_arlock  <= 'd0;ro_m_axi_arcache <= 4'b0010;ro_m_axi_arprot  <= 'd0;ro_m_axi_arqos   <= 'd0;ro_m_axi_arvalid <= 'd1;end else beginro_m_axi_arid    <= ro_m_axi_arid   ;ro_m_axi_araddr  <= ro_m_axi_araddr ;ro_m_axi_arlen   <= ro_m_axi_arlen  ;ro_m_axi_arsize  <= ro_m_axi_arsize ;ro_m_axi_arburst <= ro_m_axi_arburst;ro_m_axi_arlock  <= ro_m_axi_arlock ;ro_m_axi_arcache <= ro_m_axi_arcache;ro_m_axi_arprot  <= ro_m_axi_arprot ;ro_m_axi_arqos   <= ro_m_axi_arqos  ;ro_m_axi_arvalid <= ro_m_axi_arvalid;end 
endalways@(posedge i_clk,posedge i_rst)
beginif(i_rst)ro_m_axi_rready <= 'd0;else if(r_read_cnt == P_LEN - 1 && w_r_act)ro_m_axi_rready <= 'd0;else if(w_ar_act)ro_m_axi_rready <= 'd1;else ro_m_axi_rready <= ro_m_axi_rready;
endalways@(posedge i_clk,posedge i_rst)
beginif(i_rst) beginri_m_axi_rid    <= 'd0;ri_m_axi_rdata  <= 'd0;ri_m_axi_rresp  <= 'd0;ri_m_axi_rlast  <= 'd0;ri_m_axi_rvalid <= 'd0;end else beginri_m_axi_rid    <= m_axi_rid   ;ri_m_axi_rdata  <= m_axi_rdata ;ri_m_axi_rresp  <= m_axi_rresp ;ri_m_axi_rlast  <= m_axi_rlast ;ri_m_axi_rvalid <= m_axi_rvalid;end
endalways@(posedge i_clk,posedge i_rst)
beginif(i_rst)r_read_cnt <= 'd0;else if(r_read_cnt == P_LEN - 1 && w_r_act)r_read_cnt <= 'd0;else if(w_r_act)r_read_cnt <= r_read_cnt + 1;else r_read_cnt <= r_read_cnt;
end
endmodule

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/283770.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

数字孪生底层技术框架

数字孪生是一种将现实世界中的物理实体、过程或系统数字化并映射到计算机模型中的方法。它在数学建模与仿真方面具有重要作用&#xff0c;为了实现数字孪生&#xff0c;以下是一些底层技术框架和方法&#xff0c;希望对大家有所帮助。北京木奇移动技术有限公司&#xff0c;专业…

[OpenCV学习笔记]获取鼠标处图像的坐标和像素值

目录 1、介绍2、效果展示3、代码实现4、源码展示 1、介绍 实现获取鼠标点击处的图像的坐标和像素值&#xff0c;灰度图显示其灰度值&#xff0c;RGB图显示rgb的值。 OpenCV获取灰度值及彩色像素值的方法&#xff1a; //灰度图像&#xff1a; image.at<uchar>(j, i) //j…

牛客NC111 最大数【中等 贪心、排序 Java,Go,PHP】

题目 题目链接&#xff1a; https://www.nowcoder.com/practice/fc897457408f4bbe9d3f87588f497729 思路 贪心解法对于 numsnums 中的任意两个值 aa 和 bb&#xff0c;我们无法直接从常规角度上确定其大小/先后关系。但我们可以根据「结果」来决定 aa 和 bb 的排序关系&#…

链表oj测试题(上)

链表的申明&#xff1a; struct ListNode {int val;struct ListNode* next; }; 1.题1 删除指定元素 例如&#xff1a;链表1 2 6 3 4 5 6&#xff0c;然后选择删除元素6&#xff0c;返回的链表为1 2 3 4 5 。 代码演示&#xff1a; typedef struct ListNode ListNode;List…

【C++航海王:追寻罗杰的编程之路】stack

目录 1 -> stack的介绍和使用 1.1 -> stack的介绍 1.2 -> stack的使用 1.3 -> stack的模拟实现 1 -> stack的介绍和使用 1.1 -> stack的介绍 stack的文档介绍 1. stack是一种容器适配器&#xff0c;专门用在具有后进先出操作的上下文环境中&#xff0c…

yolov6实现遥感影像目标识别|以DIOR数据集为例

1 目标检测是计算机视觉领域中的一项重要任务&#xff0c;它的目标是在图像或视频中检测出物体的位置和类别。YOLO&#xff08;You Only Look Once&#xff09;是一系列经典的目标检测算法&#xff0c;最初由Joseph Redmon等人于2016年提出。YOLO算法具有快速、简单、端到端的特…

Java集合Collection之LinkedList

LinkeList LinkedList&#xff08;双向链表&#xff09;是一种常见的线性数据结构&#xff0c;但是并不会按线性的顺序存储数据。它由一系列节点组成&#xff0c;每个节点包含数据部分和一个指向下一个节点的引用。相比于数组&#xff0c;链表具有动态大小、插入和删除效率高的…

【计算机视觉】Gaussian Splatting源码解读补充(二)

第一部分 本文是对学习笔记之——3D Gaussian Splatting源码解读的补充&#xff0c;并订正了一些错误。 目录 三、相机相关scene/cameras.py&#xff1a;class Camera 四、前向传播&#xff08;渲染&#xff09;&#xff1a;submodules/diff-gaussian-rasterization/cuda_rast…

ES进程除了kill之外,有什么优雅关闭的方式吗?

问题 Linux环境中&#xff0c;Elasticsearch 8的进程除了kill之外&#xff0c;有什么优雅关闭的方式吗&#xff1f; 具体实施方式 在Linux环境中&#xff0c;Elasticsearch&#xff08;ES&#xff09;进程可以通过多种方式实现优雅关闭&#xff0c;这种方式允许它完成必要的…

【Python音视频技术】玩AI视频创作引发写Python音视频技术系列文章1---视频添加字幕

最近对视频创作感兴趣&#xff0c; 详情见之前写的几篇文章。 【AI应用】模仿爆款视频二次创作短视频操作步骤 【人工智能】AI数字人视频演示 【人工智能】AI视频二次创作演示 作为程序员出身的我&#xff0c;看到一些功能, 我都有猎奇的习惯&#xff0c; 想着自己用什么技…

【技术栈】Spring Cache 简化 Redis 缓存使用

​ SueWakeup 个人主页&#xff1a;SueWakeup 系列专栏&#xff1a;学习技术栈 个性签名&#xff1a;保留赤子之心也许是种幸运吧 ​ 本文封面由 凯楠&#x1f4f8; 友情提供 目录 本栏传送门 1. Spring Cache 介绍 2. Spring Cache 常用注解 注&#xff1a;手机端浏览本文章…

Spark与flink计算引擎工作原理

Spark是大批量分布式计算引擎框架&#xff0c;scale语言开发的&#xff0c;核心技术是弹性分布式数据集&#xff08;RDD&#xff09;可以快速在内存中对数据集进行多次迭代&#xff0c;支持复杂的数据挖掘算法及图形计算算法&#xff0c;spark与Hadoop区别主要是spark多个作业之…

基于python+vue的stone音乐播放器的设计与实现flask-django-php-nodejs

随着我国经济的高速发展与人们生活水平的日益提高&#xff0c;人们对生活质量的追求也多种多样。尤其在人们生活节奏不断加快的当下&#xff0c;人们更趋向于足不出户解决生活上的问题&#xff0c;stone音乐播放器展现了其蓬勃生命力和广阔的前景。与此同时&#xff0c;为解决用…

Yocto学习笔记1-下载与首次编译

Yocto学习笔记1-下载与首次编译 1、基础环境介绍2、注意点3、安装依赖3.1 yocto常规系统构建所需依赖库&#xff08;较全&#xff09;3.2 龙芯适配时的最小依赖库&#xff08;最小&#xff09; 4、下载4.1 通过git克隆4.2 查看所有远程分支4.3 签出一个长期支持的稳定版本4.4 查…

工业相机采图方式、图像格式(BYTE、HObject和Mat)转换

1、概述 机器视觉项目中&#xff0c;如何采集到合适的图像是项目的第一步&#xff0c;也是最重要的一步&#xff0c;直接关系到后面图像处理算法及最终执行的结果。所以采用不同的工业相机成像以及如何转换成图像处理库所需要的格式成为项目开发中首先要考虑的问题。 2、工业…

微服务day05(中) -- ES索引库操作

索引库就类似数据库表&#xff0c;mapping映射就类似表的结构。 我们要向es中存储数据&#xff0c;必须先创建“库”和“表”。 2.1.mapping映射属性 mapping是对索引库中文档的约束&#xff0c;常见的mapping属性包括&#xff1a; type&#xff1a;字段数据类型&#xff0c;…

数据分析-Pandas序列滑动窗口配置参数

数据分析-Pandas序列滑动窗口配置参数 数据分析和处理中&#xff0c;难免会遇到各种数据&#xff0c;那么数据呈现怎样的规律呢&#xff1f;不管金融数据&#xff0c;风控数据&#xff0c;营销数据等等&#xff0c;莫不如此。如何通过图示展示数据的规律&#xff1f; 数据表&…

【DataWhale】灵境Agent开发——低代码创建AI智能体

灵境Agent开发——低代码创建AI智能体 3 灵境 Agent 低代码开发 ​ 低代码模式支持开发者通过编排工作流的方式快速构建智能体&#xff0c;您可以通过拖拽和组合模型、提示词、代码等模块&#xff0c;实现准确的、复杂的业务流程。 ​ 个人体验下来&#xff0c;目前这个低代…

【Entity Framework】 EF中DbContext类详解

【Entity Framework】 EF中DbContext类详解 一、概述 DbContext类是实体框架的重要组成部分。它是应用域或实例类与数据库交互的桥梁。 从上图可以看出DbContext是负责与数据交互作为对象的主要类。DbContext负责以下活动&#xff1a; EntitySet&#xff1a;DbContext包含…

【linux】CentOS查看系统信息

一、查看版本号 在CentOS中&#xff0c;可以通过多种方法来查看版本号。以下是几种常用的方法&#xff1a; 使用cat命令查看/etc/centos-release文件&#xff1a; CentOS的版本信息存储在/etc/centos-release文件中。可以使用cat命令来显示该文件的内容&#xff0c;从而获得C…