![數(shù)字系統(tǒng)設(shè)計(jì)實(shí)驗(yàn)---32位串行加法器實(shí)驗(yàn)_第1頁](http://file2.renrendoc.com/fileroot_temp3/2021-10/31/157179b3-6798-4012-8f63-ba3b45b3a633/157179b3-6798-4012-8f63-ba3b45b3a6331.gif)
![數(shù)字系統(tǒng)設(shè)計(jì)實(shí)驗(yàn)---32位串行加法器實(shí)驗(yàn)_第2頁](http://file2.renrendoc.com/fileroot_temp3/2021-10/31/157179b3-6798-4012-8f63-ba3b45b3a633/157179b3-6798-4012-8f63-ba3b45b3a6332.gif)
![數(shù)字系統(tǒng)設(shè)計(jì)實(shí)驗(yàn)---32位串行加法器實(shí)驗(yàn)_第3頁](http://file2.renrendoc.com/fileroot_temp3/2021-10/31/157179b3-6798-4012-8f63-ba3b45b3a633/157179b3-6798-4012-8f63-ba3b45b3a6333.gif)
![數(shù)字系統(tǒng)設(shè)計(jì)實(shí)驗(yàn)---32位串行加法器實(shí)驗(yàn)_第4頁](http://file2.renrendoc.com/fileroot_temp3/2021-10/31/157179b3-6798-4012-8f63-ba3b45b3a633/157179b3-6798-4012-8f63-ba3b45b3a6334.gif)
![數(shù)字系統(tǒng)設(shè)計(jì)實(shí)驗(yàn)---32位串行加法器實(shí)驗(yàn)_第5頁](http://file2.renrendoc.com/fileroot_temp3/2021-10/31/157179b3-6798-4012-8f63-ba3b45b3a633/157179b3-6798-4012-8f63-ba3b45b3a6335.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、深 圳 大 學(xué) 實(shí) 驗(yàn) 報(bào) 告 課程名稱: 數(shù)字系統(tǒng)設(shè)計(jì) 實(shí)驗(yàn)項(xiàng)目名稱: 32位串行加法器 學(xué)院: 信息工程學(xué)院 專業(yè): 電子信息工程 指導(dǎo)教師: 報(bào)告人: 學(xué)號:20091000000 班級: 1班 實(shí)驗(yàn)時(shí)間: 2011-12-4 實(shí)驗(yàn)報(bào)告提交時(shí)間: 2011-12-10 教務(wù)處制一、實(shí)驗(yàn)?zāi)康呐c要求:實(shí)驗(yàn)?zāi)康模?、 掌握串行加法器的原理和設(shè)計(jì)。2、 熟悉VHDL狀態(tài)機(jī)的設(shè)計(jì)。3、 學(xué)會分析波形圖。實(shí)驗(yàn)要求:設(shè)計(jì)一個(gè)用一個(gè)1位加法器構(gòu)建的一個(gè)32位串行加法器。重點(diǎn)是算法狀態(tài)機(jī)的實(shí)現(xiàn)還有系統(tǒng)的時(shí)序分析;輸出和整理VHDL源代碼;輸出和整理電路結(jié)構(gòu)圖;輸出和整理仿真波形圖二、實(shí)驗(yàn)原理1、設(shè)計(jì)原理圖
2、:本圖參考課本2、流程圖:針對以上流程圖,其中,Sh為控制移位寄存器的使能信號,k為工作狀態(tài)指示信號,load為加載信號,counter為運(yùn)算計(jì)數(shù)器,N為系統(tǒng)工作控制信號。從流程圖中可以看出加法器的整個(gè)工作流程是怎么樣子的,具體工作情況如下面的設(shè)計(jì)。三、實(shí)驗(yàn)內(nèi)容與步驟1、VHDL代碼的編寫:-控制器-library IEEE;use IEEE.STD_LOGIC_1164.ALL;use ieee.std_logic_unsigned.all;entity controller is Port ( clk : in STD_LOGIC; N : in STD_LOGIC; K,Sh,load
3、: out STD_LOGIC);end controller;architecture Behavioral of controller issignal state,nextstate:integer range 0 to 2; -設(shè)置狀態(tài)signal counter:std_logic_vector(4 downto 0);beginprocess(clk)beginif(clk'event and clk='1') thenstate<=nextstate; -上升沿觸發(fā)啟動end if;end process;process(clk,N)beginif(
4、clk'event and clk='1') thencase state is -設(shè)置各狀態(tài)when 0 =>sh<='0'K<='0'load<='0'counter<="00000"if N='1' thenload<='1'nextstate<=1;else nextstate<=0;end if;when 1 =>sh<='1'K<='0'load<='
5、;0'if counter="11110" thencounter<=counter+1;nextstate<=2;else counter<=counter+1;nextstate<=1;end if;when 2 =>sh<='0'K<='1'load<='0'if N='0' thennextstate<=0;elsenextstate<=2;end if;end case;end if;end process;end Behaviora
6、l;-加數(shù)寄存器-library IEEE;use IEEE.STD_LOGIC_1164.ALL;entity registers_jiashu is Port ( input : in STD_LOGIC_vector(31 downto 0); Sh,load,clk: in STD_LOGIC; SO : out STD_LOGIC);end registers_jiashu;architecture Behavioral of registers_jiashu issignal x:std_logic_vector(31 downto 0);beginprocess(clk)begi
7、nif(clk'event and clk='1') thenif (load='1') then x<=input; -輸入放入寄存器elsif (sh='1') then -移位x(30 downto 0)<=x(31 downto 1);end if;end if;end process;so<=x(0);end Behavioral;-累加器-library IEEE;use IEEE.STD_LOGIC_1164.ALL;entity registers_add is Port ( input : in STD
8、_LOGIC_vector(31 downto 0); clk : in STD_LOGIC; load,Sh,Si: in STD_LOGIC; SO : out STD_LOGIC; output:out std_logic_vector(31 downto 0);end registers_add;architecture Behavioral of registers_add issignal x:std_logic_vector(31 downto 0);beginprocess(clk)beginif(clk'event and clk='1') theni
9、f(load='1') thenx<=input;elsif(Sh='1') thenx(30 downto 0)<=x(31 downto 1); -移位x(31)<=Si;end if;end if;end process;So<=x(0);output<=x; -把最后值輸出來end Behavioral;-全加器-library IEEE;use IEEE.STD_LOGIC_1164.ALL;entity full_adder is Port ( a : in STD_LOGIC; b : in STD_LOGIC; ci
10、n : in STD_LOGIC; s : out STD_LOGIC; cout : out STD_LOGIC);end full_adder;architecture Behavioral of full_adder isbegins<=a xor b xor cin;cout<=(a and b)or(a and cin) or (b and cin);end Behavioral;-D觸發(fā)器-library IEEE;use IEEE.STD_LOGIC_1164.ALL;entity DFF is Port ( D : in STD_LOGIC; clk : in ST
11、D_LOGIC; rst,CE : in STD_LOGIC; Q: out STD_LOGIC);end DFF;architecture Behavioral of DFF isbeginprocess(rst,clk,CE)beginif(rst='1') thenQ<='0'elsif CE='1' and (clk'event and clk='1') thenQ<=D;end if;end process;end Behavioral;-主函數(shù)-library IEEE;use IEEE.STD_L
12、OGIC_1164.ALL;entity adder_32 isport(inputA,inputB:in std_logic_vector(31 downto 0);clk,N :in std_logic;outputA:out std_logic_vector(31 downto 0);K:out std_logic);end adder_32;architecture Behavioral of adder_32 is -對各個(gè)元件進(jìn)行例化- component controller is -控制器Port ( clk : in STD_LOGIC; N : in STD_LOGIC;
13、K,Sh,load : out STD_LOGIC);end component;component registers_jiashu is -加數(shù)寄存器 Port ( input : in STD_LOGIC_vector(31 downto 0); Sh,load,clk: in STD_LOGIC; SO : out STD_LOGIC);end component;component registers_add is - 累加器 Port ( input : in STD_LOGIC_vector(31 downto 0); clk : in STD_LOGIC; load,Sh,Si
14、: in STD_LOGIC; SO : out STD_LOGIC; output:out std_logic_vector(31 downto 0);end component;component full_adder is -全加器 Port ( a : in STD_LOGIC; b : in STD_LOGIC; cin : in STD_LOGIC; s : out STD_LOGIC; cout : out STD_LOGIC);end component;component DFF is -D觸發(fā)器 Port ( D : in STD_LOGIC; clk : in STD_L
15、OGIC; rst,CE : in STD_LOGIC; Q: out STD_LOGIC);end component;signal Sh,load,Xi,Yi,Si,cin,sum,cout:std_logic; -中間變量beginA1: controller port map(clk,n,k,Sh,load);A2: registers_jiashu port map(inputB,Sh,load,clk,Yi);A3: registers_add port map(inputA,clk,load,Sh,sum,Xi,outputA);A4: full_adder port map(X
16、i,Yi,cin,sum,cout);A5: DFF port map (cout,clk,load,Sh,cin);end Behavioral;2、仿真代碼的編寫:LIBRARY ieee;USE ieee.std_logic_1164.ALL; ENTITY adder_32_testbench ISEND adder_32_testbench; ARCHITECTURE behavior OF adder_32_testbench IS - Component Declaration for the Unit Under Test (UUT) COMPONENT adder_32 PO
17、RT( inputA : IN std_logic_vector(31 downto 0); inputB : IN std_logic_vector(31 downto 0); clk : IN std_logic; N : IN std_logic; outputA : OUT std_logic_vector(31 downto 0); K : OUT std_logic ); END COMPONENT; -Inputs signal inputA : std_logic_vector(31 downto 0) := (others => '0'); signal
18、 inputB : std_logic_vector(31 downto 0) := (others => '0'); signal clk : std_logic := '0' signal N : std_logic := '0' -Outputs signal outputA : std_logic_vector(31 downto 0); signal K : std_logic; - Clock period definitions constant clk_period : time := 10 ns; BEGIN - Inst
19、antiate the Unit Under Test (UUT) uut: adder_32 PORT MAP ( inputA => inputA, inputB => inputB, clk => clk, N => N, outputA => outputA, K => K ); - Clock process definitions clk_process :process beginclk <= '0'wait for clk_period/2;clk <= '1'wait for clk_period
20、/2; end process; stim_proc: process begin-進(jìn)行輸入仿真 inputA<="00000000000000000000000001001001" - inputa= 73,inputB<="00000000000000000000000010001010" - inputb= 138,N<='1' -N=1時(shí)開始計(jì)時(shí),并開始下載數(shù)據(jù)wait for 32*clk_period;-32個(gè)時(shí)鐘周期之后N<='0' -N=0,停止數(shù)據(jù)下載,得出相加后的結(jié)果wait for 10*clk_period; - 延時(shí)10個(gè)時(shí)鐘周期,進(jìn)入下一輪仿真調(diào)試inputA<="01010101010101010101010101010101" - inputa= 1431655765,inputB<="00110000000000000000000010101000" -
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 讓課堂充滿生機(jī)與活力
- 2025年槍托項(xiàng)目可行性研究報(bào)告
- 2025年度航空航天裝備研發(fā)合作合同
- 信用社終止貸款合同范本
- 儲值合同范本
- 保時(shí)捷買賣合同范本
- 公司對個(gè)人轉(zhuǎn)讓合同范例
- 優(yōu)信網(wǎng)出租車合同范例
- 交通管制合同范本
- 企業(yè)公司聘用合同范本
- 高中物理《光電效應(yīng)》
- 烹飪實(shí)訓(xùn)室安全隱患分析報(bào)告
- 《金屬加工的基礎(chǔ)》課件
- 運(yùn)輸行業(yè)春節(jié)安全生產(chǎn)培訓(xùn) 文明駕駛保平安
- 體驗(yàn)式沙盤-收獲季節(jié)
- HGE系列電梯安裝調(diào)試手冊(ELS05系統(tǒng)SW00004269,A.4 )
- 找人辦事協(xié)議
- 老年護(hù)理陪護(hù)培訓(xùn)課件
- 醬香型白酒工廠設(shè)計(jì)
- 第3章 環(huán)境感知技術(shù)
- 牽引管道孔壁與管道外壁之間注漿技術(shù)方案
評論
0/150
提交評論