vhdl吧 关注:4,586贴子:17,612
  • 0回复贴,共1

求助 八位以为相加乘法器。。。哪里有错啊。。波形不对啊

只看楼主收藏回复

use ieee.std_logic_unsigned.all; entity cfq isport (clk,load: in std_logic;dinx,diny : in std_logic_vector(7 downto 0);dout :out std_logic_vector(15 downto 0));end cfq;architecture behav of cfq is signal b : std_logic_vector(15 downto 0);signal sum : std_logic_vector(15 downto 0);beginprocess (clk,load)variable x,y : std_logic_vector(7 downto 0);beginif clk'event and clk ='1' thenif load='1' then x:=dinx;y:=diny;else x:="10000000";y:="10000000";for n in 0 to 7 loop if(x(n)='1') then b(7+n downto n)<=y(7 downto 0);sum<=sum+b;else b<="0000000000000000";end if;end loop;end if;end if;end process;dout<=sum;end behav;


IP属地:湖北1楼2013-07-18 15:27回复