可編程邏輯在數(shù)字信號(hào)處理系統(tǒng)中的應(yīng)用
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY ADDER8B IS
PORT (CIN:IN STD_LOGIC;
A :IN STD_LOGIC_VECTOR(7 DOWNTO 0);
B :IN STD_LOGIC_VECTOR(7 DOWNTO 0);
S :OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
OUT :OUT STD_LOGIC);
END ADDER8B;
ARCHIteCTURE struc OF ADDER8B IS
COMPONENT ADDER4B
PORT (CIN4: IN STD_LOGIC;
A4 : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
B4 :IN STD_LOGIC_VECTOR(3 DOWNTO 0);
S4 : OUT ST_D_LOGIC_VECTOR(3 DOWN-TO 0);
COUT4 : OUT STD_LOGIC);
END COMPONENT;
SIGNAL CARRY_OUT : STD_LOGIC;
BEGIN
U1:ADDER4B
PORT MAP(CIN4=>CIN,A4=>A(3 DOWNTO 0),B4=>B(3 DOWNTO 0),S4=>S(3 DOWNTO 0),COUT4=>CARRY_OUT);
U2 :ADDER4B
PORT MAP(CIN4=>CARRY_OUT,A4=>A(7 DOWNTO 4),B4=>B(7 DOWNTO 4),S4=>S(7 DOWNTO 4),COUT4=>COUT);
END struc;
在上面的VHDL描述中,ADDER4B是一個(gè)4位二進(jìn)制加法器,其VHDL描述是:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY ADDER4B IS
PORT (CIN4 :IN STD_LOGIC;
A4 :IN STD_LOGIC_VECTOR(3 DOWNTO 0);
B4:IN STD_LOGIC_VECTOR(3 DOWNTO 0);
S4:OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
COUT4:OUT STD_LOGIC;
EAND ADDER4B;
ARCHITEC_TURE behav OF ADDER4B IS
SIGNAL SINT :STD_LOGIC_VECTOR(4 DOWNTO 0);
SIGNAL AA,BB:STD_LOGIC_VECTOR(4 DOWNTO 0);
BEGIN
AA=‘0’A4;
BB=‘0’B4;
SINT=AA+BB+CIN4;
S4=SINT(3 DOWNTO 0);
COUT4=SINT(4);
END behav;
4、結(jié)束語(yǔ)
本文采用基于EDA技術(shù)的自上而下的系統(tǒng)設(shè)計(jì)方法,其設(shè)計(jì)流程如圖2所示。該乘法器的最大優(yōu)點(diǎn)是節(jié)省芯片資源,其運(yùn)算速度取決于輸入的時(shí)鐘頻率。如若時(shí)鐘頻率為100MHz,則每個(gè)運(yùn)算周期僅需80ns,因而具有一定的實(shí)用價(jià)值。
圖2 VHDL設(shè)計(jì)流程
評(píng)論