Multiplier Shift Add
Multiplier Shift Add
use BITLIB.bit_pack.all;
entity mult4X4 is
port (Clk, St: in bit;
Mplier,Mcand : in bit_vector(3 downto 0);
Done: out bit);
end mult4X4;
begin
proces
s
begin
wait until Clk = ‘1’;
case State is
when 0 =>
if St='1' then
ACC(8 downto 4) <= 00000";
ACC(3 downto 0) <= Mplier;
State <= 1;
end if;
when 1 | 3 | 5 | 7 =>
if M = ‘1’ then
ACC(8 downto 4) <= add4(ACC(7 downto
4),Mcand,'0'); State <= State+1;
else
ACC <= 'O' & ACC(8 downto 1);
State <= State + 2;
end if;
when 2 | 4 | 6 | 8 =>
ACC <= '0' & ACC(8 downto 1);
State <= State + 1;
when 9 =>
State <= 0;
end case;
end process;
Done <= '1' when State = 9 else
'O'; end behavel;