生活随笔
收集整理的這篇文章主要介紹了
基于FPGA的flash分区实现多功能转换(icap核)
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
轉(zhuǎn)至:https://blog.csdn.net/Headogerz/article/details/82251621
1.前文提到通過硬件代碼描述可以將程序固化到flas中,但是只能實(shí)現(xiàn)單一功能,無法實(shí)現(xiàn)多功能切換。本文通過調(diào)用ise的ip核,固化代碼實(shí)現(xiàn)流水燈與呼吸燈的切換。
2.這次的聯(lián)系,主要是為了下次的在線升級(jí)的多種功能綜合做鋪墊。如果只是為了實(shí)現(xiàn)這種轉(zhuǎn)換,利用狀態(tài)機(jī)也可以實(shí)現(xiàn),icap可以將flash實(shí)現(xiàn)功能分離。實(shí)現(xiàn)多個(gè)功能不在需要下載器下載。
3.練習(xí)代碼如下:
?
module icap_ctrl(input wire sclk,input wire rst_n,input wire key_in
);reg [3:0] cnt;
reg ce;
reg [15:0] tmp_i;
wire [15:0] i_data;always@(posedge sclk or negedge rst_n) //cnt14if(!rst_n)cnt<=4'd0;else if(cnt==14)cnt<=4'd0;else if (ce==0)cnt<=cnt+1'b1;always@(posedge sclk or negedge rst_n) //ceif(!rst_n)ce<=1'b1;else if(cnt==14)ce<=1'b1;else if (key_in==1)ce<=1'b0;always@(posedge sclk or negedge rst_n)if(!rst_n)tmp_i<=16'hffff;else case(cnt)0: tmp_i<=16'hffff;1: tmp_i<=16'haa99;2: tmp_i<=16'h5566;3: tmp_i<=16'h3261;4: tmp_i<=16'h0000; //5: tmp_i<=16'h3281;6: tmp_i<=16'h0300; //7: tmp_i<=16'h32a1;8: tmp_i<=16'h0000; //9: tmp_i<=16'h32c1;10: tmp_i<=16'h030b; //11: tmp_i<=16'h30a1;12: tmp_i<=16'h000e;13: tmp_i<=16'h2000;14: tmp_i<=16'hffff;default: tmp_i<=16'hffff;endcase
assign i_data={tmp_i[8],tmp_i[9],tmp_i[10],tmp_i[11],tmp_i[12],tmp_i[13],tmp_i[14],tmp_i[15],tmp_i[0],tmp_i[1],tmp_i[2],tmp_i[3],tmp_i[4],tmp_i[5],tmp_i[6],tmp_i[7]};ICAP_SPARTAN6 #(.DEVICE_ID(28'h4000093), // Specifies the pre-programmed Device ID value.SIM_CFG_FILE_NAME("NONE") // Specifies the Raw Bitstream (RBT) file to be parsed by the simulation// model
)
ICAP_SPARTAN6_inst (.BUSY(), // 1-bit output: Busy/Ready output.O(), // 16-bit output: Configuartion data output bus.CE(ce), // 1-bit input: Active-Low ICAP Enable input.CLK(sclk), // 1-bit input: Clock input.I(i_data), // 16-bit input: Configuration data input bus.WRITE(1'b0) // 1-bit input: Read/Write control input
);endmodule
?
總結(jié)
以上是生活随笔為你收集整理的基于FPGA的flash分区实现多功能转换(icap核)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。