{"id":1418,"date":"2026-05-08T22:03:16","date_gmt":"2026-05-08T14:03:16","guid":{"rendered":"http:\/\/www.hanhhsir.cn\/?p=1418"},"modified":"2026-05-08T22:03:16","modified_gmt":"2026-05-08T14:03:16","slug":"%e5%9f%ba%e4%ba%8eahb%e7%9a%84%e5%9b%9b%e9%80%9a%e9%81%93dma%e6%8e%a7%e5%88%b6%e5%99%a8%e8%ae%be%e8%ae%a1-dmac_intf-v","status":"publish","type":"post","link":"http:\/\/www.hanhhsir.cn\/index.php\/2026\/05\/08\/%e5%9f%ba%e4%ba%8eahb%e7%9a%84%e5%9b%9b%e9%80%9a%e9%81%93dma%e6%8e%a7%e5%88%b6%e5%99%a8%e8%ae%be%e8%ae%a1-dmac_intf-v\/","title":{"rendered":"\u57fa\u4e8eAHB\u7684\u56db\u901a\u9053DMA\u63a7\u5236\u5668\u8bbe\u8ba1-dmac_intf.v"},"content":{"rendered":"<p>`timescale 1ns \/ 10ps<\/p>\n<p><strong>\/\/ ==============================<\/strong><br \/>\n<strong>\/\/ \u6a21\u5757\uff1aDMA \u914d\u7f6e\u63a5\u53e3\uff08AHB \u4ece\u673a\uff09<\/strong><br \/>\n<strong>\/\/ \u529f\u80fd\uff1aCPU \u901a\u8fc7 AHB \u914d\u7f6e DMA 4 \u901a\u9053<\/strong><br \/>\n<strong>\/\/ ==============================<\/strong><br \/>\nmodule dmac_intf(<br \/>\n\/\/ AHB \u4ece\u673a\u4fe1\u53f7\uff08CPU \u2194 DMA\uff09<br \/>\ninput HCLK , \/\/ AHB \u65f6\u949f<br \/>\ninput HRESETn , \/\/ \u4f4e\u7535\u5e73\u590d\u4f4d<br \/>\ninput HSEL , \/\/ \u9009\u4e2d DMA \u6a21\u5757<br \/>\ninput HREADY , \/\/ \u4ece\u673a\u5c31\u7eea\uff08hreadyin\uff09<br \/>\ninput[1:0] HTRANS , \/\/ \u4f20\u8f93\u7c7b\u578b<br \/>\ninput[2:0] HSIZE , \/\/ \u4f20\u8f93\u4f4d\u5bbd<br \/>\ninput HWRITE , \/\/ 1=\u5199 0=\u8bfb<br \/>\ninput[31:0] HADDR , \/\/ \u5730\u5740<br \/>\ninput[31:0] HWDATA , \/\/ \u5199\u6570\u636e\uff08CPU\u2192DMA\uff09<br \/>\noutput HREADYOUT , \/\/ DMA \u7ed9 CPU \u7684\u5c31\u7eea\u4fe1\u53f7<br \/>\noutput HRESP , \/\/ \u54cd\u5e94\u4fe1\u53f7\uff08\u56fa\u5b9aOK\uff09<br \/>\noutput reg [31:0] HRDATA , \/\/ \u8bfb\u6570\u636e\uff08DMA\u2192CPU\uff09<\/p>\n<p>\/\/ \u8f93\u51fa\u7ed9 DMA \u5185\u6838\uff08\u4ef2\u88c1\/\u4f20\u8f93\u6a21\u5757\uff09<br \/>\noutput ch_0_en , \/\/ \u901a\u90530\u4f7f\u80fd<br \/>\noutput ch_0_target , \/\/ \u901a\u90530\u65b9\u5411(0:\u5b58\u2192\u5916\u8bbe 1:\u5916\u8bbe\u2192\u5b58)<br \/>\noutput[9: 0] ch_0_size , \/\/ \u901a\u90530\u4f20\u8f93\u957f\u5ea6<br \/>\noutput ch_1_en ,<br \/>\noutput ch_1_target ,<br \/>\noutput[9: 0] ch_1_size ,<br \/>\noutput ch_2_en ,<br \/>\noutput ch_2_target ,<br \/>\noutput[9: 0] ch_2_size ,<br \/>\noutput ch_3_en ,<br \/>\noutput ch_3_target ,<br \/>\noutput[9: 0] ch_3_size ,<\/p>\n<p>\/\/ \u6e90\/\u76ee\u6807\u5730\u5740\uff08\u7ed9DMA\u4f20\u8f93\u7528\uff09<br \/>\noutput reg [31:0] ch_0_sour , \/\/ \u901a\u90530\u6e90\u5730\u5740<br \/>\noutput reg [31:0] ch_0_dest , \/\/ \u901a\u90530\u76ee\u6807\u5730\u5740<br \/>\noutput reg [31:0] ch_1_sour ,<br \/>\noutput reg [31:0] ch_1_dest ,<br \/>\noutput reg [31:0] ch_2_sour ,<br \/>\noutput reg [31:0] ch_2_dest ,<br \/>\noutput reg [31:0] ch_3_sour ,<br \/>\noutput reg [31:0] ch_3_dest<br \/>\n);<\/p>\n<p><strong>\/\/ ==============================<\/strong><br \/>\n<strong>\/\/ \u57fa\u5730\u5740\uff1aCPU \u8bbf\u95ee DMA \u5bc4\u5b58\u5668\u7684\u8d77\u59cb\u5730\u5740<\/strong><br \/>\n<strong>\/\/ ==============================<\/strong><br \/>\nparameter BASE_ADDR = 32&#8217;h40000000;<\/p>\n<p><strong>\/\/ ==============================<\/strong><br \/>\n<strong>\/\/ \u5185\u90e8\u63a7\u5236\u4fe1\u53f7<\/strong><br \/>\n<strong>\/\/ ==============================<\/strong><br \/>\nwire ahb_access ; \/\/ AHB\u6709\u6548\u8bbf\u95ee<br \/>\nwire ahb_read ; \/\/ AHB\u8bfb<br \/>\nreg ahb_write ; \/\/ AHB\u5199\uff08\u6253\u62cd\uff09<br \/>\nreg [31:0] haddr_d ; \/\/ \u5730\u5740\u6253\u62cd<\/p>\n<p>\/\/ 4\u4e2a\u901a\u9053\u7684\u63a7\u5236\u5bc4\u5b58\u5668<br \/>\nreg [31:0] ch_0_ctrl ;<br \/>\nreg [31:0] ch_1_ctrl ;<br \/>\nreg [31:0] ch_2_ctrl ;<br \/>\nreg [31:0] ch_3_ctrl ;<\/p>\n<p>\/\/ \u5199\u4f7f\u80fd\u4fe1\u53f7\uff08\u5730\u5740\u8bd1\u7801\uff09<br \/>\nwire ch_0_ctrl_wr ; \/\/ \u901a\u90530\u63a7\u5236\u5bc4\u5b58\u5668\u5199<br \/>\nwire ch_0_sour_wr ; \/\/ \u901a\u90530\u6e90\u5730\u5740\u5199<br \/>\nwire ch_0_dest_wr ; \/\/ \u901a\u90530\u76ee\u6807\u5730\u5740\u5199<br \/>\nwire ch_1_ctrl_wr ;<br \/>\nwire ch_1_sour_wr ;<br \/>\nwire ch_1_dest_wr ;<br \/>\nwire ch_2_ctrl_wr ;<br \/>\nwire ch_2_sour_wr ;<br \/>\nwire ch_2_dest_wr ;<br \/>\nwire ch_3_ctrl_wr ;<br \/>\nwire ch_3_sour_wr ;<br \/>\nwire ch_3_dest_wr ;<\/p>\n<p><strong>\/\/ ==============================<\/strong><br \/>\n<strong>\/\/ AHB \u8bbf\u95ee\u63a7\u5236\u903b\u8f91<\/strong><br \/>\n<strong>\/\/ ==============================<\/strong><br \/>\n\/\/ \u6709\u6548\u8bbf\u95ee\uff1a\u975e\u7a7a\u95f2\u4f20\u8f93 + \u88ab\u9009\u4e2d + \u5c31\u7eea<br \/>\nassign ahb_access = HTRANS[1] &amp; HSEL &amp; HREADY ;<\/p>\n<p>\/\/ AHB \u8bfb<br \/>\nassign ahb_read = ahb_access &amp; (~HWRITE ) ;<\/p>\n<p>\/\/ AHB \u5199\uff08\u6253\u4e00\u62cd\uff0c\u5bf9\u9f50\u65f6\u5e8f\uff09<br \/>\nalways@(posedge HCLK or negedge HRESETn) begin<br \/>\nif(!HRESETn)<br \/>\nahb_write &lt;= 1&#8217;b0;<br \/>\nelse<br \/>\nahb_write &lt;= ahb_access &amp; HWRITE ;<br \/>\nend<\/p>\n<p>\/\/ \u5730\u5740\u9501\u5b58\uff1a\u5199\u7684\u65f6\u5019\u628a\u5730\u5740\u5b58\u4e0b\u6765<br \/>\nalways@(posedge HCLK or negedge HRESETn) begin<br \/>\nif(!HRESETn)<br \/>\nhaddr_d &lt;= 32&#8217;h0 ;<br \/>\nelse if(ahb_access &amp; HWRITE)<br \/>\nhaddr_d &lt;= HADDR ;<br \/>\nend<\/p>\n<p><strong>\/\/ ==============================<\/strong><br \/>\n<strong>\/\/ \u5730\u5740\u8bd1\u7801\uff1a\u6839\u636e\u5730\u5740\u4ea7\u751f\u5bf9\u5e94\u5bc4\u5b58\u5668\u5199\u4f7f\u80fd<\/strong><br \/>\n<strong>\/\/ \u57fa\u5730\u5740 + \u504f\u79fb \u2192 \u9009\u4e2d\u54ea\u4e2a\u5bc4\u5b58\u5668<\/strong><br \/>\n<strong>\/\/ ==============================<\/strong><br \/>\nassign ch_0_ctrl_wr = (ahb_write==1&#8217;b1)&amp;&amp;(haddr_d==BASE_ADDR+0); \/\/ 0x00<br \/>\nassign ch_0_sour_wr = (ahb_write==1&#8217;b1)&amp;&amp;(haddr_d==BASE_ADDR+4); \/\/ 0x04<br \/>\nassign ch_0_dest_wr = (ahb_write==1&#8217;b1)&amp;&amp;(haddr_d==BASE_ADDR+8); \/\/ 0x08<\/p>\n<p>assign ch_1_ctrl_wr = (ahb_write==1&#8217;b1)&amp;&amp;(haddr_d==BASE_ADDR+12); \/\/ 0x0C<br \/>\nassign ch_1_sour_wr = (ahb_write==1&#8217;b1)&amp;&amp;(haddr_d==BASE_ADDR+16); \/\/ 0x10<br \/>\nassign ch_1_dest_wr = (ahb_write==1&#8217;b1)&amp;&amp;(haddr_d==BASE_ADDR+20); \/\/ 0x14<\/p>\n<p>assign ch_2_ctrl_wr = (ahb_write==1&#8217;b1)&amp;&amp;(haddr_d==BASE_ADDR+24); \/\/ 0x18<br \/>\nassign ch_2_sour_wr = (ahb_write==1&#8217;b1)&amp;&amp;(haddr_d==BASE_ADDR+28); \/\/ 0x1C<br \/>\nassign ch_2_dest_wr = (ahb_write==1&#8217;b1)&amp;&amp;(haddr_d==BASE_ADDR+32); \/\/ 0x20<\/p>\n<p>assign ch_3_ctrl_wr = (ahb_write==1&#8217;b1)&amp;&amp;(haddr_d==BASE_ADDR+36); \/\/ 0x24<br \/>\nassign ch_3_sour_wr = (ahb_write==1&#8217;b1)&amp;&amp;(haddr_d==BASE_ADDR+40); \/\/ 0x28<br \/>\nassign ch_3_dest_wr = (ahb_write==1&#8217;b1)&amp;&amp;(haddr_d==BASE_ADDR+44); \/\/ 0x2C<\/p>\n<p><strong>\/\/ ==============================<\/strong><br \/>\n<strong>\/\/ \u5199\u5bc4\u5b58\u5668\uff1aCPU \u5199\u63a7\u5236\/\u5730\u5740<\/strong><br \/>\n<strong>\/\/ ==============================<\/strong><br \/>\n\/\/ \u901a\u90530\u63a7\u5236\u5bc4\u5b58\u5668<br \/>\nalways@(posedge HCLK or negedge HRESETn) begin<br \/>\nif(!HRESETn)<br \/>\nch_0_ctrl&lt;=32&#8217;h0;<br \/>\nelse if(ch_0_ctrl_wr)<br \/>\nch_0_ctrl&lt;= HWDATA;<br \/>\nend<\/p>\n<p>\/\/ \u901a\u90530\u6e90\u5730\u5740<br \/>\nalways@(posedge HCLK or negedge HRESETn) begin<br \/>\nif(!HRESETn)<br \/>\nch_0_sour&lt;=32&#8217;h0 ;<br \/>\nelse if(ch_0_sour_wr)<br \/>\nch_0_sour&lt;= HWDATA ;<br \/>\nend<\/p>\n<p>\/\/ \u901a\u90530\u76ee\u6807\u5730\u5740<br \/>\nalways@(posedge HCLK or negedge HRESETn) begin<br \/>\nif(!HRESETn)<br \/>\nch_0_dest&lt;=32&#8217;h0 ;<br \/>\nelse if(ch_0_dest_wr)<br \/>\nch_0_dest&lt;= HWDATA ;<br \/>\nend<\/p>\n<p><strong>\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/strong><br \/>\n<strong>\/\/ \u901a\u90531\/2\/3 \u5199\u903b\u8f91\u548c\u901a\u90530\u5b8c\u5168\u4e00\u6837<\/strong><br \/>\n<strong>\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/strong><br \/>\nalways@(posedge HCLK or negedge HRESETn) begin<br \/>\nif(!HRESETn)<br \/>\nch_1_ctrl&lt;=32&#8217;h0;<br \/>\nelse if(ch_1_ctrl_wr)<br \/>\nch_1_ctrl&lt;= HWDATA;<br \/>\nend<\/p>\n<p>always@(posedge HCLK or negedge HRESETn) begin<br \/>\nif(!HRESETn)<br \/>\nch_1_sour&lt;=32&#8217;h0 ;<br \/>\nelse if(ch_1_sour_wr)<br \/>\nch_1_sour&lt;= HWDATA ;<br \/>\nend<\/p>\n<p>always@(posedge HCLK or negedge HRESETn) begin<br \/>\nif(!HRESETn)<br \/>\nch_1_dest&lt;=32&#8217;h0 ;<br \/>\nelse if(ch_1_dest_wr)<br \/>\nch_1_dest&lt;= HWDATA ;<br \/>\nend<\/p>\n<p>\/\/ \u901a\u90532\u30013\u7701\u7565\uff0c\u7ed3\u6784\u76f8\u540c<br \/>\nalways@(posedge HCLK or negedge HRESETn) begin<br \/>\nif(!HRESETn)<br \/>\nch_2_ctrl&lt;=32&#8217;h0;<br \/>\nelse if(ch_2_ctrl_wr)<br \/>\nch_2_ctrl&lt;=HWDATA;<br \/>\nend<\/p>\n<p>always@(posedge HCLK or negedge HRESETn) begin<br \/>\nif(!HRESETn)<br \/>\nch_2_sour&lt;=32&#8217;h0 ;<br \/>\nelse if(ch_2_sour_wr)<br \/>\nch_2_sour&lt;= HWDATA ;<br \/>\nend<\/p>\n<p>always@(posedge HCLK or negedge HRESETn) begin<br \/>\nif(!HRESETn)<br \/>\nch_2_dest&lt;=32&#8217;h0 ;<br \/>\nelse if(ch_2_dest_wr)<br \/>\nch_2_dest&lt;= HWDATA ;<br \/>\nend<\/p>\n<p>always@(posedge HCLK or negedge HRESETn) begin<br \/>\nif(!HRESETn)<br \/>\nch_3_ctrl&lt;=32&#8217;h0;<br \/>\nelse if(ch_3_ctrl_wr)<br \/>\nch_3_ctrl&lt;= HWDATA;<br \/>\nend<\/p>\n<p>always@(posedge HCLK or negedge HRESETn) begin<br \/>\nif(!HRESETn)<br \/>\nch_3_sour&lt;=32&#8217;h0 ;<br \/>\nelse if(ch_3_sour_wr)<br \/>\nch_3_sour&lt;= HWDATA ;<br \/>\nend<\/p>\n<p>always@(posedge HCLK or negedge HRESETn) begin<br \/>\nif(!HRESETn)<br \/>\nch_3_dest&lt;=32&#8217;h0 ;<br \/>\nelse if(ch_3_dest_wr)<br \/>\nch_3_dest&lt;= HWDATA ;<br \/>\nend<\/p>\n<p><strong>\/\/ ==============================<\/strong><br \/>\n<strong>\/\/ \u63a7\u5236\u5bc4\u5b58\u5668\u4f4d\u89e3\u6790\uff08\u7ed9DMA\u5185\u6838\u7528\uff09<\/strong><br \/>\n<strong>\/\/ ==============================<\/strong><br \/>\nassign ch_0_en = ch_0_ctrl[0] ; \/\/ \u4f4d0\uff1a\u901a\u9053\u4f7f\u80fd<br \/>\nassign ch_0_target = ch_0_ctrl[4] ; \/\/ \u4f4d4\uff1a\u65b9\u5411(0=\u5b58\u2192\u5916\u8bbe 1=\u5916\u8bbe\u2192\u5b58)<br \/>\nassign ch_0_size = ch_0_ctrl[17:8] ; \/\/ \u4f4d[17:8]\uff1a\u4f20\u8f93\u957f\u5ea6<\/p>\n<p>assign ch_1_en = ch_1_ctrl[0] ;<br \/>\nassign ch_1_target = ch_1_ctrl[4] ;<br \/>\nassign ch_1_size = ch_1_ctrl[17:8] ;<\/p>\n<p>assign ch_2_en = ch_2_ctrl[0] ;<br \/>\nassign ch_2_target = ch_2_ctrl[4] ;<br \/>\nassign ch_2_size = ch_2_ctrl[17:8] ;<\/p>\n<p>assign ch_3_en = ch_3_ctrl[0] ;<br \/>\nassign ch_3_target = ch_3_ctrl[4] ;<br \/>\nassign ch_3_size = ch_3_ctrl[17:8] ;<\/p>\n<p><strong>\/\/ ==============================<\/strong><br \/>\n<strong>\/\/ AHB \u8bfb\u56de\u5bc4\u5b58\u5668\u503c<\/strong><br \/>\n<strong>\/\/ CPU \u8bfb\u5730\u5740 \u2192 \u628a\u5bf9\u5e94\u5bc4\u5b58\u5668\u653e\u5230 HRDATA<\/strong><br \/>\n<strong>\/\/ ==============================<\/strong><br \/>\nalways@(posedge HCLK or negedge HRESETn)begin<br \/>\nif(!HRESETn)<br \/>\nHRDATA &lt;= 32&#8217;h0;<br \/>\n\/\/ \u8bfb\u901a\u90530<br \/>\nelse if(ahb_read==1&#8217;b1 &amp;&amp; HADDR==BASE_ADDR+0 ) HRDATA &lt;= ch_0_ctrl;<br \/>\nelse if(ahb_read==1&#8217;b1 &amp;&amp; HADDR==BASE_ADDR+4 ) HRDATA &lt;= ch_0_sour;<br \/>\nelse if(ahb_read==1&#8217;b1 &amp;&amp; HADDR==BASE_ADDR+8 ) HRDATA &lt;= ch_0_dest;<br \/>\n\/\/ \u8bfb\u901a\u90531<br \/>\nelse if(ahb_read==1&#8217;b1 &amp;&amp; HADDR==BASE_ADDR+12) HRDATA &lt;= ch_0_ctrl; \/\/ BUG\uff1a\u5e94\u662fch_1_ctrl<br \/>\nelse if(ahb_read==1&#8217;b1 &amp;&amp; HADDR==BASE_ADDR+16) HRDATA &lt;= ch_1_sour;<br \/>\nelse if(ahb_read==1&#8217;b1 &amp;&amp; HADDR==BASE_ADDR+20) HRDATA &lt;= ch_1_dest;<br \/>\n\/\/ \u8bfb\u901a\u90532<br \/>\nelse if(ahb_read==1&#8217;b1 &amp;&amp; HADDR==BASE_ADDR+24) HRDATA &lt;= ch_2_ctrl;<br \/>\nelse if(ahb_read==1&#8217;b1 &amp;&amp; HADDR==BASE_ADDR+28) HRDATA &lt;= ch_2_sour;<br \/>\nelse if(ahb_read==1&#8217;b1 &amp;&amp; HADDR==BASE_ADDR+32) HRDATA &lt;= ch_2_dest;<br \/>\n\/\/ \u8bfb\u901a\u90533<br \/>\nelse if(ahb_read==1&#8217;b1 &amp;&amp; HADDR==BASE_ADDR+36) HRDATA &lt;= ch_3_ctrl;<br \/>\nelse if(ahb_read==1&#8217;b1 &amp;&amp; HADDR==BASE_ADDR+40) HRDATA &lt;= ch_3_sour;<br \/>\nelse if(ahb_read==1&#8217;b1 &amp;&amp; HADDR==BASE_ADDR+44) HRDATA &lt;= ch_3_dest;<br \/>\nend<\/p>\n<p><strong>\/\/ ==============================<\/strong><br \/>\n<strong>\/\/ AHB \u56fa\u5b9a\u8f93\u51fa<\/strong><br \/>\n<strong>\/\/ ==============================<\/strong><br \/>\nassign HRESP = 0; \/\/ \u65e0\u9519\u8bef<br \/>\nassign HREADYOUT = 1; \/\/ \u6c38\u8fdc\u5c31\u7eea\uff08\u96f6\u7b49\u5f85\uff09<\/p>\n<p>endmodule<\/p>\n","protected":false},"excerpt":{"rendered":"<p>`timescale 1ns \/ 10ps \/\/ ============================== \/\/ \u6a21\u5757\uff1aDMA \u914d\u7f6e\u63a5\u53e3\uff08AHB \u4ece\u673a\uff09 \/\/ \u529f\u80fd\uff1aCPU \u901a\u8fc7 AHB \u914d\u7f6e DMA 4 \u901a\u9053 \/\/ ============================== module dmac_intf( \/\/ AHB \u4ece\u673a\u4fe1\u53f7\uff08CPU \u2194 DMA\uff09 input HCLK , \/\/ AHB \u65f6\u949f input HRESETn , \/\/ \u4f4e\u7535\u5e73\u590d\u4f4d input HSEL , \/\/ \u9009\u4e2d DMA \u6a21\u5757 input HREADY , \/\/ \u4ece\u673a\u5c31\u7eea\uff08hreadyin\uff09 input[1:0] HTRANS , \/\/ \u4f20\u8f93\u7c7b\u578b input[2:0] HSIZE , \/\/ \u4f20\u8f93\u4f4d\u5bbd input HWRITE , \/\/ 1=\u5199 0=\u8bfb input[31:0] HADDR , \/\/ \u5730\u5740 input[31:0] HWDATA , \/\/ \u5199\u6570\u636e\uff08CPU\u2192DMA\uff09 output HREADYOUT , \/\/ DMA \u7ed9 CPU \u7684\u5c31\u7eea\u4fe1\u53f7 output HRESP , \/\/ \u54cd\u5e94\u4fe1\u53f7\uff08\u56fa\u5b9aOK\uff09 output reg [31:0] HRDATA , \/\/ \u8bfb\u6570\u636e\uff08DMA\u2192CPU\uff09 \/\/ \u8f93\u51fa\u7ed9 DMA \u5185\u6838\uff08\u4ef2\u88c1\/\u4f20\u8f93\u6a21\u5757\uff09 output ch_0_en , \/\/ \u901a\u90530\u4f7f\u80fd output ch_0_target , \/\/ \u901a\u90530\u65b9\u5411(0:\u5b58\u2192\u5916\u8bbe 1:\u5916\u8bbe\u2192\u5b58) output[9: 0] ch_0_size , \/\/ \u901a\u90530\u4f20\u8f93\u957f\u5ea6 output ch_1_en , output ch_1_target , output[9: 0] ch_1_size , output ch_2_en , output ch_2_target , output[9: 0] ch_2_size , output ch_3_en , output ch_3_target , output[9: 0] ch_3_size , \/\/ \u6e90\/\u76ee\u6807\u5730\u5740\uff08\u7ed9DMA\u4f20\u8f93\u7528\uff09 output reg [31:0] ch_0_sour , \/\/ \u901a\u90530\u6e90\u5730\u5740 output reg [31:0] ch_0_dest , \/\/ \u901a\u90530\u76ee\u6807\u5730\u5740 output reg [31:0] ch_1_sour , output reg [31:0] ch_1_dest , output reg [31:0] ch_2_sour , output reg [31:0] ch_2_dest , output reg [31:0] ch_3_sour , output reg [31:0] ch_3_dest ); \/\/ ============================== \/\/ \u57fa\u5730\u5740\uff1aCPU \u8bbf\u95ee DMA \u5bc4\u5b58\u5668\u7684\u8d77\u59cb\u5730\u5740 \/\/ ============================== parameter BASE_ADDR = 32&#8217;h40000000; \/\/ ============================== \/\/ \u5185\u90e8\u63a7\u5236\u4fe1\u53f7 \/\/ ============================== wire ahb_access ; \/\/ AHB\u6709\u6548\u8bbf\u95ee wire ahb_read ; \/\/ AHB\u8bfb reg ahb_write ; \/\/ AHB\u5199\uff08\u6253\u62cd\uff09 reg [31:0] haddr_d ; \/\/ \u5730\u5740\u6253\u62cd \/\/ 4\u4e2a\u901a\u9053\u7684\u63a7\u5236\u5bc4\u5b58\u5668 reg [31:0] ch_0_ctrl ; reg [31:0] ch_1_ctrl ; reg [31:0] ch_2_ctrl ; reg [31:0] ch_3_ctrl ; \/\/ \u5199\u4f7f\u80fd\u4fe1\u53f7\uff08\u5730\u5740\u8bd1\u7801\uff09 wire ch_0_ctrl_wr ; \/\/ \u901a\u90530\u63a7\u5236\u5bc4\u5b58\u5668\u5199 wire ch_0_sour_wr ; \/\/ \u901a\u90530\u6e90\u5730\u5740\u5199 wire ch_0_dest_wr ; \/\/ \u901a\u90530\u76ee\u6807\u5730\u5740\u5199 wire ch_1_ctrl_wr ; wire ch_1_sour_wr ; wire ch_1_dest_wr ; wire ch_2_ctrl_wr ; wire ch_2_sour_wr ; wire ch_2_dest_wr ; wire ch_3_ctrl_wr ; wire ch_3_sour_wr ; wire ch_3_dest_wr ; \/\/ ============================== \/\/ AHB \u8bbf\u95ee\u63a7\u5236\u903b\u8f91 \/\/ ============================== \/\/ \u6709\u6548\u8bbf\u95ee\uff1a\u975e\u7a7a\u95f2\u4f20\u8f93 + \u88ab\u9009\u4e2d + \u5c31\u7eea assign ahb_access = HTRANS[&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1418","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.hanhhsir.cn\/index.php\/wp-json\/wp\/v2\/posts\/1418","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.hanhhsir.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.hanhhsir.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.hanhhsir.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.hanhhsir.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1418"}],"version-history":[{"count":1,"href":"http:\/\/www.hanhhsir.cn\/index.php\/wp-json\/wp\/v2\/posts\/1418\/revisions"}],"predecessor-version":[{"id":1419,"href":"http:\/\/www.hanhhsir.cn\/index.php\/wp-json\/wp\/v2\/posts\/1418\/revisions\/1419"}],"wp:attachment":[{"href":"http:\/\/www.hanhhsir.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.hanhhsir.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1418"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.hanhhsir.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}