前面已經把DDR用app接口的方式控制住了,結果這個工程確要用microblaze。所以還要接到axi上。於是又來了一段苦逼的路程。
要用axi控制ddr,先得把接口給弄清楚了,各個接口干嘛的。把mig上的axi接口全部復制出來。再一個個的查
1 // ************************************************************************************** 2 // ***************************** MIG Interface ************************************ 3 // ************************************************************************************** 4 // output ui_clk, 5 // output ui_clk_sync_rst, 6 // output mmcm_locked, 7 // input aresetn, 8 // input app_sr_req, // assign 0 9 // input app_ref_req, // assign 0 10 // input app_zq_req, // assign 0 11 // output app_sr_active, 12 // output app_ref_ack, 13 // output app_zq_ack, 14 // Slave Interface Write Address Ports 15 input [3:0] s_axi_awid, //寫地址信號組的標記 16 input [29:0] s_axi_awaddr, // **************** 寫地址 17 input [7:0] s_axi_awlen, //猝發長度 18 input [2:0] s_axi_awsize, //猝發大小 19 input [1:0] s_axi_awburst,//猝發類型 20 input [0:0] s_axi_awlock,//鎖類型 00 21 input [3:0] s_axi_awcache,//緩存類型 00 22 input [2:0] s_axi_awprot,//保護類型 00 23 input [3:0] s_axi_awqos, //優先級標志 0 24 input s_axi_awvalid,// *****************寫地址有效 25 output s_axi_awready,// *****************寫地址准備完成信號,可接收對方寫地址操作 26 // Slave Interface Write Data Ports 27 input [511:0] s_axi_wdata, // ****************** 寫數據 28 input [63:0] s_axi_wstrb,//WSTRB 寫選通,對於數據總線的每8bit有一個寫選通。1: active 29 input s_axi_wlast, // ****************** 猝發中寫最后一個數據 30 input s_axi_wvalid, // ***************** 寫數據有效信號 31 output s_axi_wready, // ***************** 寫數據准備完成信號,可接收對方寫數據操作 32 // Slave Interface Write Response Ports 33 input s_axi_bready, //表示可接收響應信號 34 output [3:0] s_axi_bid, // 響應ID 35 output [1:0] s_axi_bresp, // ******************* 寫回應信號,2‘b00表示寫成功 36 output s_axi_bvalid, // 表示所要求的寫響應是可用的 37 // Slave Interface Read Address Ports 38 input [3:0] s_axi_arid, // 讀地址ID 39 input [29:0] s_axi_araddr, // ********************* 讀地址 40 input [7:0] s_axi_arlen, //猝發長度 41 input [2:0] s_axi_arsize, // 猝發大小 42 input [1:0] s_axi_arburst, //猝發類型 00:固定猝發,01:遞增猝發 10:回卷猝發 43 input [0:0] s_axi_arlock, //鎖類型 44 input [3:0] s_axi_arcache, //鎖類型 45 input [2:0] s_axi_arprot, //保護類型 46 input [3:0] s_axi_arqos, // 優先級標志 47 input s_axi_arvalid, // ****************** 讀地址有效 48 output s_axi_arready, // **************** 讀地址准備信號 49 // Slave Interface Read Data Ports 50 input s_axi_rready, 51 output [3:0] s_axi_rid, 52 output [511:0] s_axi_rdata, 53 output [1:0] s_axi_rresp, // ********************* 讀回應信號,2’b00 表示讀成功 54 output s_axi_rlast, 55 output s_axi_rvalid, 56 // output init_calib_complete, 57 // output [11:0] device_temp, 58 59 // input sys_rst 60 61 62 /* 63 burst, //猝發類型 00:固定猝發,01:遞增猝發 10:回卷猝發 64 回卷猝發必須滿足 1,開始地址必須對齊傳輸大小。2猝發長度必須是2.4.8.16 。大於16拍的猝發傳輸只支持INCR遞增類型 65 在example中 66 lock = 2'b0; 67 cache = 4'b0; 68 prot = 3'b0; 69 burst = 1 // lenth >16 采用遞增型 70 size = 6 // data with/8=64 71 72 | arsize/awsize | bytes in transfer 73 |____________________|__________________ 74 | 000 | 1 75 | 001 | 2 76 | 010 | 4 77 | 011 | 8 78 | 100 | 16 79 | 101 | 32 80 | 110 | 64 81 | 111 | 128 82 |--------------------|------------------- 83 */
用 // ************ 注釋的信號 表示很清楚這個信號的作用
只有 // 注釋的信號 表示用法有些模糊。不過這些信號在example中都給出了基本用法。
最后是實現了寫操作。log中顯示確實按照我的要求寫進去了,地址數據都正確。可是效率真的太差了
還有一點就是如果你的len是7,那么你就要給它傳7+1=8個數,axi總線才會給響應。 開始我的程序就是這樣的len設定為8,傳了8個數等響應,死等等不來。
代碼中寫8個數據。從0地址開始存。寫8個數據中間需要休息這么久? 還是我控制的有問題啊。
考慮還要不要用axi了
歡迎加入: FPGA廣東交流群:162664354
FPGA開發者聯盟: 485678884