久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 6324|回復: 2
收起左側

VHDL語言編寫8位乘法器程序

[復制鏈接]
ID:255413 發表于 2017-11-29 21:26 | 顯示全部樓層 |閱讀模式
基于booth算法的有符號數乘法VHDL源代碼,這是8位二進制乘法的,關于十進制轉2進制的程序很簡單,可以自己設置下,乘法器部分如下:library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; ---- Uncomment the following library declaration if instantiating ---- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity mp is Port ( ai,bi : in std_logic_vector(7 downto 0);        done  : out std_logic;        clk   : in std_logic;       op    : out std_logic_vector(7 downto 0)); end mp; architecture Behavioral of mp is begin    process(ai,bi,clk)        variable a,b,m : std_logic_vector( 7 downto 0);        variable cp: std_logic_vector( 1 downto 0);        variable t: std_logic ;        variable counter: integer;        begin           if clk'event and clk='1' then            counter:=0;             t:='0';             a:=ai;             b:=bi;             m:="00000000";             cp:=b(0)&'0';             done<='0'; --是否完成計算            while counter<8 loop                  case cp is                  when "10"=> m:=m-a;                  when "01"=> m:=m+a;                  when others=>m:=m;             end case;             t:=b(0);             b:=m(0)&b(7 downto 1);            m:=m(7)&m(7 downto 1);             cp:=b(0)&t;             counter:=counter+1;             end loop;          op<= m&b;          done<='1';        end if;    end process; end Behavioral; 然后下面這個是加法器樹乘法器的源代碼,也是8位2進制乘法源碼,如果這兩種方法還不夠就MMM我好了library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity ywxj_multipier isport(clk: in std_logic;       a: in std_logic_vector(7 downto 0);--乘數       b: in std_logic_vector(7 downto 0);--被乘數       y: out std_logic_vector(15 downto 0));--輸出end ywxj_multipier;architecture rtl of ywxj_multipier isbeginp1: process(clk)    variable n0,n1,n2,n3,n4,n5,n6,n7: std_logic_vector(15 downto 0);    variable m: std_logic_vector(7 downto 0);    begin    m:="00000000";      if clk'event and clk='1' then         if a(0)<='0' then         n0:="0000000000000000";         else         n0:=m&b;         end if;         if a(1)<='0' then         n1:="0000000000000000";         else         n1:=m(7 downto 1)&b&m(0);         end if;         if a(2)<='0' then         n2:="0000000000000000";         else         n2:=m(7 downto 2)&b&m(1 downto 0);         end if;         if a(3)<='0' then         n3:="0000000000000000";         else         n3:=m(7 downto 3)&b&m(2 downto 0);         end if;         if a(4)<='0' then         n4:="0000000000000000";         else         n4:=m(7 downto 4)&b&m(3 downto 0);         end if;         if a(5)<='0' then         n5:="0000000000000000";         else         n5:=m(7 downto 5)&b&m(4 downto 0);         end if;         if a(6)<='0' then         n6:="0000000000000000";         else         n6:=m(7 downto 6)&b&m(5 downto 0);         end if;         if a(7)<='0' then         n7:="0000000000000000";         else         n7:=m(7)&b&m(6 downto 0);         end if;         y<=n0+n1+n2+n3+n4+n5+n6+n7;   end if; end process p1;end rtl;

評分

參與人數 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵!

查看全部評分

回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 久久成人综合 | 国产精品美女久久久久久久网站 | 夜色www国产精品资源站 | 91精品久久久久久久久久小网站 | 国产欧美一区二区三区在线看 | 爱爱免费视频 | aaa综合国产 | 一区二区三区四区av | 日韩在线视频免费观看 | 婷婷亚洲综合 | 自拍偷拍中文字幕 | 欧美激情在线一区二区三区 | 深夜福利亚洲 | 91精品一区二区 | 天天爽天天干 | av网站在线看 | 亚洲三级在线观看 | 91精品国产综合久久久久久首页 | 欧美在线观看一区 | 三级在线视频 | re久久| 在线成人av| 国产精品久久久久久亚洲调教 | 污污的网站在线观看 | 午夜视频在线观看网址 | 亚洲精品久久久久久国产精华液 | 久久精品视频免费看 | 密色视频| 人人干人人舔 | 成人精品网 | 精品久久久久久亚洲精品 | 亚洲成人精品在线观看 | 精品国产一级 | 成年人在线观看 | 91xxx在线观看| 青青草视频免费观看 | 久久国产婷婷国产香蕉 | 国产色在线| 爱爱视频网| 精品国产99 | 亚洲国产欧美国产综合一区 |