第六章VHDL设计应用实例 6.18位加法器的设计 1、设计思路 多位加法器的构成方式:并行进位 串行进位 并行进位:速度快、占用资源多 串行进位:速度慢、占用资源少
1 第六章 VHDL设计应用实例 6.1 8位加法器的设计 1、设计思路 多位加法器的构成方式:并行进位 串行进位 并行进位:速度快、占用资源多 串行进位:速度慢、占用资源少
速度与资源的折中选择:并行加法器与串行级联 49MAX+plus II-h: \eda_tech_app\e6_1 \adder8b- [adder8b gdf -Graphic Editor] □x MAX+plus II File Edit view Symbol Assign Utilities Options Window Help × 口圖当回回△國囫郾感國為囡烈d ADDER4B s【3..。 R【3.,。 b.01 aa[.0 ADDER4B s|7.4 B【3
2 速度与资源的折中选择:并行加法器与串行级联
2、4位并行加法器 49 MAX+plus lI-f: \dh\mp2 \eda_tech_app\e6_1 \adder 4b-[adder 4b. vhd-Text Editor ×」 FN MAX+plus ll Eile Edit Templates Assign lties Options window Hep library ieee use ieee std logic 1164.alli use ieee std logic unsigned alli entity adder4b is rt(cin: in std log std logic vector(3 downto 0) s: out std logic vector(3 downto 0)i t: out std logic) end adder4bi architecture art of adder4b is signal sint: std logic vector(4 downto 0)i signal aa, bb: std logic vector(4 downto 0 egin a<=0&a; bb<=io &b sint<=aa+bb+cin s<=sint (3 downto o cout<=sint (4 Line 11 Col 42 4
3 2、4位并行加法器
3、8位二进制加法器 C,aMAX+plus II-f:\dh\mp2\eda tech app \e6 1\ad EE MAX+pus II Ele Edit Templates assign Utilties options window Help 口哆舀叫△國囫郾郾四囚為圖面剧烈雷 Courier New20-B library ieee use ieee std logic 1164.alli use ieee std logic unsigned. all entity adders is port (cin: in std logici a, b:in std logic vector(7 downto O s: out std logic vector(7 downto 0) cout: out sta logic)i end adders; architecture art of adder8b is component adder4b port(cin: in std logici a b:in std logic vector(3 downto 0)i s: out std logic vector(3 downto 0); cout: out std logic end component signal carry out: std logic; Line 1 Col 1INS 4
4 3、8位二进制加法器
2MAX+plus lI-f:\(dh mp2\(eda_tech_app e6_1\adder4b-[adderBb, whd-Text Editor] 回×」 8 MAX+plus Il Eile Edit Templates Assign Utilties Options Window Hep 口圖舀属回△國囫国感国国為画A武雷 Courier New. B涅 begi ul: adder port map(cin=>cin, a=>a(3 downto 0) b=>b(3 downto 0) s(3 downto 0) cout=>carry out)i u2: adder4b port map(cin=>carry out >a(7 downto 4) b=>b(7 downto 4) s=>s(7 downto 4) cout=>cout)i end art LLine31col16Ns←
5
仿真结果: 6O MAX+plus II-h: \eda tech_app\e6 1\adder8b- [adder8b scf -aveform Ed ES MAX+plus II File Edit View Node Assign Utilities Options Window Help 口哆闆舀幽回△國囫卧感圖圖為圖匾副亟武會雷跟聞 L+Time: 1.47us Interval:1.47us Name 2000ns 4000ns hull s 800. 0ns US 4us D0010X20X3040X50X6070X80X%0100X110120X130X140 D00X20X40X60X80X100X120X140X160X180X200X220X240X4X24
6 仿真结果:
6.28位乘法器的设计 (MAX+plus II-h: \eda_ tech apple_1\adder8b-[multi8x8.gdf-Graphic Editor] S MAX+plus II Eile Edit View Symbol Assign Utilities Options Window Help 10 k R工cTL ARIE friend ADDER8B A3,, about[15.811 andsd70EA[7.o1 cou B[? SREG8B CLK LonD 0□ DIN【..。 REG16B Q【王s.o] UTPUT about(15.0 ands 7 ABIN IN[7
7 6.2 8位乘法器的设计
1、选通与门模块 andarith 19MAX+plus II-f:\dh\mp2\edatech_app\e62\andarith-Landarith, vhd- Text Editor ×」 FN MAX+plus ll Eile Edit Templates Assign lties Options window Hep librar leer use ieee std logic 1164.all entity andarith is port(abin: in std logic din: in std logic vector(/ downto 0) dout: out std logic vector(7 downto 0) end andarithi architecture art of andarith is begin process(abin, din) begin for i in o to 7 loop dout (i<=din(i) and abin end loop end process end arti Line 1 Col 1INS 4
8 1、选通与门模块andarith
2、16位锁存器regl6b MAX+plus II-f: \ dh\mp2 \eda tech_ app \e6_2\andarith-reg16b whd-Text EditorI R MAX+plus I Ele Edt Templates Assign Utilties options window Help ×」 library ieee; use ieee std logic 1164.all entity regl6b is port(clk, clr: in std logic d: in std logic vector(8 downto o) g: out std logic vector (15 downto 0))i end regl6bi rchitecture art of regl6b is signal rls: std logic vector (15 downto 0)i begi process(clk, clr) egl ifc1r=!1 then r16s<="0000000000000000"; elsif clkfevent and clk=1 then r16s(6 downto o<=r16s(7 downto 1) r16s(15 downto 7)<=d; end ifi end process a=r16s end art I Line 1[ Col 16 INSI
9 2、16位锁存器reg16b
3、8位右移寄存器sreg8b C,oMAX+plus II-f:dh\mp2 \eda tech_ app \e6 2\sregab-Isregab, vhd- Text EditorI N MAX+plus I Ele Edit Templates Assign Unities optons window Help library ieee use ieee std logic 64,a11 entity sreg8b is port(clk, load: in std logici din: in std logic vector (7 downto 0)i gb: out std logic)i end sreg8bi architecture art of sreg8b is signal reg8: std logic vector (7 downto 0)i begin process(clk, load begin if load=1 then reg<=dini elsif clkfevent and clk=1 then reg8(6 downto 0)<-reg8(7 downto 1)i end if end processi gb<=reg(o)i end arti ILine 13 Col 25 INS 41
10 3、8位右移寄存器sreg8b