freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于vhdl通用計(jì)算器源程序設(shè)計(jì)說明書(已修改)

2025-05-23 19:03 本頁面
 

【正文】 1 源程序 4 位二進(jìn)制并行進(jìn)位加法器的源程序 如下 LIBRARY IEEE。 USE 。 USE 。 ENTITY ADDER4B IS 四位二進(jìn)制并行加法器 PORT(ci: IN STD_LOGIC。 低位進(jìn)位 a:IN STD_LOGIC_VECTOR3 DOWNTO 0)。 4 位加數(shù) b:IN STD_LOGIC_VECTOR(3 DOWNTO 0)。 4 位被加數(shù) s:OUT STD_LOGIC_VECTOR(3 DOWNTO 0)。 4 位和 co:OUT STD_LOGIC 進(jìn)位輸出 )。 END ADDER4B。 ARCHITECTURE behave OF ADDER4B IS SIGNAL SINT:STD_LOGIC_VECTOR(4 DOWNTO 0)。 部定義的一個(gè)數(shù)據(jù) SIGNAL aa, bb: STD_LOGIC_VECTOR(4 DOWNTO 0)。 BEGIN aa=’0’amp。a。 將 4 位加數(shù)矢量擴(kuò)為 5 位,為進(jìn)位提供空間 bb=’0’amp。b。 將 4 位被加數(shù)矢量擴(kuò)為 5 位,為進(jìn)位提供空間 INT=aa+bb+ci。 相加 s=SINT(3 DOWNTO 0)。 co=SINT(4)。 最高位為輸出進(jìn)位 END behave。 頂層模塊: 8 位二進(jìn)制并行進(jìn)位加法器的部分程序 如下: LIBRARY IEEE。 USE 。 USE 。 ENTITY ADDER8B IS PORT(ci: 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)。 co:OUT STD_LOGIC )。 END ADDER8B。 ARCHITECTURE a OF ADDER8B IS Component adder4B 引用 4 位二進(jìn)制并行進(jìn)位加法器 2 PORT(ci: IN STD_LOGIC。 a:IN STD_LOGIC_VECTOR3 DOWNTO 0)。 b:IN STD_LOGIC_VECTOR(3 DOWNTO 0)。 s:OUT STD_LOGIC_VECTOR(3 DOWNTO 0)。 co:OUT STD_LOGIC )。 END COMPONENT。 SIGNAL CARRY_OUT:STD_LOGIC。 4 位加法器的進(jìn)位標(biāo)志 BEGIN U1:ADDER4B 安裝一個(gè) 4 位二進(jìn)制加法器 U1 PORT MAP(ci=ci,a=a(3 DOWNTO 0),b=b(3 DWONTO 0),s=(3 DOWNTO 0),co=CARRY_OUT)。 U2:ADDER4B 安裝一個(gè) 4 位二進(jìn)制加法器 U2 PORT MAP(ci=CARRY_OUT,a=a(7 DOWNTO 4),b=b(7 DWONTO 4),s=(7 DOWNTO 4),co=co)。 END behave。 加法 器 VHDL 程序如下 LIBRARY IEEE。 USE 。 USE 。 USE 。 ENTITY adder IS port(a:in std_logic。 被加數(shù) a b:in std_logic。 加數(shù) b ci:in std_logic。 輸入進(jìn)位 s:out std_logic。 結(jié)果輸出 co:out std_logic 輸出進(jìn)位 )。 end adder。 architecture behave of adder is signal tem: std_logic。 暫存 signal stem: std_logic。 begin tem=a xor b。 中間變量 stem=tem xor ci。 結(jié)果 co=(tem and ci) or (a and b)。 進(jìn)位輸出 s=stem。 輸出 end behave。 3 4 位二進(jìn)制并行進(jìn)位減法器的源程序 如下 : LIBRARY IEEE。 USE 。 USE 。 USE 。 ENTITY sub4 IS PORT(a:IN STD_LOGIC_VECTOR(3 DOWNTO 0)。 4 位被減數(shù) b:IN STD_LOGIC_VECTOR(3 DOWNTO 0)。 4 位減數(shù) ci:IN STD_LOGIC。 輸入進(jìn)位 s:OUT STD_LOGIC_VECTOR(3 DOWNTO 0)。 結(jié)果輸出 co:OUT STD_LOGIC 輸出進(jìn)位 )。 end suber。 architecture behave of suber is ponent adder is 引用加法器的模塊 port(a:in std_logic。 b:in std_logic。 ci:in std_logic。 s:out std_logic。 co:out std_logic )。 end ponent。 signal btem:std_logic_vector(3 downto 0)。 減數(shù)寄存 signal ctem:std_logic_vector(4 downto 0)。 進(jìn)位寄存 signal stem:std_logic_vector(3 downto 0)。 結(jié)果寄存 begin btem(3 downto 0)=not b(3 downto 0)。 先把減數(shù)求反 ctem(0)=not ci。 輸入的進(jìn)位也求反,從而對減數(shù)求補(bǔ)碼 g1:for I in 0 to 3 generate 連用 4 位全加器 add:adder port map (a(i),btem(i),ctem(i),stem(i),ctem(i+1))。 end generate。 s(3 downto 0)=stem(3 downto 0)。 結(jié)果輸出 co=not ctem(4)。 求反輸出進(jìn)位 4 end behave。 乘法器的源程序: LIBRARY IEEE。 USE 。 USE 。 USE 。 Entity mul is Port( a:in std_logic_vector(3 downto 0)。 4 位被乘數(shù) b:in std_logic_vector(3 downto 0)。 4 位乘數(shù) y:out std_logic_vector(7 downto 0) 乘積 ); end mul。 architecture arch of mul is begin y(7 downto 0)=a(3 downto 0)*b(3 downto 0)。 end arch。 除法器的源程序: LIBRARY IEEE。 USE 。 USE 。 USE 。 entity diver is PORT(a:IN STD_LOGIC_VECTOR(7 DOWNTO 0)。 8 位被除數(shù)輸入 b:IN STD_LOGIC_VECTOR(3 DOWNTO 0)。 4 位除數(shù)輸入 clk:IN STD_LOGIC。 時(shí)鐘 str:IN STD_LOGIC。 啟動(dòng)信號(hào) s:OUT STD_LOGIC_VECTOR(3 DOWNTO 0)。 4 位商輸出 y:OUT STD_LOGIC_VECTOR(3 DOWNTO 0) 4 位余數(shù)輸出 )。 End。 Architecture behave of diver is Component suber is 引用減法器 PORT(a:IN STD_LOGIC_VECTOR(3 DOWNTO 0)。 b:IN STD_LOGIC_VECTOR(3 DOWNTO 0)。 ci:IN STD_LOGIC。 s:OUT STD_LOGIC_VECTOR(3 DOWNTO 0)。 co:OUT STD_LOGIC )。 End ponent。 5 type state_type is(start,one,two,three,eror)。 狀態(tài)定義 signal state:state_type。 定義狀態(tài)變量 signal ain: std_logic_vector(7 downto 0)。 被除數(shù)寄存 signal bin: std_logic_vector(3 downto 0)。 除數(shù)寄存 signal atem: std_logic_vector(3 downto 0)。 減法器被減數(shù)輸入 signal btem: std_logic_vector(3 downto 0)。 減法器減數(shù)輸入 signal stem: std_logic_vector(3 downto 0)。 結(jié)果寄存 signal citem: std_logic。 減法器借位輸入 signal cotem:std_logic。 減法器借位輸出 begin p2:process(clk) variable n: integer range 0 to 3。 移位次數(shù)計(jì)數(shù)值 begin if clk’event and clk=’1’ then case state is when atart= 開始狀態(tài) if str=’1’ then 收到啟動(dòng)信號(hào) state=one。 轉(zhuǎn)到狀態(tài) one atem(3 downto 0)=a(7 downto 4)。 把高 4 位放到減法器被減數(shù)端 btem(3 downto 0)=b(3 downto 0)。 把除數(shù)放到減法器減數(shù)端 ain(7 downto 0)=a(7 downto 0)。 寄存被除數(shù) bin(3 downto 0)=b(3 downto 0)。 寄存除數(shù) end if。 when one= 第一次移位 if cotem=’0’ then 被除數(shù)高 4 位小于除數(shù),溢出! state=eror。 轉(zhuǎn)到出錯(cuò)狀態(tài) else 不溢出 ain(3 downto 1)=ain(2 downto 0)。 被除數(shù)做移位 ain(0)=not cotem。 在最低位接收該位商值 atem(3 downto 0)=ain(6 downto 3)。 把除數(shù)寄存器高 4 位輸?shù)綔p法器,作為減法器被減數(shù) state=two。 轉(zhuǎn)到下一狀態(tài) end if。 when two= 再做
點(diǎn)擊復(fù)制文檔內(nèi)容
醫(yī)療健康相關(guān)推薦
文庫吧 www.dybbs8.com
公安備案圖鄂ICP備17016276號(hào)-1