booth multilpier in vhdl

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

  1. kingki

    kingki

    Joined:
    Nov 3, 2012
    Messages:
    1
    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. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris
    Replies:
    0
    Views:
    412
    Chris
    Jan 31, 2005
  2. Tim

    Digital Photo "booth"

    Tim, Nov 5, 2003, in forum: Digital Photography
    Replies:
    5
    Views:
    642
    zeitgeist
    Nov 6, 2003
  3. Phil7101

    Phone Booth spoiler on the cover!

    Phil7101, Jul 4, 2003, in forum: DVD Video
    Replies:
    5
    Views:
    1,286
    Sydney Assbasket
    Jul 6, 2003
  4. Phil7101

    Re: Phone Booth spoiler on the cover!

    Phil7101, Jul 4, 2003, in forum: DVD Video
    Replies:
    4
    Views:
    616
    Phil7101
    Jul 5, 2003
  5. becool_nikks
    Replies:
    0
    Views:
    1,975
    becool_nikks
    Mar 6, 2009
Loading...

Share This Page