Algorisme de Booth: diferència entre les revisions
Contingut suprimit Contingut afegit
Línia 49:
entity BoothMult4 is port(
A: in std_logic_vector(3 downto 0);
B: in std_logic_vector(3 downto 0);
O: out std_logic_vector(7 downto 0)
);
end BoothMult4;
architecture boothMult4Arch of BoothMult4 is
Algorisme:
end process;
▲ num := "000000000";
▲ Y := unsigned(B);
▲ num(4 downto 1) := A;
▲ for i in 0 to 3 loop
▲ if(num(1) = '1' and num(0) = '0') then
▲ Z := unsigned(num(8 downto 5));
▲ num(8 downto 5) := std_logic_vector(Z - Y);
▲ elsif(num(1) = '0' and num(0) = '1') then
▲ Z := unsigned(num(8 downto 5));
▲ num(8 downto 5) := std_logic_vector(Z + Y);
▲ end if;
▲ num(7 downto 0) := num(8 downto 1);
▲ end loop;
▲ O(7 downto 0) <= num(8 downto 1);
end boothMult4Arch;
|