booth multilpier in vhdl

Discussion in 'Software' started by kingki, Nov 3, 2012.

  1. kingki

    kingki

    Joined:
    Nov 3, 2012
    Messages:
    1
    Likes Received:
    0
    hai i am new to vhdl..i got error in my booth multiplier coding..pls correct and nd send me the same..thanks in advance


    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 module1 is
    Port ( clk,notclk:in STD_LOGIC;
    mpr : in STD_LOGIC_VECTOR (3 downto 0):="0000";
    mpd : in STD_LOGIC_VECTOR (3 downto 0):="0000";
    product : out STD_LOGIC_VECTOR(2*4-1 DOWNTO 0));
    end module1;

    architecture Behavioral of module1 is
    signal code:std_logic_vector(1 downto 0):="00";
    signal X:STD_LOGIC_VECTOR (3 downto 0):="0000";
    signal Y:STD_LOGIC_VECTOR (3 downto 0):="0000";
    signal Xminus1:std_logic;
    signal newY :STD_LOGIC_VECTOR (3 downto 0):="0000";
    signal U1:STD_LOGIC_VECTOR (3 downto 0):="0000";
    signal V1:STD_LOGIC_VECTOR (3 downto 0):="0000";
    signal U11:STD_LOGIC_VECTOR (3 downto 0):="0000";
    signal V11:STD_LOGIC_VECTOR (3 downto 0):="0000";
    signal X1:STD_LOGIC_VECTOR(3 DOWNTO 0):="0000";
    begin
    p1:process(clk)is
    begin
    if rising_edge(clk)then
    X<=mpr;
    Y<=mpd;
    newY<= not(Y)+"0001";
    Xminus1<=X(0);
    code<=X(0) & Xminus1;

    end if;
    end process;
    p2:process(code,notclk) is
    begin
    if rising_edge(notclk)then
    loop1:for i in 3 downto 0 loop
    if code= "00" then
    U1(3)<=U1(3);
    U1(2 downto 0)<=U1(3 downto 1);
    v1(3)<=U1(0);
    V1(2 downto 0)<=U1(3 downto 1);
    X1(3)<=X(0);
    Xminus1<=X(0);
    X1(2 downto 0)<=X(3 downto 1);
    elsif code= "11" then
    U11(3)<=U1(3);
    U11(2 downto 0)<=U1(3 downto 1);
    v11(3)<=u1(0);
    V11(2 downto 0)<=U1(3 downto 1);
    X1(3)<=X(0);
    Xminus1<=X(0);
    X1(2 downto 0)<=X(3 downto 1);
    elsif code= "01" then
    U11(3 downto 0)<=newY+U1(3 downto 0);
    U11(3)<=U1(3);
    U11(2 downto 0)<=U1(3 downto 1);
    v11(3)<=u1(0);
    V11(2 downto 0)<=U1(3 downto 1);
    X1(3)<=X(0);
    Xminus1<=X(0);
    X1(2 downto 0)<=X(3 downto 1);
    elsif code="10" then
    U11(3 downto 0)<=U1(3 downto 0)+(not(Y)+"0001");
    U11(3)<=U1(3);
    U11(2 downto 0)<=U1(3 downto 1);
    v11(3)<=u1(0);
    V11(2 downto 0)<=U1(3 downto 1);
    X1(3)<=X(0);
    Xminus1<=X(0);
    X1(2 downto 0)<=X(3 downto 1);
    end if;
    end loop;
    end if;
    end process;
    PRODUCT<=U11(3 downto 0) & V11(3 downto 0);
    end Behavioral;
     
    kingki, Nov 3, 2012
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.