![soc實驗報告復習過程_第1頁](http://file4.renrendoc.com/view/8921f9e105368287461a30eb4081ae20/8921f9e105368287461a30eb4081ae201.gif)
![soc實驗報告復習過程_第2頁](http://file4.renrendoc.com/view/8921f9e105368287461a30eb4081ae20/8921f9e105368287461a30eb4081ae202.gif)
![soc實驗報告復習過程_第3頁](http://file4.renrendoc.com/view/8921f9e105368287461a30eb4081ae20/8921f9e105368287461a30eb4081ae203.gif)
![soc實驗報告復習過程_第4頁](http://file4.renrendoc.com/view/8921f9e105368287461a30eb4081ae20/8921f9e105368287461a30eb4081ae204.gif)
![soc實驗報告復習過程_第5頁](http://file4.renrendoc.com/view/8921f9e105368287461a30eb4081ae20/8921f9e105368287461a30eb4081ae205.gif)
版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
1、Good is good, but better carries it.精益求精,善益求善。soc實驗報告-SOC微體系結構設計班級:031013姓名:張權、張昭陽學號:03101251、03101239實驗一8位串行全加器設計實驗目的1掌握ISE開發(fā)工具的使用,掌握FPGA開發(fā)的基本步驟;2掌握8位串行全加器電路設計的一般辦法;3掌握程序下載的辦法;4初步了解開發(fā)板資源,掌握開發(fā)板的使用方法,重點掌握按鍵,開關,LCD,LED的使用方法。二實驗內(nèi)容1用VHDL實現(xiàn)8位串行全加器圖8位串行全加器頂層模塊中a_in,b_in:數(shù)據(jù)輸入,使用板上開關(S0S15);sum_out:運算結果輸出,使
2、用LED顯示運算結果。2將程序下載到FPGA并進行檢驗資源使用要求,用開關(S0S15)輸入加數(shù),被加數(shù)用LED(D8D15)顯示運算結果。三實驗步驟1啟動ISE,新建工程文件;2編寫8位串行全加器模塊Hadder,其原理圖如上圖所示。3編寫完加法器模塊之后,在頂層文件上實現(xiàn)映射;4新建UCF文件,輸入位置約束;5完成綜合,實現(xiàn),生成下載文件;6連接開發(fā)板USB下載線,開啟開發(fā)板電源;7下載FPGA;8輸入數(shù)據(jù),驗證結果。四關鍵代碼entityadd_oneis-一位加Port(a_in:inSTD_LOGIC;b_in:inSTD_LOGIC;cin:inSTD_LOGIC;si:outST
3、D_LOGIC;cout:outSTD_LOGIC);endadd_one;architectureBehavioralofadd_oneisbeginsi=(a_inxorb_in)xorcin;cout=(a_inandb_in)or(cinanda_in)or(cinandb_in);endBehavioral;entityadd_eightis-八位加Port(a:inSTD_LOGIC_VECTOR(7downto0);b:inSTD_LOGIC_VECTOR(7downto0);sum:outSTD_LOGIC_VECTOR(7downto0);c_out:outSTD_LOGIC
4、);endadd_eight;architectureBehavioralofadd_eightiscomponentadd_oneport(a_in,b_in,cin:inSTD_LOGIC;si,cout:outSTD_LOGIC);endcomponent;signalc:STD_LOGIC_VECTOR(7downto0);signalc_in:STD_LOGIC:=0;beginu0:add_oneportmap(a(0),b(0),c_in,sum(0),c(0);u1:add_oneportmap(a(1),b(1),c(0),sum(1),c(1);u2:add_oneport
5、map(a(2),b(2),c(1),sum(2),c(2);u3:add_oneportmap(a(3),b(3),c(2),sum(3),c(3);u4:add_oneportmap(a(4),b(4),c(3),sum(4),c(4);u5:add_oneportmap(a(5),b(5),c(4),sum(5),c(5);u6:add_oneportmap(a(6),b(6),c(5),sum(6),c(6);u7:add_oneportmap(a(7),b(7),c(6),sum(7),c_out);endBehavioral;實驗二8位并行全加器設計實驗目的掌握ISE開發(fā)工具的使用
6、,掌握FPGA開發(fā)的基本步驟;2.掌握4位并行全加器電路設計的一般辦法;掌握程序下載的辦法;初步了解開發(fā)板資源,掌握開發(fā)板的使用方法,重點掌握按鍵,開關,LCD,LED的使用方法。實驗內(nèi)容1用VHDL實現(xiàn)4位并行全加器圖14位全加器頂層模塊其中,a_in,b_in:輸入4位加數(shù)和被加數(shù)。sel_in:數(shù)碼管片選端;c_in,c_out:進位輸入,進位輸出;sum_out:運算結果的輸出。2將程序下載到FPGA并進行檢驗資源使用,要求用開關(s0s7)輸入加數(shù),被加數(shù),(s8s11)控制用哪個數(shù)碼管顯示數(shù)據(jù),s12用于進位輸入。用D8顯示結果進位。實驗步驟1啟動ISE,新建工程文件;2編寫4位并
7、行全加器模塊ParAdder,其原理圖如上圖。要求:4位全加器采用并行進位算法。3編寫完加法器模塊之后,在頂層文件上實現(xiàn)映射;4新建UCF文件,輸入位置約束;5完成綜合,實現(xiàn),生成下載文件;6連接開發(fā)板USB下載線,開啟開發(fā)板電源;7下載FPGA;8輸入數(shù)據(jù),驗證結果。關鍵代碼entityaddisPort(a:inSTD_LOGIC_VECTOR(7downto0);b:inSTD_LOGIC_VECTOR(7downto0);cin:inSTD_LOGIC;s:outSTD_LOGIC_VECTOR(7downto0);cout:outSTD_LOGIC);endadd;architect
8、ureBehavioralofaddissignalc:STD_LOGIC_VECTOR(7downto0);signalp,g:STD_LOGIC_VECTOR(7downto0);beging(0)=a(0)andb(0);g(1)=a(1)andb(1);g(2)=a(2)andb(2);g(3)=a(3)andb(3);g(4)=a(4)andb(4);g(5)=a(5)andb(5);g(6)=a(6)andb(6);g(7)=a(7)andb(7);p(0)=a(0)xorb(0);p(1)=a(1)xorb(1);p(2)=a(2)xorb(2);p(3)=a(3)xorb(3)
9、;p(4)=a(4)xorb(4);p(5)=a(5)xorb(5);p(6)=a(6)xorb(6);p(7)=a(7)xorb(7);c(1)=g(0)or(p(0)andcin);c(2)=g(1)or(p(1)andg(0)or(p(1)andp(0)andcin);c(3)=g(2)or(p(2)andg(1)or(p(2)andp(2)andg(0)or(p(2)andp(1)andp(0)andcin);c(4)=g(3)or(p(3)andg(2)or(p(3)andp(2)andg(1)or(p(3)andp(2)andp(1)andg(0)or(p(3)andp(2)and
10、p(1)andp(0)andcin);c(5)=g(4)or(p(4)andg(3)or(p(4)andp(3)andg(2)or(p(4)andp(3)andp(2)andg(1)or(p(4)andp(3)andp(2)andp(1)andg(0)or(p(4)andp(3)andp(2)andp(1)andp(0)andcin);c(6)=g(5)or(p(5)andg(4)or(p(5)andp(4)andg(3)or(p(5)andp(4)andp(3)andg(2)or(p(5)andp(4)andp(3)andp(2)andg(1)or(p(5)andp(4)andp(3)and
11、p(2)andp(1)andg(0)or(p(5)andp(4)andp(3)andp(2)andp(1)andp(0)andcin);c(7)=g(6)or(p(6)andg(5)or(p(6)andp(5)andg(4)or(p(6)andp(5)andp(4)andg(3)or(p(6)andp(5)andp(4)andp(3)andg(2)or(p(6)andp(5)andp(4)andp(3)andp(2)andg(1)or(p(6)andp(5)andp(4)andp(3)andp(2)andp(1)andg(0)or(p(6)andp(5)andp(4)andp(3)andp(2
12、)andp(1)andp(0)andcin);cout=g(7)or(p(7)andg(6)or(p(7)andp(6)andg(4)or(p(7)andp(6)andp(5)andg(4)or(p(7)andp(6)andp(5)andp(4)andg(3)or(p(7)andp(6)andp(5)andp(4)andp(3)andg(2)or(p(7)andp(6)andp(5)andp(4)andp(3)andp(2)andg(1)or(p(7)andp(6)andp(5)andp(4)andp(3)andp(2)andp(1)andg(0)or(p(7)andp(6)andp(5)an
13、dp(4)andp(3)andp(2)andp(1)andp(0)andcin);s(0)=p(0)xorcin;s(1)=p(1)xorc(1);s(2)=p(2)xorc(2);s(3)=p(3)xorc(3);s(4)=p(4)xorc(4);s(5)=p(5)xorc(5);s(6)=p(6)xorc(6);s(7)seg_dataseg_dataseg_dataseg_dataseg_dataseg_dataseg_dataseg_dataseg_dataseg_dataseg_dataseg_dataseg_dataseg_dataseg_dataseg_dataseg_data=
14、X00;endcase;endprocess;endBehavioral;-數(shù)碼管顯示狀態(tài)機轉換architectureBehavioralofseg_disiscomponentdata2segPort(data_in:inSTD_LOGIC_VECTOR(3downto0);seg_data:outSTD_LOGIC_VECTOR(7downto0);endcomponent;CONSTANTREFRESH_PERIOD_CLOCKS:integer:=(clk_MHz*t_REF_uS);typestatesis(INIT0,INIT1,INIT2,INIT3,INIT4,INIT5,I
15、NIT6,INIT7,INIT8,INIT9,INIT10,INIT11,INIT12,INIT13,INIT14,INIT15);signalN_S,C_S:states;signalfre_flag:STD_LOGIC;signaldata_T:STD_LOGIC_VECTOR(3downto0);beginstate:process(clk,rst)beginif(rst=1)thenC_S=INIT0;elsifrising_edge(clk)thenC_Sseg_sel=X0;data_T=data_in_A(3downto0);if(fre_flag=1)thenN_S=INIT1
16、;elseN_Sseg_sel=X1;data_T=data_in_A(7downto4);if(fre_flag=1)thenN_S=INIT2;elseN_Sseg_sel=X2;data_T=data_in_A(11downto8);if(fre_flag=1)thenN_S=INIT3;elseN_Sseg_sel=X3;data_T=data_in_A(15downto12);if(fre_flag=1)thenN_S=INIT4;elseN_Sseg_sel=X4;data_T=data_in_B(3downto0);if(fre_flag=1)thenN_S=INIT5;else
17、N_Sseg_sel=X5;data_T=data_in_B(7downto4);if(fre_flag=1)thenN_S=INIT6;elseN_Sseg_sel=X6;data_T=data_in_B(11downto8);if(fre_flag=1)thenN_S=INIT7;elseN_Sseg_sel=X7;data_T=data_in_B(15downto12);if(fre_flag=1)thenN_S=INIT8;elseN_Sseg_sel=X8;data_T=data_in_C(3downto0);if(fre_flag=1)thenN_S=INIT9;elseN_Sse
18、g_sel=X9;data_T=data_in_C(7downto4);if(fre_flag=1)thenN_S=INIT10;elseN_Sseg_sel=XA;data_T=data_in_C(11downto8);if(fre_flag=1)thenN_S=INIT11;elseN_Sseg_sel=XB;data_T=data_in_C(15downto12);if(fre_flag=1)thenN_S=INIT12;elseN_Sseg_sel=XC;data_T=data_in_D(3downto0);if(fre_flag=1)thenN_S=INIT13;elseN_Sseg
19、_sel=XD;data_T=data_in_D(7downto4);if(fre_flag=1)thenN_S=INIT14;elseN_Sseg_sel=XE;data_T=data_in_D(11downto8);if(fre_flag=1)thenN_S=INIT15;elseN_Sseg_sel=XF;data_T=data_in_D(15downto12);if(fre_flag=1)thenN_S=INIT0;elseN_Sseg_sel=X0;data_T=X0;endcase;endprocess;-刷新fresh:process(clk,rst)variablecnt:in
20、teger;beginif(rst=1)thencnt:=0;fre_flag=0;elsifrising_edge(clk)thencnt:=cnt+1;if(cnt=REFRESH_PERIOD_CLOCKS)thencnt:=0;fre_flag=1;elsefre_flagdata_T,seg_data=seg_data);endBehavioral;-根據(jù)輸入顯示entityseg_dis_keyinisPort(clk:inSTD_LOGIC;rst:inSTD_LOGIC;key_in:inSTD_LOGIC_VECTOR(15downto0);seg_sel:outSTD_LO
21、GIC_VECTOR(3downto0);seg_data:outSTD_LOGIC_VECTOR(7downto0);endseg_dis_keyin;architectureBehavioralofseg_dis_keyiniscomponentseg_disgeneric(clk_MHz:integer:=50;t_REF_uS:integer:=1000-8Kthesamepurpose);Port(clk:inSTD_LOGIC;rst:inSTD_LOGIC;data_in_A:inSTD_LOGIC_VECTOR(15downto0);data_in_B:inSTD_LOGIC_
22、VECTOR(15downto0);data_in_C:inSTD_LOGIC_VECTOR(15downto0);data_in_D:inSTD_LOGIC_VECTOR(15downto0);seg_sel:outSTD_LOGIC_VECTOR(3downto0);seg_data:outSTD_LOGIC_VECTOR(7downto0);endcomponent;signaldata_dis_A:STD_LOGIC_VECTOR(15downto0):=X0000;signaldata_dis_B:STD_LOGIC_VECTOR(15downto0):=X0000;signalda
23、ta_dis_C:STD_LOGIC_VECTOR(15downto0):=X0000;signaldata_dis_D:STD_LOGIC_VECTOR(15downto0):=X0000;begindata_dis_A(3downto0)=key_in(3downto0)+0;data_dis_A(7downto4)=key_in(3downto0)+1;data_dis_A(11downto8)=key_in(3downto0)+2;data_dis_A(15downto12)=key_in(3downto0)+3;data_dis_B(3downto0)=key_in(7downto4
24、)+0;data_dis_B(7downto4)=key_in(7downto4)+1;data_dis_B(11downto8)=key_in(7downto4)+2;data_dis_B(15downto12)=key_in(7downto4)+3;data_dis_C(3downto0)=key_in(11downto8)+0;data_dis_C(7downto4)=key_in(11downto8)+1;data_dis_C(11downto8)=key_in(11downto8)+2;data_dis_C(15downto12)=key_in(11downto8)+3;data_d
25、is_D(3downto0)=key_in(15downto12)+0;data_dis_D(7downto4)=key_in(15downto12)+1;data_dis_D(11downto8)=key_in(15downto12)+2;data_dis_D(15downto12)clk,rst=rst,data_in_A=data_dis_A,data_in_B=data_dis_B,data_in_C=data_dis_C,data_in_D=data_dis_D,seg_sel=seg_sel,seg_data=seg_data);endBehavioral;實驗四原碼兩位乘實驗目的
26、1掌握ISE開發(fā)工具的使用,掌握FPGA開發(fā)的基本步驟;2理解原碼一位乘法器的設計思想,用VHDL實現(xiàn)原碼一位乘法的算法;3掌握程序下載的辦法;4掌握開發(fā)板的使用方法,重點掌握按鍵,開關,LCD,LED的使用方法。實驗內(nèi)容:1用VHDL實現(xiàn)原碼兩位乘法器根據(jù)原碼兩位乘的流程圖,利用VHDL描述原碼兩位乘法器的邏輯實現(xiàn)程序。輸入為二進制的原碼形式(8位,含1位符號位),輸出為乘積的原碼形式(16位,含1位符號位)。實現(xiàn)思路采用加法和移位的方法。由于兩個8位二進制原碼的乘積應為15位(1位符號位,14位數(shù)值位),為使乘積湊夠16位,將乘積的末位恒置為0。原碼兩位乘法器的頂層模塊如下圖所示。圖1原碼
27、兩位乘法器頂層模塊a_in,b_in是數(shù)據(jù)輸入端,reset信號有效時使能輸入數(shù)據(jù)。lcd_en_out,lcd_rs_out,lcd_rw_out,data_out是lcd的控制信號。clk_in是時鐘輸入信號2將程序下載到FPGA并進行檢驗,資源使用要求,用滑動開關(S0S15輸入乘數(shù),被乘數(shù)。用按鍵開關H13作為數(shù)據(jù)輸入使能端,用LCD屏顯示運算結果的輸出。實驗步驟1啟動ISE,新建工程文件;2編寫8位原碼兩位乘模塊,其原理圖下圖。圖原碼兩位乘模塊其中rst是乘法運算使能端。保證乘數(shù)和被乘數(shù)都輸入完成之后進行乘法的操作。cnt信號是用于仿真時,便于觀察乘法操作是否正確。3編寫LCD顯示模
28、塊lcd_disp。SKIPIF1num:=0000000000;c:=0;when001=num:=BB;c:=0;when010=num:=BB;c:=0;when011=num:=BB(8downto0)&0;c:=0;when100=num:=BB(8downto0)&0;c:=0;when101=num:=notBB+1;c:=1;when110=num:=notBB+1;c:=1;when111=num:=0000000000;c:=1;whenothers=null;endcase;result_tmp(17downto8):=result_tmp(17downto8)+num;
29、result_tmp:=result_tmp(17)&result_tmp(17)&result_tmp(17downto2);count:=count-1;endif;endif;endif;result(15)=a(7)xorb(7);result(14downto0)=result_tmp(14downto0);endprocess;實驗五補碼一位乘一實驗目的1掌握ISE開發(fā)工具的使用,掌握FPGA開發(fā)的基本步驟;2理解補碼一位乘法器的設計思想,用VHDL實現(xiàn)補碼一位乘法的算法;3掌握程序下載的辦法;4掌握開發(fā)板的使用方法,重點掌握按鍵,開關,LCD,LED的使用方法。二實驗內(nèi)容1用VH
30、DL實現(xiàn)補碼一位乘法器。根據(jù)補碼一位乘的流程圖,利用VHDL描述補碼乘法器的邏輯實現(xiàn)程序。輸入為二進制的補碼形式(8位,含1位符號位),輸出為乘積的補碼形式(16位,含1位符號位)??梢钥吹剑a碼乘法器中符號同數(shù)值位一樣參與運算,無需單獨處理。實現(xiàn)思路采用加法和移位的方法。由于兩個8位二進制補碼的乘積應為15位(1位符號位,14位數(shù)值位),為使乘積湊夠16位,將乘積的末位恒置為0。補碼一位乘法器的頂層模塊如下圖所示。圖補碼一位乘法器頂層模塊a_in,b_in是數(shù)據(jù)輸入端,sum_out是運算結果輸出端,clk_in是時鐘控制信號。2將程序下載到FPGA并進行檢驗資源使用要求用滑動開關(S0S8
31、)輸入乘數(shù),被乘數(shù)。用LED0LED15顯示運算結果。實驗步驟1啟動ISE,新建工程文件;2編寫8位補碼一位乘模塊,其原理圖如下圖。圖補碼一位乘模塊3編寫完加法器模塊之后,在頂層文件上實現(xiàn)映射;4新建UCF文件,輸入位置約束;5完成綜合,實現(xiàn),生成下載文件;6連接開發(fā)板USB下載線,開啟開發(fā)板電源;7下載FPGA;8輸入數(shù)據(jù),驗證結果。四關鍵代碼entitybsmpisporT(ai,bi:INStD_LOGIC_VECTOR(7downto0);op:OUTSTD_LOGIC_VECTOR(15downto0);endbsmp;architectureBehavioralofbsmpisbe
32、ginprocess(ai,bi)variablea,b,m:STD_LOGIC_VECTOR(7downto0);variablecp:STD_LOGIC_VECTOR(1downto0);variablet:STD_LOGIC;variablecounter:INTEGER;begincounter:=0;t:=0;a:=ai;b:=bi;m:=00000000;cp:=b(0)&0;whilecounterm:=m-a;when01=m:=m+a;whenothers=m:=m;endcase;t:=b(0);b:=m(0)&b(7downto1);m:=m(7)&m(7downto1)
33、;cp:=b(0)&t;counter:=counter+1;endLoop;op=m&b;endprocess;endBehavioral;實驗六陣列乘法器實驗目的:1掌握ISE開發(fā)工具的使用,掌握FPGA開發(fā)的基本步驟;2理解陣列乘法器的設計思想,用VHDL實現(xiàn)陣列乘法的算法;3掌握程序下載的辦法;4掌握開發(fā)板的使用方法,重點掌握按鍵,開關,LCD,LED的使用方法。實驗內(nèi)容:1用VHDL實現(xiàn)陣列乘法器。陣列乘法器的頂層模塊如下圖所示。圖陣列乘法器頂層模塊2將程序下載到FPGA并進行檢驗資源使用要求用滑動開關(S0S8)輸入乘數(shù),被乘數(shù)。用LED0LED15顯示運算結果。實驗步驟1啟動IS
34、E,新建工程文件;2編寫8位陣列乘模塊,其原理圖如上圖。3編寫完加法器模塊之后,在頂層文件上實現(xiàn)映射;4新建UCF文件,輸入位置約束;5完成綜合,實現(xiàn),生成下載文件;6連接開發(fā)板USB下載線,開啟開發(fā)板電源;7下載FPGA;關鍵代碼-基本運算單元architectureBehavioraloffauisbeginsout=(axorb)xorcin;cout=(aandb)or(cinanda)or(cinandb);endBehavioral;-toparchitectureBehavioraloftop_rowiscomponentand_2isPort(a:inSTD_LOGIC;b:i
35、nSTD_LOGIC;cout:outSTD_LOGIC);endcomponent;beginU1:and_2portmap(a,b(6),sout(5);U2:and_2portmap(a,b(5),sout(4);U3:and_2portmap(a,b(4),sout(3);U4:and_2portmap(a,b(3),sout(2);U5:and_2portmap(a,b(2),sout(1);U6:and_2portmap(a,b(1),sout(0);U7:and_2portmap(a,b(0),p);cout=000000;endBehavioral;-middlearchite
36、ctureBehavioralofmid_rowiscomponentand_2isPort(a:inSTD_LOGIC;b:inSTD_LOGIC;cout:outSTD_LOGIC);endcomponent;componentfauisPort(a:inSTD_LOGIC;b:inSTD_LOGIC;cin:inSTD_LOGIC;sout:outSTD_LOGIC;cout:outSTD_LOGIC);endcomponent;signaland_out:std_logic_vector(5downto0);beginU1:and_2portmap(a,b(6),sout(5);U2:
37、and_2portmap(a,b(5),and_out(5);U3:and_2portmap(a,b(4),and_out(4);U4:and_2portmap(a,b(3),and_out(3);U5:and_2portmap(a,b(2),and_out(2);U6:and_2portmap(a,b(1),and_out(1);U7:and_2portmap(a,b(0),and_out(0);U8:fauportmap(sin(5),cin(5),and_out(5),sout(4),cout(5);U9:fauportmap(sin(4),cin(4),and_out(4),sout(
38、3),cout(4);U10:fauportmap(sin(3),cin(3),and_out(3),sout(2),cout(3);U11:fauportmap(sin(2),cin(2),and_out(2),sout(1),cout(2);U12:fauportmap(sin(1),cin(1),and_out(1),sout(0),cout(1);U13:fauportmap(sin(0),cin(0),and_out(0),p,cout(0);endBehavioral;-lowarchitectureBehavioraloflow_rowiscomponentfauisPort(a
39、:inSTD_LOGIC;b:inSTD_LOGIC;cin:inSTD_LOGIC;sout:outSTD_LOGIC;cout:outSTD_LOGIC);endcomponent;signallocal:std_logic_vector(5downto0);beginlocal(0)=0;U1:fauportmap(sin(0),cin(0),local(0),p(0),local(1);U2:fauportmap(sin(1),cin(1),local(1),p(1),local(2);U3:fauportmap(sin(2),cin(2),local(2),p(2),local(3)
40、;U4:fauportmap(sin(3),cin(3),local(3),p(3),local(4);U5:fauportmap(sin(4),cin(4),local(4),p(4),local(5);U6:fauportmap(sin(5),cin(5),local(5),p(5),p(6);endBehavioral;實驗七加減交替除法器實驗目的1掌握ISE開發(fā)工具的使用,掌握FPGA開發(fā)的基本步驟;2理解加減交替除法器的設計思想,用VHDL實現(xiàn)加減交替除法的算法;3掌握程序下載的辦法;4掌握開發(fā)板的使用方法,重點掌握按鍵,開關,LCD,LED的使用方法。實驗內(nèi)容1用VHDL實現(xiàn)加減交
41、替除法器。陣列乘法器的頂層模塊如下圖所示。圖加減交替除器頂層模塊2將程序下載到FPGA并進行檢驗資源使用要求用滑動開關(S0S8)輸入乘數(shù),被乘數(shù)。用LED0LED15顯示運算結果。實驗步驟1啟動ISE,新建工程文件;2編寫8位陣列乘模塊,其原理圖如下圖。圖陣列乘模塊3編寫完加法器模塊之后,在頂層文件上實現(xiàn)映射;4新建UCF文件,輸入位置約束;5完成綜合,實現(xiàn),生成下載文件;6連接開發(fā)板USB下載線,開啟開發(fā)板電源;7下載FPGA;關鍵代碼entitydiv8isport(numerator:instd_logic_vector(7downto0);denominator:instd_logi
42、c_vector(7downto0);quotient:outstd_logic_vector(7downto0);remainder:outstd_logic_vector(7downto0);enddiv8;architectureBehavioralofdiv8isbeginprocess(numerator,denominator)variablen1:std_logic_vector(8downto0);variablen2:std_logic_vector(7downto0);variablenumer:std_logic_vector(7downto0);variabled:st
43、d_logic_vector(8downto0);beginn1:=000000000;n2:=00000000;numer:=numerator;d:=0&denominator;ifdenominator=00000000thenquotient=11111111;remainder=d)thenn1:=n1-d;n2(0):=1;elsen1:=n1;n2(0):=0;endif;endloop;quotient=n2(7downto0);remainder=n1(7downto0);endif;endprocess;endBehavioral;實驗八ROM存儲器實驗目的:掌握ISE開發(fā)
44、工具的使用,掌握FPGA開發(fā)的基本步驟;掌握ROM電路設計的一般辦法;掌握程序下載的辦法;初步了解開發(fā)板資源,掌握開發(fā)板的使用方法,重點掌握按鍵,開關,LCD,LED的使用方法。實驗內(nèi)容:1用VHDL實現(xiàn)ROM其中Addr為地址輸入,OE:數(shù)據(jù)輸入使能,使用板上開關(S0S15);DOUT:結果輸出,使用數(shù)碼管顯示運算結果。2將程序下載到FPGA并進行檢驗,資源使用要求,用開關(S0S15)輸入地址和使能。用數(shù)碼管顯示結果。實驗步驟1啟動ISE,新建工程文件;2編寫ROM,其原理圖如上圖。3編寫完模塊之后,在頂層文件上實現(xiàn)映射;4新建UCF文件,輸入位置約束;5完成綜合,實現(xiàn),生成下載文件;6
45、連接開發(fā)板USB下載線,開啟開發(fā)板電源;7下載FPGA;8在文件寫好100個數(shù)據(jù),隨機讀寫任一地址數(shù)據(jù),驗證結果。關鍵代碼entitymyRomisPort(oe:inSTD_LOGIC;Addr:inSTD_LOGIC_VECTOR(7downto0);Dout:outSTD_LOGIC_VECTOR(7downto0);endmyRom;architectureBehavioralofmyRomistypematrixisarray(integerrange)ofstd_logic_vector(7downto0);signalrom:matrix(0to2*8-1);procedurel
46、oad_rom(signaldata_word:outmatrix)isfileromfile:textopenread_modeisromfile.dat;variablelbuf:line;variablei:integer:=0;variablefdata:std_logic_vector(7downto0);beginwhilenotendfile(romfile)loopreadline(romfile,lbuf);read(lbuf,fdata);data_word(i)=fdata;i:=i+1;endloop;endprocedure;beginload_rom(rom);Do
47、utZ);endBehavioral;實驗九FIFO存儲器設計實驗目的掌握ISE開發(fā)工具的使用,掌握FPGA開發(fā)的基本步驟;掌握ROM電路設計的一般辦法;掌握程序下載的辦法;初步了解開發(fā)板資源,掌握開發(fā)板的使用方法,重點掌握按鍵,開關,LCD,LED的使用方法。實驗內(nèi)容1用VHDL實現(xiàn)ROM其中信號如上課如講,使用數(shù)碼管顯示運算結果。2將程序下載到FPGA并進行檢驗,資源使用要求,開關(S0S15任意個)輸入地址和使能。用數(shù)碼管顯示結果。實驗步驟1啟動ISE,新建工程文件;2編寫FIFO,其原理圖如圖。3編寫完模塊之后,在頂層文件上實現(xiàn)映射;4新建UCF文件,輸入位置約束;5完成綜合,實現(xiàn),生
48、成下載文件;6連接開發(fā)板USB下載線,開啟開發(fā)板電源;7下載FPGA;8在文件寫好100個數(shù)據(jù),隨機讀寫任一地址數(shù)據(jù),同時另一端寫數(shù)據(jù),驗證結果。關鍵代碼entityfifo_topisgeneric(w:integer:=8;k:integer:=8);port(clk,reset,wr,rd:INstd_logic;din:INstd_logic_vector(k-1downto0);dout:OUTstd_logic_vector(k-1downto0);full,empty:OUTstd_logic);endfifo_top;architectureBehavioraloffifo_t
49、opisTYPEmemoryISARRAY(0tow-1)OFstd_logic_vector(k-1downto0);signalram:MEMORY;signalwp,rp:INTEGERrange0tow-1;signalis_full,is_empty:STD_LOGIC;beginfull=is_full;empty=is_empty;-dout=ram(rp);-writedataintoramorreaddatafromramPROCESS(clk)beginifrising_edge(clk)thenif(wr=0andis_full=0)thenram(wp)=din;els
50、if(rd=0andis_empty=0)thendout=ram(rp);endif;endif;endprocess;-modifythepointerofwpprocess(clk,reset)beginif(reset=1)thenwp=0;elsifrising_edge(clk)then-whentheramisnotfullandtheenablepointwrislowif(wr=0andis_full=0)then-whenwppointtothelastbyteofram,redirecttozeroif(wp=w-1)thenwp=0;elsewp=wp+1;endif;
51、endif;endif;endprocess;-modifythepointerofrpprocess(clk,reset)beginif(reset=1)thenrp=0;elsifrising_edge(clk)thenif(rd=0andis_empty=0)thenif(rp=w-1)thenrp=0;elserp=rp+1;endif;endif;endif;endprocess;-describehowtoproducttheflagofis_emptyprocess(clk,reset)beginif(reset=1)thenis_empty=1;elsifrising_edge
52、(clk)then-if(wp=rp-2or(rp=w-1andwp=1)-OR(rp=w-2andwp=0)AND(rd=0andwr=1)then-if(rp=wp-1andrd=0)thenif(rp=w-1andwp=0)or(rp=wp-1)and(rd=0)thenis_empty=1;elsif(is_empty=1andwr=0)thenis_empty=0;endif;endif;endprocess;-describehowtoproducttheflagofis_fullprocess(clk,reset)beginif(reset=1)thenis_full=0;els
53、ifrising_edge(clk)then-if(rp=wpandwr=0andrd=1)then-if(wp=rp-1andwr=0)thenif(wp=w-1andrp=0)or(wp=rp-1)and(wr=0)thenis_full=1;elsif(is_full=1andrd=0)thenis_full=0;endif;endif;endprocess;endBehavioral;實驗十時鐘模塊設計實驗目的1掌握時鐘信號產(chǎn)生的原理及應用;2掌握時鐘節(jié)拍的產(chǎn)生方法及使用方法。實驗內(nèi)容1.采用VHDL語言設計時鐘模塊具體端口定義如下2所實現(xiàn)的時鐘功能模塊應滿足以下時序關系:實驗步驟1時
54、鐘信號的輸出及反向信號輸出2時鐘信號的2分頻及反向信號功能實現(xiàn)3時鐘節(jié)拍信號產(chǎn)生4采用testbanch進行功能仿真,輸出相同的信號波形。關鍵代碼entityclk_genisPort(clk:inSTD_LOGIC;reset:inSTD_LOGIC;clk1:outSTD_LOGIC;nclk1:outSTD_LOGIC;clk2:outSTD_LOGIC;nclk2:outSTD_LOGIC;w0:outSTD_LOGIC;w1:outSTD_LOGIC;w2:outSTD_LOGIC;w3:outSTD_LOGIC);endclk_gen;architectureBehavioralo
55、fclk_genisbeginprocess(clk,reset)variablecnt1:integer:=0;variablecnt2:integer:=0;beginclk1=clk;nclk1=notclk;if(reset=0)thenw0=0;w1=0;w2=0;w3=0;elseif(rising_edge(clk)thencnt1:=cnt1+1;cnt2:=cnt2+1;if(cnt1=1)thenclk2=0;nclk2=1;elsif(cnt1=2)thenclk2=1;nclk2=0;if(cnt1=2)thencnt1:=0;endif;endif;if(cnt2=2
56、)thenw0=1;w1=0;w2=0;w3=0;elsif(cnt2=4)thenw0=0;w1=1;w2=0;w3=0;elsif(cnt2=6)thenw0=0;w1=0;w2=1;w3=0;elsif(cnt2=8)thenw0=0;w1=0;w2=0;w3=1;if(cnt2=8)thencnt2:=0;endif;endif;endif;endif;endprocess;endBehavioral;實驗十一PC程序計數(shù)器設計實驗目的:1掌握PC功能及工作原理;2掌握PC與其他模塊信號之間的關聯(lián)性。實驗內(nèi)容:1采用VHDL語言設計PC模塊具體端口定義如下其中clk_PC=nclk2,
57、在組建CPU模塊時使用。2功能實現(xiàn)全局異步復位功能ADDR=“000000000000”;數(shù)據(jù)總線高阻態(tài);加1功能clk_PC上升沿有效;M_PC高電平有效,PC+1ADDR;地址更新功能clk_PC上升沿有效,nLD_PC低電平有效,新的PCADDR。PC數(shù)值送到數(shù)據(jù)總線nPCH和nPCL低電平有效,注意分兩次輸出到總線上,先高8位后低8位。實驗步驟1實現(xiàn)異步復位功能2實現(xiàn)加1功能3實現(xiàn)地址更新功能3實現(xiàn)PC數(shù)值送到數(shù)據(jù)總線3輸入信號采用按鍵輸入,輸出部分采用數(shù)碼管顯示。關鍵代碼entitymodule_pcisPort(clk_pc:inSTD_LOGIC;nreset:inSTD_LOG
58、IC;nld_pc:inSTD_LOGIC;m_pc:inSTD_LOGIC;npch:inSTD_LOGIC;npcl:inSTD_LOGIC;pc:inSTD_LOGIC_VECTOR(11downto0);addr:outSTD_LOGIC_VECTOR(11downto0);d:outSTD_LOGIC_VECTOR(7downto0);endmodule_pc;architectureBehavioralofmodule_pcissignaldata:STD_LOGIC_VECTOR(11downto0);beginprocess(clk_pc,nreset,m_pc,nld_pc,
59、npch,npcl,pc)beginifnreset=1thenaddr=000000000000;d=00000000;data=000000000000;elseifrising_edge(clk_pc)thenifm_pc=1thendata=data+000000000001;addr=data;endif;ifnld_pc=0thendata=pc;addr=data;endif;ifnpch=0thend=0000&data(11downto8);endif;ifnpcl=0thendclk,M_ROM=M_ROM,ROM_EN=ROM_EN,Addr=addr,Dout=dout
60、);U2:seg_disportmap(clk=clk,rst=rst,data_in_A=dout,seg_sel=seg_sel,seg_data=seg_data);endBehavioral;entitymyRomisPort(oe:inSTD_LOGIC;Addr:inSTD_LOGIC_VECTOR(7downto0);Dout:outSTD_LOGIC_VECTOR(7downto0);endmyRom;architectureBehavioralofmyRomistypematrixisarray(integerrange)ofstd_logic_vector(7downto0
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年高性能功能陶瓷結構陶瓷項目立項申請報告模板
- 2025年勘探開發(fā)技術咨詢合同文本
- 2025年食品分銷合作協(xié)議樣本
- 2025年進口臨床治療儀器合同協(xié)議
- 2025年消腫散結類用藥項目規(guī)劃申請報告模式
- 2025年二手小康住宅買賣協(xié)議模板
- 2025年船專用碼頭項目提案報告模稿
- 2025年高強度耐磨黃銅合金項目規(guī)劃申請報告模板
- 2025年出租車租賃承包合同
- 2025年臨時工派遣協(xié)議
- 妊娠合并急性胰腺炎課件
- (全國通用)三甲人民醫(yī)院診斷證明書請假條模板(廣東佛山)
- 《滅火器維修》GA95-2015(全文)
- 表面工程學課件-全
- 皮膚科疑難病例討論課件
- 通信系統(tǒng)防雷與接地下篇的知識
- Q∕GDW 12118.2-2021 人工智能平臺架構及技術要求 第2部分:算法模型共享應用要求
- 管理者完成目標的五步19法姜洋講義
- 亳州市污水處理廠工藝設計
- 復查(復核)信訪事項流程圖
- the sad young men上課
評論
0/150
提交評論