Download - Serial Adder Binary Multiplier
● Add 1111 and 1111● Add 1000 and 0001
entity SA is
Port ( st : in std_logic; A,B: inout std_logic_vector ( 3 downto 0); clk : in std_logic; acc : out std_logic_vector(3 downto 0)); end SA;
architecture Behavioral of SA isType state is state0,state1,state2,state3;signal ps,ns: state;signal C,D: std_logic_vector (3 downto 0);signal ci,ciplus,si,sh:std_logic;
begin
si<=A(0) xor B(0) xor ci ; ciplus <=(A(0) and B(0)) or (A(0) and ci ) or ( B(0) and ci );
process(ps,st)begin case ps is when state0=>
if(st='0')then ns<=state0; else ns<=state1; sh<='1'; end if; when state1 =>
sh<='1'; ns<= ps+1;when state2 =>
sh<='1'; ns<= ps+1; when state3=>
sh<='1'; ns <=0; end case;end process;
process(clk,sh) begin if(clk 'event and clk ='1')then ps <= ns; ci<= ciplus; end if;
if(sh='1') then C<=si & A(3 downto 1) ; D<=B(0) & B(3 downto 1); end if;
end process;
acc<= C;
end Behavioral;
● 1111 * 1111● 1000 * 1000● 0001 * 1000● 0001 * 0001
Place it inside package and call the library